作者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