getName()){ if($user->getEmail() != $email){ $message = "該郵箱與學生證號不匹配"; $result = 2; }else{ $password = ''; for($i=0; $i<8; $i++){ if($i == 3 || $i == 7){ $random = rand(0,6); switch($random){ case 0: $char = '!'; break; case 1: $char = '#'; break; case 2: $char = '%'; break; case 3: $char = '*'; break; case 4: $char = '@'; break; case 5: $char = '$'; break; case 6: $char = '^'; break; default: $char = '&'; } $password = $password.$char; } else{ $password = $password.rand(0,9); } } $stu_id = mysql_real_escape_string($stu_id); $query = "UPDATE users SET user_passwd='".md5($password)."' WHERE stu_id='".$stu_id."'"; $runQuery = mysql_query($query,$con); $subject = "香港中文大學三心社密碼重置"; $name = $user->getName(); $content = "亲爱的".$name."会员:你好!\r\n\r\n你的三心社官方網站會員登錄密碼已經重新設置,新的密碼為 ".$password." 建議你及時登錄自己的帳戶並且修改密碼。\r\n謝謝!\r\n\r\n香港中文大学三心社 敬上\r\n官方网站:3heartclub.com\r\n联络电邮:3heartclub@gmail.com"; $fromemail = "3heartclub@gmail.com"; mail($email, "$subject",$content, "From: $fromemail"); $result = 3; } }else{ $message = "該學生證號尚未登記"; $result = 2; } } if($result == 1 || $result == 2){ ?>

請輸入註冊時所使用的個人信息,以獲取密碼



/>
/>
");} ?>

密碼重置已經成功,請查收郵件。如果在30分鐘內仍未收到郵件,請點擊右上角的技術支援與管理員聯繫,並在郵件中注明你的學生證號。

"); } include_once($root."footer.php");?>