function isLogin(){
global $conn;
if(isset($_COOKIE["username"]) and isset($_COOKIE["password"])){
$rs = $conn->Execute("select id from members where username = '".$_COOKIE["username"]."' and password = '".$_COOKIE["password"]."'");
if($rs->RecordCount()<=0){
echo "<script>
alert('请登录.');
window.location.href='16_4.php';
</script>";
}
}
}
这是我网页的公共php文件中的定义的一个判定登录的函数。用户访问我的网站时,由于新学php web开发,我自己认为这个函数应该是在服务器上运行的。但是isset()函数中的$_cookie[" "]函数是对浏览器中的cookie的操作,难道这个函数是在服务器(我的电脑)上运行,但是调用的却是浏览器(用户电脑上)中的cookie执行的? 求大虾指导下谢谢!还有就是这个if(isset($_COOKIE["username"]) and isset($_COOKIE["password"])){
$rs = $conn->Execute("select id from members where username = '".$_COOKIE["username"]."' and password = '".$_COOKIE["password"]."'");
if($rs->RecordCount()<=0){
echo "<script>
alert('请登录.');
window.location.href='16_4.php';
</script>";
}
}
语句如果判定条件为假,那么它就什么都不做...这好像就没有达到判定登录的意义...不知道怎么才能做出一个比较友好的操作。也请大虾们帮帮给出点意见!....小弟我再次感谢!
global $conn;
if(isset($_COOKIE["username"]) and isset($_COOKIE["password"])){
$rs = $conn->Execute("select id from members where username = '".$_COOKIE["username"]."' and password = '".$_COOKIE["password"]."'");
if($rs->RecordCount()<=0){
echo "<script>
alert('请登录.');
window.location.href='16_4.php';
</script>";
}
}
}
这是我网页的公共php文件中的定义的一个判定登录的函数。用户访问我的网站时,由于新学php web开发,我自己认为这个函数应该是在服务器上运行的。但是isset()函数中的$_cookie[" "]函数是对浏览器中的cookie的操作,难道这个函数是在服务器(我的电脑)上运行,但是调用的却是浏览器(用户电脑上)中的cookie执行的? 求大虾指导下谢谢!还有就是这个if(isset($_COOKIE["username"]) and isset($_COOKIE["password"])){
$rs = $conn->Execute("select id from members where username = '".$_COOKIE["username"]."' and password = '".$_COOKIE["password"]."'");
if($rs->RecordCount()<=0){
echo "<script>
alert('请登录.');
window.location.href='16_4.php';
</script>";
}
}
语句如果判定条件为假,那么它就什么都不做...这好像就没有达到判定登录的意义...不知道怎么才能做出一个比较友好的操作。也请大虾们帮帮给出点意见!....小弟我再次感谢!
解决方案 »
- 发一个人站,php+mysql+smarty+pear+url_rewrite,大家学习交流
- 求一html标签闭合且内嵌的正则~~~~~~~~~~~ 读我啦 有难度~~~~~~~~~~~~~
- 我想问下关于PHP的模板引擎问题!!!!
- session_id()是通过哪些因素计算session id的?
- mysql模糊查询问题
- 时间比较问题
- 提取数据库的内容,一行放两条纪录,一页放十行
- 和喜欢做主页和PHP的朋友一起玩!本人可提供一些帮助。mysql + php
- 求助!win2k下apache与php4????
- 这是什么原因?
- 新手问:如何将数据取出的日期格式化?
- checkbox按纽控制的问题,
$_COOKIE 只是客户端 cookie 的一个副本