File size: 2.31Kb
<?php
//By PHPPUNK
//Copyright PHPPUNK
//ON 11-9-2011
include "inc/header.php";
include "inc/def.php";
include "inc/usrchk.php";
if($guest==0) {
header("location:home.php");
}
echo '<title>AdHubz.COM | Forgot Password</title>';
function rndgen ($minlength, $maxlength, $useupper, $usespecial, $usenumbers)
{
$charset = "abcdefghijklmnopqrstuvwxyz";
if ($useupper) $charset .= "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if ($usenumbers) $charset .= "0123456789";
if ($usespecial) $charset .= "~@#$%^*()_+-={}|]["; // Note: using all special characters this reads: "~!@#$%^&*()_+`-={}|\\]?[\":;'><,./";
if ($minlength > $maxlength) $length = mt_rand ($maxlength, $minlength);
else $length = mt_rand ($minlength, $maxlength);
for ($i=0; $i<$length; $i++) $key .= $charset[(mt_rand(0,(strlen($charset)-1)))];
return $key;
}
$keyxx = rand(1,1000);
$codex = secure('codex');
$code = secure('code');
if(isset($_POST['mail'])) {
$mail = secure('mail');
$get = mysql_query("SELECT * FROM users WHERE mail='$mail'") or die('Oops Error....Contact Us...');
$shushant = mysql_fetch_array($get);
$usr = $shushant['user'];
$mail = $shushant['mail'];
$id = $shushant['id'];
if(!$codex=$code)
{
print "<div class='prob'>Wrong security code !</div>";
die();
}
if(mysql_num_rows($get)==0) {
die("NO such user !");
} else {
$key = rndgen(10,10,false,false,true);
$pass = md5($key);
$dox = mysql_query("UPDATE users SET pass='$pass' WHERE id='$id'");
$to = "$mail";
$subject = "Password Reset - AdHubz.COM";
$message = "Hello $usr,
You have Just Request New Password.
Your New passwod : $key
Regards,
AdHubz.COM Team";
$from = "support@adhubz.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
if($dox) {
print "<div class='adbox'>New Password Have Been Send to Your Email. Now Login<a href='login.php'>here</a></div>";
}
}
}
?>
<div class="line">Frogot Password ?</div>
<form action="forgot.php" method="post">
<label for="user">E-Mail Address :</label><br />
<input size="30" maxlength="35" type="text" name="mail" />
<?
echo '
<label for="user">Security Code : '.$keyxx.'</label><br />
<input size="30" maxlength="3" type="hidden" value ="'.$kexxx.'" name="codexx" />
<input size="30" maxlength="3" type="text" name="code" />';
?>
<input type="submit" value="Get Password" />
</form>
<a href="login.php"><b>Login here</b></a>
<?php include "inc/footer.php"; ?>