Re: [問題] 請問一個關於session的問題

看板Web_Design作者 ( )時間19年前 (2005/07/20 21:14), 編輯推噓2(200)
留言2則, 2人參與, 最新討論串1/1

219.68.146.134 07/20, , 1F
看不太懂你的問題...基本上 只要給session
219.68.146.134 07/20, 1F

219.68.146.134 07/20, , 2F
一個新值 就會覆蓋掉原本的了
219.68.146.134 07/20, 2F
不過我debug成功,成果如下: (只是把session_start();搬到最前面就成功了,害我還想了半天....) ================================================================== <?php session_start(); session_destroy(); $uid = $_POST['uid']; $pass = $_POST['pass']; $link = mysql_connect("localhost","root","mypassword") or die("link失敗"); $db_delected = mysql_select_db("test",$link) or die("db_select失敗"); $sql = "SELECT * FROM user WHERE uid='$uid' AND pass='$pass'"; $result = mysql_query($sql,$link) or die("result失敗"); if(!mysql_num_rows($result)==0) { session_register("uid"); session_register("pass"); $_SESSION['uid'] = $uid; $_SESSION['pass'] = $pass; echo "type a:".$_SESSION['uid']."登入成功!"; // echo "<script language='javascript'>window.location='member.php'</script>"; } else { echo "type b:帳號密碼錯誤"; } ?> ================================================================== -- ※ 編輯: FT6034 來自: 219.84.148.120 (07/20 21:25)

210.85.147.221 07/20, , 3F
嗯 session_start要放在文件的最頂端
210.85.147.221 07/20, 3F

140.123.236.148 07/22, , 4F
同一樓上的...沒人把它放在中間的吧
140.123.236.148 07/22, 4F
文章代碼(AID): #12tav7Ps (Web_Design)
文章代碼(AID): #12tav7Ps (Web_Design)