I had an independent programmer code a lost password program that will mail a password to somebody who has forgotten their password to a message forum on my site.
The following is the code, and it's not working. Can anybody tell me what's wrong with it?
Thanks in advance, Johnny
<?php
if(!isset($login)) $logine="";
if(!isset($visit)) $visit="";
require('auth.php');
anti();
if(empty($login)){
// If any blank do this
?>
You didn't enter your username, make a new attempt.
<form action="lostpassword.php" method="post">
Username <input type="text" name="login" size="20"><br>
<input type="submit" value="Submit">
</form>
<?php
}
elseif (!empty($login)){
// else do the processing
require('config/messagedb.conf');
require('functions.php');
if(!userExist($login))
header("Location: error.php?reason=notfound");
$sql = "SELECT password, email FROM users WHERE username = '$login'";
$result = mysql_query($sql);
$out = mysql_fetch_array($result);
//print $out[0];
$message = "Hi $login\n
\n\n Your password is: $out[0]\n\n
Go here to login http://url\n\n";
mail($out[1], "Password for messageboard", $message);
print "Mail sent check your mailbox";
}
?>