PHP forgot password code
<?
include("include/common.php");
require_once("include/header.php");
if(isset($_POST[u2]))
{
$q1 = "SELECT * FROM users WHERE email='$u2'";
$r1 = mysql_query($q1) or die(mysql_error());
if(mysql_num_rows($r1) == '1')
{
$a1 = mysql_fetch_array($r1);
$to = $a1[email];
$subject = "Your password";
$message = "Hello $a1[first_name],\nYour login details are:\n\nUsername: $a1[username]\nPassword: $a1[password]\n\n$sitename\n$siteurl";
mail($to, $subject, $message, "From: $adminemail");
echo ("Password has been sent to ".$to);
require_once("include/footer.php");
exit();
}
else
{
$error2 = "<center><font face=verdana size=2 color=red>There is no email <b>$_POST[u2]</b> in our database.</font></center>";
}
}
require_once("include/forgot.php");
require_once("include/footer.php");
?>
<?
include("include/common.php");
require_once("include/header.php");
if(isset($_POST[u2]))
{
$q1 = "SELECT * FROM users WHERE email='$u2'";
$r1 = mysql_query($q1) or die(mysql_error());
if(mysql_num_rows($r1) == '1')
{
$a1 = mysql_fetch_array($r1);
$to = $a1[email];
$subject = "Your password";
$message = "Hello $a1[first_name],\nYour login details are:\n\nUsername: $a1[username]\nPassword: $a1[password]\n\n$sitename\n$siteurl";
mail($to, $subject, $message, "From: $adminemail");
echo ("Password has been sent to ".$to);
require_once("include/footer.php");
exit();
}
else
{
$error2 = "<center><font face=verdana size=2 color=red>There is no email <b>$_POST[u2]</b> in our database.</font></center>";
}
}
require_once("include/forgot.php");
require_once("include/footer.php");
?>
No comments:
Post a Comment