有一个SESSON问题.为什么验证不了,菜鸟问题
<?php
session_start();
if (isset($_POST['user_name']) && isset($_POST['user_passwd']))
{
$name=$_POST['user_name'];
$pass=$_POST['user_passwd'];
}
$result=mysql_query("select * from ab_user where user_name='$name' and user_passwd='$pass'");
$rows=mysql_num_rows($result);
if($rows > 0){
$_SESSION['username']=$name;
if (isset($_SESSION['username']))
{
echo '用户密码正确!成功进入... <br />';
echo "<meta http-equiv=\"refresh\" content=\"5;URL=u_expense.php\">";
}else{
echo '用户密码资料不正确,请再试一次... <br />';
echo "<meta http-equiv=\"refresh\" content=\"5;URL=login.php\">";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="css/vpm_printout.css" rel="stylesheet" type="text/css">
<title>无标题文档</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data">
<table width="298" border="0" align="center" class="text6_bold">
<tr>
<th colspan="2" scope="col">登陆验证</th>
</tr>
<tr>
<td width="117">用户名</td>
<td width="312"><input name="user_name" type="text" class="text6" id="user_name" /></td>
</tr>
<tr>
<td>密码</td>
<td><input name="user_passwd" type="password" class="text6" id="user_passwd" /></td>
</tr>
</table>
<p align="center">
<input name="Submit" type="submit" class="text6" value="登陆" />
</p>
</form>
</body>
</html>