[請益] 登入帳號密碼問題(急)
以下是我的程式碼 問題在於我不管輸入正確或錯誤帳號密碼都直接跳 error.php
麻煩各位幫我看一下 感恩
------------------ main.html --------------
<html>
<body>
<?php
<form method = "post" name="login" action="check.php" >
<font color="#FFFFFF"><br>帳號 </font>
<input type=text name="id" size=10><B><font color="#FF0000">(學號
)</font></B><p>
<font color="#FFFFFF">密碼 </font><B>
<input type="password" name="password" size=10><p><font color="#FF0000">(身分
證英文字母+後四碼)</font></B><p>
<input type=submit name="b1" value="登入">
<input type=reset size="100" value="重填">
</form>
?>
</body>
</html>
------------------- check.php ----------------
<?php
session_start();
$id=$_POST['id'];
$password=$_POST['password'];
$ip = mysql_connect ("localhost") ;
mysql_select_db("test1");
$sql="select id from ntumesa WHERE id = '$id' AND password = '$password'";
$result = mysql_query($sql);
$nT = mysql_num_rows($result);
// 依檢查結果分別導向主作業畫面與錯誤警告畫面
if ( $nT >1) {
list($id) = mysql_fetch_row($result);
// 設定 session 變數之初值
session_register("ssnid");
session_register("ssnname");
$_SESSION['ssnid'] = $id;
$_SESSION['ssnname'] = $name;
Header("location:book.php");
exit;
}
else {
Header("location:error.php");
exit;
}
?>
---------------------
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.245.106
→
08/28 01:11, , 1F
08/28 01:11, 1F
→
08/28 01:14, , 2F
08/28 01:14, 2F
→
08/28 01:15, , 3F
08/28 01:15, 3F
※ 編輯: taipingeric 來自: 140.112.245.106 (08/28 01:15)
推
08/28 01:16, , 4F
08/28 01:16, 4F
→
08/28 01:19, , 5F
08/28 01:19, 5F
推
08/28 01:58, , 6F
08/28 01:58, 6F
→
08/28 01:59, , 7F
08/28 01:59, 7F
→
08/28 02:08, , 8F
08/28 02:08, 8F
推
08/28 02:57, , 9F
08/28 02:57, 9F
→
08/28 03:06, , 10F
08/28 03:06, 10F
※ 編輯: taipingeric 來自: 140.112.245.106 (08/28 03:07)
※ 編輯: taipingeric 來自: 140.112.245.106 (08/28 03:14)
→
08/28 03:17, , 11F
08/28 03:17, 11F
→
08/28 03:17, , 12F
08/28 03:17, 12F
※ 編輯: taipingeric 來自: 140.112.245.106 (08/28 03:23)
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):
3
12
PHP 近期熱門文章
PTT數位生活區 即時熱門文章