<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<? session_start();?>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>zhufeng</title>
</head><body>
<? //echo "hello world";?>
</body>
</html>
<html>
<head>
<? session_start();?>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>zhufeng</title>
</head><body>
<? //echo "hello world";?>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<?
require("inc/db_connect.inc");
$sql="select name passwd from user_login where name='$name' and passwd='$passwd'";
$result=mysql_query($sql,$server_link);
if(mysql_num_rows($result)==0)
{ $logon_flag=0; }
else
{ $logon_flag=1;
mysql_free_result($result);
echo "验证成功";
//断开数据库连接
echo "<script language='javascript'>";
echo "window.location='admin_list.php';";
echo "</script>";
require("inc/db_close.inc");
}
?>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>login</title>
</head><body>
<form name="form1" method="post" action="<? $PHP_SELF?>">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">xingming</td>
<td align="center"><input name="name" type="text" id="name"></td>
</tr>
<tr>
<td align="center">passwd</td>
<td align="center"><input name="passwd" type="password" id="passwd"></td>
</tr>
<tr>
<td align="center"><input type="submit" name="Submit" value="提交"></td>
<td align="center"><input type="reset" name="Submit2" value="重置"></td>
</tr>
</table>
</form>
</body>
</html>
把<? session_start();?>放到文件开始处