the login was working perfectly all right when it was in my com, but when i transferred it to another com, there were errors:
Notice: Undefined index: UserID in c:\inetpub\wwwroot\Merge\login_process.php on line 10
Notice: Undefined index: Password in c:\inetpub\wwwroot\Merge\login_process.php on line 11
Warning: Cannot modify header information - headers already sent by (output started at c:\inetpub\wwwroot\Merge\login_process.php:10) in c:\inetpub\wwwroot\Merge\login_process.php on line 37
my codes for displaying:
Code:
<form name="login" method="post" action="login_process.php">
<table width="39%" border="0" align="center" bordercolor="#FFFFFF">
<tr>
<td>UserID</td>
<td><input name="UserID" type="text" id="UserID5"></td>
</tr>
<tr>
<td>Password</td>
<td><input name="Password" type="password" id="Password4"></td>
</tr>
<tr>
<td> </td>
<td><div align="right">
<input name="Login" type="submit" id="Login4" value="Login">
</div></td>
</tr>
</table>
</form>
and the codes that does the processing:
Code:
session_start();
include("database.php");
$sql = "SELECT * from User
WHERE UserID='$_POST[UserID]'
AND Password='$_POST[Password]'";
$result = mysql_query($sql)
or die ("couldnt execute query.");
$num = mysql_num_rows($result);
if ($num == 1) //login name and password match
{
$sql = "SELECT AccessLevel from User
WHERE UserID='$_POST[UserID]'";
$result2 = mysql_query($sql)
or die ("couldnt execute query 2.");
$value = mysql_result($result2,0);
if ($value == 1) //AccessLevel is 1
{
$logname=$_POST['UserID'];
$_SESSION['logname'] = $logname;
header("Location: report_form_admin.php");
}
else //AccessLevel is 3
{
$logname=$_POST['UserID'];
$_SESSION['logname'] = $logname;
header("Location: report_form.php");
}
}
elseif ($num == 0) //login name and password do not match
{
header("Location: login_form_error.php");
}