主题:求助 登陆之后出现空白页面 怎么的?
我做了一个简单的PHP+MYSQL的留言程序
留言管理的时候,用户名密码正确,但进到管理页面却是空白的?请教高手帮忙看看
页面登陆代码:
<html>
<head>
<title>管理员登陆</title>
</head>
<body>
<form action="admin_check.php" method="post" name="form2">
用户名:<input type="text" name="admin_name">
密 码: <input type="password" name="admin_password">
<input type="submit"value="进入后台管理">
</form>
</body>
</html>
验证管理员身份代码:
<?php
session_start();
$admin_name=$_POST['admin_name'];
$admin_password=$_POST['admin_password'];
$conn=mysql_connect("localhost","root","111111");
mysql_select_db("guest_book");
$exec="select * from admin where admin_name='".$admin_name."'";
$result=mysql_query($exec);
if($rs=mysql_fetch_object($result))
{ if($rs->admin_password==$admin_password)
{ $_SESSION['admin']="OK";
header("location:admin_index.php");
}
else echo"密码不正确";
}
else echo"用户名不正确";
mysql_close();
?>
管理页面代码:
<?php
session_start();
if($_SESSION['admin']=="ok")
{
$conn=mysql_connect("localhost","root","111111");
mysql_select_db("guest_book");
$exec="select * from contents";
$result=mysql_query($exec);
while($rs=mysql_fetch_object($result))
{ echo"<table><tr><td>姓名:".$rs->name."</td></tr>";
echo"<tr><td>留言:".$rs->content."</td></tr></table><br/>" ;
echo"<a href=modify.php?id=".$rs->id.">修改</a> <a href=delete.php?id=".$rs->id.">删除</a>";
}
echo"<br><br><br><br><br><a href=index.php>回首页</a>";
}
mysql_close();
?>
留言管理的时候,用户名密码正确,但进到管理页面却是空白的?请教高手帮忙看看
页面登陆代码:
<html>
<head>
<title>管理员登陆</title>
</head>
<body>
<form action="admin_check.php" method="post" name="form2">
用户名:<input type="text" name="admin_name">
密 码: <input type="password" name="admin_password">
<input type="submit"value="进入后台管理">
</form>
</body>
</html>
验证管理员身份代码:
<?php
session_start();
$admin_name=$_POST['admin_name'];
$admin_password=$_POST['admin_password'];
$conn=mysql_connect("localhost","root","111111");
mysql_select_db("guest_book");
$exec="select * from admin where admin_name='".$admin_name."'";
$result=mysql_query($exec);
if($rs=mysql_fetch_object($result))
{ if($rs->admin_password==$admin_password)
{ $_SESSION['admin']="OK";
header("location:admin_index.php");
}
else echo"密码不正确";
}
else echo"用户名不正确";
mysql_close();
?>
管理页面代码:
<?php
session_start();
if($_SESSION['admin']=="ok")
{
$conn=mysql_connect("localhost","root","111111");
mysql_select_db("guest_book");
$exec="select * from contents";
$result=mysql_query($exec);
while($rs=mysql_fetch_object($result))
{ echo"<table><tr><td>姓名:".$rs->name."</td></tr>";
echo"<tr><td>留言:".$rs->content."</td></tr></table><br/>" ;
echo"<a href=modify.php?id=".$rs->id.">修改</a> <a href=delete.php?id=".$rs->id.">删除</a>";
}
echo"<br><br><br><br><br><a href=index.php>回首页</a>";
}
mysql_close();
?>