PDA

View Full Version : Lost Password script?


Tim Mousel
Fri 12th May '00, 3:47pm
Hi,

I need some help with a lost password script. I've modified a script and it will send email, but it has the following problems:

1. It has to be submitted twice before actually sending the email.


Here is an example:
http://www.worldslargestmall.cc/personalize/lostemailfrom.php

Here is what I have so far:


<?

mysql_connect("localhost", "us", "fgfds");
mysql_select_db("db");

if ($action == "lostemail") {

$query = mysql_query("SELECT * FROM personalize WHERE(email='$email')");

$info = mysql_fetch_array($query);

?>

<?
include ("prepend.inc");
include ("lostpassword.inc");

//here are the contents of lostpassword.inc:
//<? mail("$email", "$lostsubject", "$lostmessage");
//The $lostsubject and $lostmessage are defined in prepend.inc.

?>
?>

<?
CommonHeader("Email Success!");
?>
<CENTER><P>You will receive your password shortly at the following address.<BR>
<BR>Email: <? echo $email ?><BR><BR>
Click <a href="http://worldslargestmall.cc/personalize/">here</a> to go to your homepage.
<?
CommonFooter();
}



else {

$query = mysql_query("SELECT * FROM personalize WHERE(email='$email')");


if (mysql_num_rows($query) != 1) {
include "prepend.inc";
CommonHeader("That email was not correct");
echo "The $email was not correct<P>Please Try Again.";
CommonFooter();
exit;
}


else {
$info = mysql_fetch_array($query);

include ("prepend.inc");

CommonHeader("Enter your email address");


?>
<FORM METHOD=POST ACTION="<? echo $PHP_SELF ?>">


<INPUT TYPE="hidden" NAME="Password" VALUE="<? echo $info['Password'] ?>">
<INPUT TYPE="hidden" NAME="Name" VALUE="<? echo $info['Name'] ?>">
<INPUT TYPE="hidden" NAME="action" VALUE="lostemail">

<CENTER>
<TABLE>
<TR>
<TD COLSPAN=2><CENTER>Enter your email address</CENTER></TD>
</TR>

<TR>
<TD>Your Email Address</TD>
<TD><input type="text" name="email" size="20" value="<? echo $info['email'] ?>"></TD>
</TR>


<TR><TD COLSPAN=2><CENTER><INPUT TYPE="submit" Value="Retrieve Password"></CENTER></TD></TR>
</TABLE>
</FORM>


<?

CommonFooter();

}
}
?>

Any help will be much appreciated!

Tim