AL8 Forum
   登錄註冊幫助


標題: 更改密碼問題
 【EndLess】
 0063703
Rank: 1

頭銜: Newbie

帖子: 44

精華: 0

積分: 276 點

現金: 0 元

存款: 0 元

閱讀權限: 10

註冊: 2007-1-12

狀態: 離線
 
發表於 2008-8-2 00:19  資料  個人空間  短消息  加為好友 
更改密碼問題

<?

include("lib.php");

$id = $_POST["id"];
$oldpass = $_POST["oldpass"];
$pass = $_POST["pass"];
$pass2 = $_POST["pass2"];
$mail = $_POST["mail"];

$query = "select name, pass from logindata where name='$id'  AND pass='$oldpass'" ;
$result = mysql_query($query);
if (mysql_num_rows($result)>0){
        $userid = mysql_result($result, 0, 0);
        $user_pass = mysql_result($result, 0, 1);

$query = "select name from logindata where name='$mail'" ;
$result = mysql_query($query);
if (mysql_num_rows($result)>0){
        $user_mail = mysql_result($result, 0, 2);
}
else
Error("用戶名或密碼錯誤");

if (strlen($pass)<8) {
Error("你的密碼少於八個字母");
}

if ($pass != $pass2) {
Error("確認新密碼輸入不相同");
}

if (empty($mail)){
Error("你沒有輸入你的電郵地址");
}

$query2 = "select name from logindata where email='$mail'" ;
$result = mysql_query($query);
if (mysql_num_rows($result)>0){
$user_mail = mysql_result($result, 0, 2);
}
else
        Error("電郵錯誤");

        if ($id == $userid and $oldpass == $user_pass) {
                $query = "UPDATE `logindata` SET `pass` = '$pass' WHERE `name` = '$id' LIMIT 1";
                $result = mysql_query($query);
                if ($result) {
                        Error("修改成功,你的新密碼為: $pass 。請記住你的密碼並妥善保管。");
                }
        }else{
                Error("用戶名或密碼錯誤");
        }
?>
錯了EMAIL也可以改PW  請問我做錯了什麼?




 AL8 Forum © All rights reserved.
頂部
 【賢】◎§
 0077359
Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6
點擊查看 【賢】◎§ 的詳細資料

頭銜: Forum Legend

帖子: 2539

精華: 0

積分: 24192 點

現金: 1181 元

存款: 302 元

閱讀權限: 70

註冊: 2007-5-24

來自: Fanling

狀態: 在線
 
發表於 2008-8-2 12:30  資料  個人空間  主頁 短消息  加為好友 
else
        Error("電郵錯誤");
呢度咁得意既




 AL8 Forum © All rights reserved.
頂部
 【EndLess】
 0063703
Rank: 1

頭銜: Newbie

帖子: 44

精華: 0

積分: 276 點

現金: 0 元

存款: 0 元

閱讀權限: 10

註冊: 2007-1-12

狀態: 離線
 
發表於 2008-8-4 01:55  資料  個人空間  短消息  加為好友 
因為要EMAIL岩先可以改PW




 AL8 Forum © All rights reserved.
頂部
 kohong
 0040689
Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6

頭銜: Forum Legend

暱稱: KC 仔

帖子: 3323

精華: 0

積分: 646 點

現金: 0 元

存款: 20728 元

閱讀權限: 70

註冊: 2006-2-27

狀態: 離線
 
發表於 2008-8-4 12:58  資料  個人空間  短消息  加為好友  添加 kohong 為MSN好友 通過MSN和 kohong 交談 ICQ 狀態
你 d code 好亂,  一時又加 {} 一時又唔加

$query2 = "select name from logindata where email='$mail'" ;
$result = mysql_query($query);
if (mysql_num_rows($result)>0){
$user_mail = mysql_result($result, 0, 2);
}
else
        Error("電郵錯誤";

呢到同你改密碼戈part其實無關係吧?
你只係拎到數據就拎,  拎唔到就出電郵錯誤
下面同上面完全好似無關係




是咁的
 AL8 Forum © All rights reserved.
頂部
 【EndLess】
 0063703
Rank: 1

頭銜: Newbie

帖子: 44

精華: 0

積分: 276 點

現金: 0 元

存款: 0 元

閱讀權限: 10

註冊: 2007-1-12

狀態: 離線
 
發表於 2008-8-5 03:00  資料  個人空間  短消息  加為好友 
QUOTE:
原帖由 kohong 於 2008-8-4 12:58 發表
你 d code 好亂,  一時又加 {} 一時又唔加
$query2 = "select name from logindata where email='$mail'" ;
$result = mysql_query($query);
if (mysql_num_rows($result)>0){
$user_mail = mysql_result ...



那大大可幫小弟改正一下嗎?




 AL8 Forum © All rights reserved.
頂部

聯繫我們 - AL8 Forum - 網頁空間由 I-SERVICES 提供 - Archiver - WAP
清除 Cookies, 當前時區 GMT+8, 現在時間是 2008-11-20 18:39
Processed in 0.025805 second(s), 7 queries , Gzip enabled
Powered by Discuz! 5.5.0  © 2001-2007 Comsenz Inc.