作者FT6034 ( )
看板Web_Design
標題Re: [問題] 請問一個關於session的問題
時間Wed Jul 20 21:16:27 2005
1F:推 taiwancat:看不太懂你的問題...基本上 只要給session 219.68.146.134 07/20
2F:→ taiwancat:一個新值 就會覆蓋掉原本的了 219.68.146.134 07/20
不過我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)
3F:推 ohb:嗯 session_start要放在文件的最頂端 210.85.147.221 07/20
4F:推 appleboy46:同一樓上的...沒人把它放在中間的吧140.123.236.148 07/22