Hi all,
I have been workin on a login script for my website for a while and ive almost finished. The problem is that when i try to login, even though i fill the boxes up with text it still says:
Please enter ALL of the information!
The following is the checkuser.php file and below that is the login.html file
<?
/* Check User Script */
session_start(); // Start Session
include 'db.php';
// Conver to simple variables
$username = $_POST['username'];
$password = $_POST['password'];
if ((!$username) || (!$password)) {
echo "Please enter ALL of the information! <br />";
include 'login.html';
exit();
}
// check if the user info validates the db
$sql = mysql_query("SELECT * FROM tbl_member WHERE username='$username' AND password='$password' AND activated='1'");
$login_check = mysql_num_rows($sql);
if ($login_check > 0){
while($row = mysql_fetch_array($sql)) {
foreach( $row AS $key => $val ) {
$$key = stripslashes( $val );
}
// Register some session variables!
$_SESSION['username'] = $username;
$_SESSION['user_level'] = $user_level;
mysql_query("UPDATE tbl_members SET last_login=now() WHERE userid='$userid'");
$_SESSION['loged'] = "yes";
header("Location: main.php");
}
}
else {
echo "You could not be logged in! Either the username and password do not match or you have not validated your membership!<br />
Please try again!<br />";
include 'login.html';
}
?>
<body onload="parent.topFrame.location.href=('top.php')" bgcolor="#000000" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
<form action="checkuser.php" method="post" name="" id="">
<table width="40%" border="0" align="center" cellpadding="4" cellspacing="0" bgcolor="#333333">
<tr bgcolor="#000000">
<td width="50%"><div align="center"><font size="2">Username:</font></div></td>
<td width="50%"><div align="center">
<input name="username" type="text" id="username" size="12">
</div></td>
</tr>
<tr bgcolor="#000000">
<td><div align="center"><font size="2">Password:</font></div></td>
<td><div align="center">
<input name="password" type="password" id="password" size="12">
</div></td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
<td align="right" bgcolor="#000000"><div align="center">
<input type="submit" name="Submit" value="Login">
</div></td>
</tr>
</table>
</form>
Can anyone see what the problem is, because i cant find what the problem is.
Cheers