when i go to login i can type in anything and it will send me to the members area. even if the user name or password doesnt exist... I have it done on 2 pages because i have a quick login on the index.php then the processor in login.php... below are the codes from both pages...
Here is whats on my index for quick login
<?PHP
if (count ($errors) > 0)
{
$n = count ($errors);
for ($i = 0; $i < $n; $i++)
print $errors[$i];
}
?>
<form action="login.php" method="POST">
<p><font size="2">Enter Username</font><br>
<input type="text" size="15"
name="username" value="<?PHP if (isset ($p
['username'])) print $p['username']; ?>"
style="background-color: #DFDFDF"
style="border: thin solid #CDCDCD"
style="color: #626262"
style="letter-spacing: -1px"><br>
<font size="2">Enter Password</font><br>
<input type="password" size="15"
name="password" value="<?PHP if (isset ($p
['password'])) print $p['password']; ?>"
style="background-color: #DFDFDF"
style="border: thin solid #CDCDCD"
style="color: #626262"
style="letter-spacing: -1px"><br>
<input type="submit" name="B1"
value="Login Now"
style="background-color: #DFDFDF"
style="border: thin solid #CDCDCD"><p>
</form>
Here is whats on my login.php (the login processor)
<?PHP
$_GET['$username'];
$_GET['$password'];
?>
<?PHP
function validate_user ($username, $password)
{
return true;
}
$errors = array();
$p =& $_POST;
if (count ($errors) == 0)
{
if (!isset ($p['username']) || (trim ($p['username']) == ''))
$errors[] = 'You must enter a username!';
elseif ((strlen ($p['username']) < 5) ||
(ereg ('[^a-zA-Z0-9]', $p['username'])))
$erros[] = 'You did not enter a valid username. Usernames must
be atleast 5 charactars long and contain only letters and
numbers';
if (!isset ($p['password']) || (trim ($p['password']) == ''))
$errors[] = 'You must enter a password!';
elseif ((strlen ($p['password']) < 5) ||
(ereg ('[^[:alnum:][:punct:][:space:]]', $p['password'])))
$erros[] = 'You did not enter a valid password. Passwords must
be atleast 5 charactars long and contain only letters, numbers,
punctuation, spaces';
if (count ($errors) == 0)
{
$user = "buddysal_admin";
$pass = "3585835";
$db = "buddysal_MEMBERS";
$link = mysql_connect( "localhost", $user, $pass );
mysql_select_db( $db, $link );
$query = mysql_query("SELECT * FROM MEMBERS WHERE
username=['$username'] AND password=['$password']");
if (! $query ) {
print "<font size=2>Login was a success!</font>";
}
else
{
print "<font size=2>Login Failed. Try again.</font>";
}
}
}
?>
I have no idea where im messing up, any help will be appriciated oh and how do u do a redirect? like if (! $login ) { print bleh bleh redirect=members.php; }
thank you