Urgent Help Needed!

This is a discussion on "Urgent Help Needed!" within the Databases section. This forum, and the thread "Urgent Help Needed! are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Databases

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Oct 28th, 2007, 19:56
Up'n'Coming Member
Join Date: Apr 2007
Location: Canada
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Urgent Help Needed!

Hi fellows!
I really need some help badly. I have a page where user login to update their profile and also if they forgot their password, they input their password and it send the user a random password and also change that to the database. Everything was working fine until now, all of a sudden user can not login anymore and user can not get the new password if they click on forgot password. In both cases I found that for some reason whatever user type for login - userid and for forgot password email , it can not read that so it message out wrong userid and password / or email address it is not correct though all of them are correct. If anyone have any idea what might be the problem would really appreciate it. Just to let you know user can sign up no problem.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Oct 28th, 2007, 20:41
Reputable Member
Join Date: Sep 2007
Location: Tehran - Iran
Age: 29
Posts: 434
Blog Entries: 2
Thanks: 7
Thanked 7 Times in 7 Posts
Re: Urgent Help Needed!

is there any error message or something, or can u post the link that gives u error ?
__________________
Designing For Communicating
Website : http://www.datisdesign.com
Weblog : http://blog.datisdesign.com

Last Blog Entry: Throughout IRAN (Dec 10th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Oct 28th, 2007, 21:05
Up'n'Coming Member
Join Date: Apr 2007
Location: Canada
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Urgent Help Needed!

Well, it does not pass the following code no mater what it is....
PHP: Select all

$email=mysql_real_escape_string($email);
$status "OK";
$msg="";
//error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
if (!stristr($email,"@") OR !stristr($email,".")) {
$msg="Your email address is not correct<BR>"
$status"NOTOK";} 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Oct 28th, 2007, 21:21
Reputable Member
Join Date: Sep 2007
Location: Tehran - Iran
Age: 29
Posts: 434
Blog Entries: 2
Thanks: 7
Thanked 7 Times in 7 Posts
Re: Urgent Help Needed!

try this code :

PHP: Select all

<?php
if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"$email)) {            
        
$msg "Please enter the proper email address !";
        
$status"NOTOK";
        } else {
            
$status "OK";
            
$msg="";
        }
?>
__________________
Designing For Communicating
Website : http://www.datisdesign.com
Weblog : http://blog.datisdesign.com

