新手求教!!!急!
if($password == $row["password"])
{
$_SESSION["admin"]=1;
$_SESSION["username"]=$username;
header("Location:index.php");
exit;
}
执行这段代码后页面转为空页面,但重新从链接访问这个页面是它又是已经登录的界面(也就是它已经转到index.php了),这是为毛啊???
if($password == $row["password"])
{
$_SESSION["admin"]=1;
$_SESSION["username"]=$username;
header("Location:index.php");
exit;
}
执行这段代码后页面转为空页面,但重新从链接访问这个页面是它又是已经登录的界面(也就是它已经转到index.php了),这是为毛啊???
session_start();
session_destroy();
header("Location:index.php");
这是跳转问题,还是登陆界面的问题啊?
echo "<script>alert('非法登录');</script>";
}重新访问时,试试有没有提示?
你检查检查代码逻辑,看看是不是哪里exit了。
if(!isset($_SESSION['admin'])){
echo "<script>alert('非法登录');</script>";
}
if($password == $row["password"])
{
$_SESSION["admin"]=1;
$_SESSION["username"]=$username;
header("Location:index.php");
exit;
}
如果你的页面允许直接进入
if($password == $row["password"])
里面,那么就一直会执行:
header("Location:index.php");
我是新手,跟着书上其他的例子做的,也说不清什么情况。
这是dreamweaver软件,会不会是界面设计问题啊:
<table width="778" border="0" cellpadding="0" cellspacing="6" class="border">
<tr>
<td valign="top" width="100%" class="listcontent" align="center">
<b><?Php echo $message; ?></b>
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
<td class="listTitle">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><strong>管理员登陆</strong></td><td align=right> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" class="list">
<form action="login.php?do=1" method="post">
用户名:<input type="text" name="username" size="25" /><br />
密 码:<input type="password" name="password" size="25" /><br />
<input type="submit" value="登 陆" />
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>