include("functions.php");
if(!check_user($reg_nicker,$reg_password))
在以上两行之间加上一行编程
include("functions.php");
global $reg_nicker;
global $reg_password;
if(!check_user($reg_nicker,$reg_password))
试一下
if(!check_user($reg_nicker,$reg_password))
在以上两行之间加上一行编程
include("functions.php");
global $reg_nicker;
global $reg_password;
if(!check_user($reg_nicker,$reg_password))
试一下
add the following
global $reg_nicker;
global $reg_password;
function check_user($nicker,$password)
{
if($nicker=="")
{
return 0;
}
connect_db('localhost','root','','borrow');
$sql = "select password from user_info where nicker='$nicker'";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
if($password == $row['password'])
return 1;
else
return 0;
}
说一下原因:
1.我想你的注销操作应该是这样的吧:
setcookie("reg_nicker","");
setcookie("reg_password","");
2.你注销后实际上是把$reg_nicker and $reg_password赋值为空串,所以在你认证的函数中首先要判断是不是空串,然后在判断密码是否正确。
3.其实这与声明称全局变量没有关系,因为你注册的$reg_nicker 和 $reg_password 本身就是全局变量,它没在其它函数中一用,不用声明。本人卓见,仅供参考!