sqlsafe($_POST['email']); $getEmail = $db->CQuery('select count(id) from admin where email='.$email.' limit 0,1'); if($getEmail != 0){ $newPassword = Random_Password(10); $record = array( "passwd"=>$db->sqlsafe(md5($newPassword)) ); $update = $db->update('admin',$record,'email = '.$email.''); if($update){ $to = $_POST['email']; $subject = 'New Password'; $message = 'Hello Sir :'."\r\n"; $message.= 'Some one has request a new password.'."\r\n"; $message.= 'We have Change it successfully'."\r\n"; $message.= 'Your new password is :'.$newPassword.''."\r\n"; $headers = 'From: ' .$_POST['email'].''. "\r\n" . 'Reply-To: '.$_POST['email'].'' . "\r\n"; $result = mail($to, $subject, $message, $headers); if($result){ header('Location: '.$config['url'].'/lost.php?done=1'); }else{ header('Location: '.$config['url'].'/lost.php?error=4'); } }else{ header('Location: '.$config['url'].'/lost.php?error=1'); } }else{ header('Location: '.$config['url'].'/lost.php?error=1'); } }; } break; default: $skin = new skin(); $skin->assign('url',$globalVar['url']); $skin->assign('action','get'); $skin->assign('config',$config); $skin->assign('showMenu','0'); $skin->assign('incFile','site/lost.tpl'); $skin->assign('redir', treatGet(urldecode($_GET['redirect']))); $skin->display('site/index.tpl'); } } ?>