Jump to content

Password recovery script


Recommended Posts

Well, I'm at wits end. Thanks in advance for any help. Pulled this script out of nowhere, trying to modify it to provide a simply password recovery function. Having ZERO luck. Seems like I've tried everything. Obviously, I have not yet tried the right thing.

 

Login/registration scripts work fine, but this one, no...

 

The [database] connections all seem to work, but my error message is always "Your email address is not correct". The script seems to be talking to my database, but it only returns this error (and yes, my email is correct :-)).  :wtf:

 

My table is tbl_members, the email field in the table is named "username", and the password field is named "pwd".

 

Thoughts?

 

<?

 

include "include/session.php";

 

include "include/z_db.php";

 

?>

<!doctype html public "-//w3c//dtd html 3.2//en">

 

 

<html>

 

<head>

<title>Password Check</title>

<meta name="GENERATOR" content="Arachnophilia 4.0">

<meta name="FORMATTER" content="Arachnophilia 4.0">

</head>

 

<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">

 

<?

 

$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 username, pwd FROM tbl_members WHERE tbl_members.username = '$email'";

$st=mysql_query($query);

$recs=mysql_num_rows($st);

$row=mysql_fetch_object($st);

$em=$row->email;// 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 . You can signup and login to use our site. <BR><BR><a href='website_registration.php'> Register </a> </center>"; exit;}

 

 

        $headers4="andy@space-explorers.org";        ///// Change this address within quotes to your address ///

$headers.="Reply-to: $headers4\n";

$headers .= "From: $headers4\n";

$headers .= "Errors-to: $headers4\n";

//$headers = "Content-Type: text/html; charset=iso-8859-1\n".$headers;// for html mail un-comment this line

 

if(mail("$em","Your Request for login details","This is in response to your request for login details at site_name \n \nLogin ID: $row->userid \n Password: $row->username \n\n Thank You \n \n siteadmin","$headers")){echo "<center><font face='Verdana' size='2' ><b>THANK YOU</b> <br>Your password is posted to your emil address . Please check your mail after some time. </center>";}

else{ echo " <center><font face='Verdana' size='2' color=red >There is some system problem in sending login details to your address. Please contact site-admin. <br><br><input type='button' value='Retry' onClick='history.go(-1)'></center></font>";}

 

 

}

 

else {echo "<center><font face='Verdana' size='2' color=red >$msg <br><br><input type='button' value='Retry' onClick='history.go(-1)'></center></font>";}

?>

<center>

<br><br></center>

 

</body>

 

</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.