<?php
//connect 2 mysql goes here
include"config.php";
$mail="[email protected]";
$randomnum=(int)(rand()*rand()*1000000);
$newpass=str_replace(2,"ujd",time()-rand()*randomnum);//this line make a random password
$res=mysql_query('SELECT username,password FROM users WHERE mail="$email" LIMIT 1');
while($re=mysql_fetch_array($res)){
echo $re['username'];
if($re["id"]=!"")
{
if(mysql_query("Update users set password='$newpass' WHERE id={$re['id']} Limit 1")&&mail($mail,"Your new pass",'',"Hi user\n\t your new pass is $newwpass"))
{
print("your password was sent to your mail");
}else{
print("there is some problem in connectiong to DB plz try again later");
}
}else{
print("there is not any mail like it");
} }
if(!$r){
echo"error query select";
}
?>