Last Blog Entry: Throughout IRAN (Dec 10th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Oct 28th, 2007, 21:24
Highly Reputable Member
Join Date: Jul 2006
Location: Devon, England
Posts: 565
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Urgent Help Needed!

I don't know if this will help you but I have a function to check email address
PHP: Select all

function check_email_address($email) { 
    
// First, we check that there's one @ symbol, and that the lengths are right 
    
if (!ereg("^[^@]{1,64}@[^@]{1,255}$"$email)) { 
    
// Email invalid because wrong number of characters in one section, or wrong number of @ symbols. 
    
return false
    } 
    
// Split it into sections to make life easier 
    
$email_array explode("@"$email); 
    
$local_array explode("."$email_array[0]); 
    for (
$i 0$i sizeof($local_array); $i++) { 
    if (!
ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$"$local_array[$i])) { 
        return 
false
        } 
    } 
    if (!
ereg("^\[?[0-9\.]+\]?$"$email_array[1])) { // Check if domain is IP. If not, it should be valid domain name 
    
$domain_array explode("."$email_array[1]); 
    if (
sizeof($domain_array) < 2) { 
        return 
false// Not enough parts to domain 
        

        for (
$i 0$i sizeof($domain_array); $i++) { 
              if (!
ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$"$domain_array[$i])) { 
            return 
false
              } 
         } 
    } 
    return 
true

and to use it in your code you would do
PHP: Select all

$email=mysql_real_escape_string($email);
$status "OK";
$msg="";
//error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
if(!check_email_address($email)) {
$msg="Your email address is not correct<BR>"
$status"NOTOK";} 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Oct 28th, 2007, 22:05
Up'n'Coming Member
Join Date: Apr 2007
Location: Canada
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Urgent Help Needed!

I tried marsoul solutions I still got the message " Enter the proper email address" and I tried AdRock Solution and I still get the message "Your email address is not correct". I wonder if anything got change in the mysql server so that $email=mysql_real_escape_string($email); can not run anymore?
or do you think the part got hacked some how. Just to remind you that everything was running fine just day ago.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Oct 28th, 2007, 22:12
Reputable Member
Join Date: Sep 2007
Location: Tehran - Iran
Age: 29
Posts: 434
Blog Entries: 2
Thanks: 7
Thanked 7 Times in 7 Posts
Re: Urgent Help Needed!

it seems the problem is before checking the email address, how do u pass the email to the code ?
__________________
Designing For Communicating
Website : http://www.datisdesign.com
Weblog : http://blog.datisdesign.com

Last Blog Entry: Throughout IRAN (Dec 10th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Oct 28th, 2007, 22:26
Up'n'Coming Member
Join Date: Apr 2007
Location: Canada
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Urgent Help Needed!

Here is my forgot password form page and 2nd one is the process page
PHP: Select all

<?
//this is a .php file
?>
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<head>
<title>(Type a title for your page here)</title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>
<body>
<style>
body
{
background-attachment: fixed;
background-image: url("../images/waterm.gif");
background-repeat: no-repeat;
background-position: center center

}
</style>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<form action='forgot-passwordck.php' method=post>
<table border='0' cellspacing='0' cellpadding='0' align=center>
 <tr bgcolor='#f1f1f1' > <td colspan='2' align='center'><font face='verdana, arial, helvetica' size='2' align='center'>&nbsp;Forgot Password ?<BR>Enter your email address</font></td> </tr>
  <tr bgcolor='#ffffff'> <td><font face='verdana, arial, helvetica' size='2' align='center'>  &nbsp;Email  &nbsp; &nbsp;
</font></td> <td  align='center'><font face='verdana, arial, helvetica' size='2' >
<input type ='text' class='bginput' name='email' ></font></td></tr>

<tr bgcolor='#f1f1f1'> <td  colspan='2' align='center'><font face='verdana, arial, helvetica' size='2' align='center'>  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
<input type='submit' value='Submit'> <input type='reset' value='Reset'>
</font></td> </tr>
<tr> <td bgcolor='#ffffff' ><font face='verdana, arial, helvetica' size='2' align='center'> &nbsp;<a href=login.php>Login</a></font></td> <td bgcolor='#ffffff' align='center'><font face='verdana, arial, helvetica' size='2' ><a href='register.html'>New Member Sign UP</a></font></td></tr>
 
</table></center></form>

</body>
</html>
And here is the process file
PHP: Select all

<?
//*****************************************
include "session.php";
include 
"***.php"// database connection details stored here
//////////////////////////////
?>
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<head>
<title>**********</title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>
<body>
<style>
body
{
background-attachment: fixed;
background-image: url("../images/waterm.gif");
background-repeat: no-repeat;
background-position: center center

}
</style>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<?php
$email
=mysql_real_escape_string($email);
$status "OK";
$msg="";
//error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
if (!stristr($email,"@") OR !stristr($email,".")) {
$msg="Your email address is not correct<BR>"
$status"NOTOK";}

echo 
"<br><br>";
if(
$status=="OK"){  $query="SELECT userid,password FROM tbl_login WHERE tbl_login.userid = '$email'";
$st=mysql_query($query);
 
$recs=mysql_num_rows($st);
$row=mysql_fetch_object($st);
$em=$row->userid;// email is stored to a variable
 
if ($recs == 0) {  echo "<center><font face='Verdana' size='2' color=red><b>No Password</b><br> Sorry Your address is not there in our database <br>You can signup and login to use our site. <BR><BR><a href='register.html'> Sign UP </a> </center>"; exit;}
////////////////////////////////////////////////////////////
function makeRandomPassword() { 
          
$salt "abchefghjkmnpqrstuvwxyz0123456789"
          
srand((double)microtime()*1000000);  
          
$i 0
          while (
$i <= 7) { 
                
$num rand() % 33
                
$tmp substr($salt$num1); 
                
$pass $pass $tmp
                
$i++; 
          } 
          return 
$pass
    } 
    
$random_password makeRandomPassword(); 
    
$db_password md5($random_password); 
     
    
$sql mysql_query("UPDATE tbl_login SET password='$db_password'  
                WHERE userid='$email'"
); 
     
$subject "Your password at domainname"
    
$message "Hi, we have reset your password. 
     
    New Password: $random_password 
     
    http://www.*****.com
    Once logged in you can change your password
/////////////////////////////////////////////////////
    Thanks! 
    Site admin 
     
    This is an automated response, please do not reply!"
;
     
    
mail($email$subject$message"From:www.******.com 
Webmaster<admin@*********.com>\n 
        X-Mailer: PHP/" 
phpversion()); 
       echo 
"<center><font face='Verdana' size='3'> Your password has been sent!<br>Please check your e-mail!<br />"
   echo 
"<br><br>Click <a href='http://www.*********.com/login.php'>here</a> to login</font></center>";
 } 
 else {echo 
"<center><font face='Verdana' size='2' color=red >$msg <br><br><input type='button' value='Retry' onClick='history.go(-1)'></center></font>";}
?>
</body>
</html>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Oct 29th, 2007, 07:46
Highly Reputable Member
Join Date: Jul 2006
Location: Devon, England
Posts: 565
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Urgent Help Needed!

In you html page you need this

[html]<form action='forgot-passwordck.php' method='post'>[/HTML

in the php file try replacing
PHP: Select all

$email=mysql_real_escape_string($email); 

with this
PHP: Select all

$email mysql_real_escape_string($_POST['email']); 

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgent Help Needed! dhossai Databases 6 Oct 28th, 2007 02:30
Very urgent help needed gotmad PHP Forum 2 Sep 19th, 2007 14:45
Urgent help needed!! brianjohndub Web Page Design 5 Jul 13th, 2006 00:28
Urgent Help Needed! Stormraven PHP Forum 4 Feb 18th, 2006 21:46


All times are GMT. The time now is 02:17.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42