I have this login form, but I am not finding the error in it, help please, sometimes I am really stupid at finidng errors...
It is not validating the username and password for some reason...PHP Code:<?php
include('../includes/config.php');
session_start();
if (isset($_POST['username']) && isset($_POST['password'])) {
$username = $_POST['username'] ;
$password = $_POST['password'];
}
if ($_GET['do'] == logout) {
session_destroy();
$warn = "you have been logged out";
}
else {
if($username = 'admin' && $password = 'password') {
header('location: main.php');
$username = $_SESSION['username'];
$_SESSION['level'] = 1;
}
else {
$warn = "Invalid Username And/Or Password";
}
}
?>
<html>
<head>
<title><?php echo $sitetitle; ?></title>
<meta name = "robots" content = "noindex, nofollow">
<link rel="stylesheet" href="../css/def.css">
</head>
<body>
<table width = "100%" align="center" valign="top" cellpadding="5" cellspacing="5">
<tr>
<td align="right" valgin="top">
<img src="../images/logintop.gif" alt="Core Content Management System" border="0"><br />
<br />
</td>
</tr>
<tr>
<td class="login" valign="top">
<div class="header" align="center"><?php echo $sitetitle; ?></div>
<form action="login.php" method="post">
<input type="hidden" name="formname" value="login">
<table align="center">
<tr>
<td algin="center" class="loginform">
<br>
<?php echo $warn; ?><br />
<br />
</td>
</tr>
<tr>
<td align="center">
<table>
<tr>
<td align="right">
Username:
</td>
<td>
<input style = "margin-left: 4px" type="text" name="username" size="30" maxlength="30"><br>
</td>
</tr>
<tr>
<td align="right">
Password:
</td>
<td>
<input style = "margin-left: 4px" type="password" name="password" size="30" maxlength="30"><br>
</td>
</tr>
<tr>
<td algin="right">
<input type="submit" value="Submit">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>





Bookmarks