I have some authentication set up, calling a username/password from a database. However, nothing happens - I just get the login page returned to me. Can anyone browse this and see where I maybe making a mistake, please?
Thanks,
Eve
function mainBody() {
echo "<p>HR ADMIN PAGE<p><a href=\"index.php?goto=jobslisting\">Jobs</a>";
}
$auth = false; // Assume user is not authenticated
if ( ! $auth ) {
//echo '<table valign="top"><tr><td width="250" valign="top"><BR><BR>';
echo '<form name="login" method="post" action="index.php">
<table width="250" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Username: </td>
<td>
<input type="text" name="username">
</td>
</tr>
<tr>
<td>Password: </td>
<td>
<input type="password" name="password">
</td>
</tr>
<tr>
<td> </td>
<td>
<div align="right"><BR>
<input type="submit" name="submit" value="Submit">
</div>
</td>
</tr>
</table></form>
';
exit;
}
if ($Login) {
$sql = "SELECT username, password FROM users WHERE username=" . $_POST['username'] . " AND password=" . $_POST['password'] . "";
while ($row = mysql_fetch_array($sql, MYSQL_ASSOC))
{
mainBody();
}
} else {
// echo '<table valign="top"><tr><td width="250" valign="top"><BR><BR>';
echo '<form name="login" method="post" action="index.php">
<table width="250" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><font color="red">Try again. </font></td>
</tr>
<tr>
<td>Username: </td>
<td>
<input type="text" name="username">
</td>
</tr>
<tr>
<td>Password: </td>
<td>
<input type="password" name="password">
</td>
</tr>
<tr>
<td> </td>
<td>
<div align="right"><BR>
<input type="submit" name="submit" value="Submit">
</div>
</td>
</tr>
</table>
</form>';
exit;
}
?>