这是我的表单页面。按下登录时,它被重定向到 checkLogin 页面,但它是空的。没有回声工作。
<html>
<title>User Login Form</title>
<head></head>
<body>
<form name="form1" method="post" action="checkLogin.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1"
bgcolor="#FFFFFF">
<tr>
<td width="80">Username</td>
<td width="6">:</td>
<td width="300"><input name="myusername" type="text" id="myusername"></td>
</tr>
<tr>
<td>Password</td>
<td width="6">:</td>
<td><input name="mypassword" type="text" id="mypassword"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</td>
</form>
</td>
</tr>
</body>
</html>
这是 checkLogin 页面 这没有显示任何内容。我尝试了 mysql_error 但仍然没有显示。请帮忙
<?php
include("config.php");
echo "Check Login";
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$myusername=stripslashes($myusername);
$mypassword=stripslashes($mypassword);
$myusername=mysql_real_escape_string($myusername);
$mypassword=mysql_real_escape_string($mypassword);
$sql="select j.jobid from jobs j,rcuser r where r.userName='$myusername'and r.password='$mypassword'";
echo "Hey".$myusername." ";
$result=mysql_query($sql);
while($col=mysql_fetch_array($result)){
echo "<tr><th>Job Id</th>"</tr>;
echo "<tr><td>" . $col['jobid'] . "</td><tr>";
}
$count=mysql_num_rows($result);
echo $count;
if($count==1){
session_register("myusername");
session_register("mypassword");
session_start();
if(!session_is_registered($myusername){
echo "Session expired";
}
echo "is it???";
}
else{
echo "Invalid Username or Password";
}
?>