帳號:
註冊信箱:
'; } // 當使用者輸入完帳號及註冊信箱後 else { $my_user = new W_user(); $my_user->user = $_POST["user"]; $my_user->email = $_POST["email"]; // 連結資料庫 $link = mysql_connect($mysql_host, $mysql_user, $mysql_password) or die(mysql_error()); mysql_select_db($mysql_database, $link) or die(mysql_error() ); mysql_query("SET NAMES 'utf8'"); // 判斷此帳號密碼是否存在 $str = sprintf("SELECT `id` FROM `%s` WHERE `user` LIKE '%s' and `email` LIKE '%s' limit 1", $mysql_table, $my_user->user, $my_user->email); $result = mysql_query($str , $link) or die(mysql_error() ); if (mysql_num_rows($result) == 1) { // 更新使用者密碼 $my_user->new_password = $my_user->get_new_password(); // 取得新密碼 $str = sprintf("UPDATE `%s` SET `password` = '%s' WHERE `user` LIKE '%s' ", $mysql_table, md5($my_user->new_password), $my_user->user); mysql_query($str , $link) or die(mysql_error() ); mysql_close($link); // 寄送新密碼 $my_user->operator = "new_password"; // user 需要更新密碼 include ("smtp_mail.php"); $my_user->redirect_to("$w_localhost", "新密碼寄送完畢"); } else { $my_user->redirect_to("$w_localhost", "帳號與密碼不符合"); } } ?>