|
$DbLink = new DB;
if($_POST[Submit]=="Submit"){
$DbLink->query("SELECT UUID,active FROM ".C_WIUSR_TBL." WHERE emailadress='$_POST[email]'");
list($UUID,$active) = $DbLink->next_record();
if($active=='1'){
$DbLink->query("SELECT UUID FROM ".C_CODES_TBL." WHERE UUID='$UUID' and info='pwreset'");
list($UUIDCODE) = $DbLink->next_record();
if($UUIDCODE != ""){
echo "";
}else{
echo "";
// CODE generator
function code_gen($cod=""){
// ######## CODE LENGTH ########
$cod_l = 10;
// ######## CODE LENGTH ########
$zeichen = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9";
$array_b = explode(",",$zeichen);
for($i=0;$i<$cod_l;$i++) {
srand((double)microtime()*1000000);
$z = rand(0,35);
$cod .= "".$array_b[$z]."";
}
return $cod;
}
$code=code_gen();
// CODE generator
$DbLink->query("INSERT INTO ".C_CODES_TBL." (code,UUID,info,email,time)VALUES('$code','$UUID','pwreset','$_POST[email]',".time().")");
//-----------------------------------MAIL--------------------------------------
$date_arr = getdate();
$date = "$date_arr[mday].$date_arr[mon].$date_arr[year]";
$sendto = $_POST[email];
$subject = "Reset Account Password from ".SYSNAME;
$body .= "Here is the link to change your password for ".SYSNAME.".";
$body .= "\n\n";
$body .= "Password reset code: $code";
$body .= "\n\n";
$body .= "To get a new password just click the link below this text:";
$body .= "\n";
$body .= "".SYSURL."/index.php?page=pwreset&code=$code";
$body .= "\n\n";
$body .= "Thank you for using ".SYSNAME."";
$header = "";
$mail_status = mail($sendto, $subject, $body, $header);
//-----------------------------MAIL END --------------------------------------
}
}else if($active == '0'){
echo "";
}else{
echo "";
}
}
?>
|