( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?
include 'DbSql.inc.php';
/******************* ACTIVATION BY FORM**************************/
if ($_POST['doReset']=='Reset Password')
{
$user_email = mysqli_real_escape_string($link,$_POST['user_email']);
//check if activ code and user is valid as precaution
$rs_check = mysqli_query("select catalogid from users where user_email='$user_email'") or die (mysql_error());
$num = mysql_num_rows($rs_check);
// Match row found with more than 1 results - the user is authenticated.
if ( $num <= 0 ) {
$msg = urlencode("Error - Sorry no such account exists or registered.");
header("Location: forgot.php?msg=$msg");
exit();
}
//generate 4 digit random number
$new = rand(1000,9999);
$md5_new = md5($new);
//set update md5 of new password
$rs_activ = mysqli_query("update users set pwd='$md5_new' WHERE
user_email='$user_email'") or die(mysql_error());
$host = $_SERVER['HTTP_HOST'];
$host_upper = strtoupper($host);
//send email
$message =
"Here are your new password details ...\n
User Email: $user_email \n
Passwd: $new \n
Thank You
Administrator
$host_upper
______________________________________________________
THIS IS AN AUTOMATED RESPONSE.
***DO NOT RESPOND TO THIS EMAIL****
";
mail($user_email, "Reset Password", $message,
"From: \"Member Registration\" <auto-reply@$host>\r\n" .
"X-Mailer: PHP/" . phpversion());
$msg = urlencode("Your account password has been reset and a new password has been sent to your email address.");
header("Location: forgot.php?msg=$msg");
exit();
}
?>
<html>
<head>
<title>Forgot Password</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script language="JavaScript" type="text/javascript" src="js/jquery.validate.js"></script>
<script>
$(document).ready(function(){
$("#actForm").validate();
});
</script>
<link rel="stylesheet" href="../css/flexi-background.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/styles.css" type="text/css" media="screen" />
</head>
<style type="text/css">
<!--
.style1 {font-size: 14px}
.style2 {font-size: 13px}
.style3 {font-weight: bold}
.centa {
text-align: center;
}
-->
</style><link href="<?php echo $siteaddress; ?>system/css/eziki.css" rel="stylesheet" type="text/css" />
</head>
<body style="background-image:url(a.jpg); background-position:center">
<?php include("header.php"); ?><br>
<br>
<br>
<div id="box">
<h1 style=" margin-top:10px;">Forgot Password</h1>
<form action="forgot.php" method="post" name="actForm" id="actForm" >
<table width="300" height="200" border="0" align="center" cellpadding="4" cellspacing="4">
<tr>
<td><input name="user_email" onClick="this.value='';" onFocus="this.select()" onBlur="this.value=!this.value?'Email':this.value;" value="My Email" type="text" class="required email" id="bigsearch" size="25"></td>
</tr>
<tr>
<td > <div align="center">
<p>
<input name="doReset" type="submit" value="Reset Password">
</p>
</div></td>
</tr>
</table>
</form>
</div>
<center><a href="login.php" class="ezbutton">Login here</a></center>
</body>
</html>