function request_restore_password(){ require_once('conf/location.php'); global $LANG; global $CONF; $db = clone $GLOBALS['maindb']; if (!isset($_GET['user_request_restore_password'])) return array("ok"=>false, error=>"no email"); $user = new RegUser(); $user->setEmail($_GET['user_request_restore_password']); $user->load(); $user_id=$user->getId(); if (empty($user_id)) return array("ok"=>false, "error"=>"no email"); $check=hash('sha512',$user->getEmail().$user->getEncPassword()."Θ"); eval($LANG['requestrestoreemail_body']); // system("echo \"".$body."\" > email.html"); /*$headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=UTF-8\r\n"; $headers .= "From: {$CONF['email_from']}\r\n"; $headers .= "To: {$user->getNickname()} <{$user->getEmail()}>\r\n"; */ //print_r($body); require_once('class/Mail.php'); $a=new Mail(); $a->setEmailTo($user->getEmail()); $a->setNicknameTo($user->getNickname()); $a->setSubject("Pedido de recuperação de senha"); $a->setSubjectMsg(""); $a->setMsg($body); if ($a->send()) return array("ok"=>true,"error"=>""); else return array("ok"=>false,"error"=>"could not send email"); }
?> <?php require_once('conf/location.php'); global $LANG; global $CONF; $db = clone $GLOBALS['maindb']; if (!isset($_GET['b'])) return array("ok"=>false, error=>"no email"); $user = new RegUser(); $user->setEmail($_GET['b']); $user->load(); $user_id=$user->getId(); if (empty($user_id)) return array("ok"=>false, "error"=>"no email"); $check=hash('sha512',$user->getEmail().$user->getEncPassword()."Θ"); if ($check==$_GET['c']){ require_once('tool/utility.php'); $newpassword=generateRandomPassword(); $user->setPassword($newpassword); eval($LANG['restoreemail_body']); //system("echo \"".$body."\" > email.html"); /*$headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=UTF-8\r\n";