Sessions + Login, need some help with my If's
Posted: Fri Jun 21, 2002 11:52 am
Hey, i have 2 scripts using sessions for login. The first is login.php, and it contains the form, its code is:
and login2.php, which checks it, adn tis code is:
now if i login with no password, it still shows "Login Successful!", when it shouldnt. You can even try the script here. Username is limb and Password is test. Try loging in with no pass it will show Login Successful. How do i change this so it wotn show success if no pass or login was entered?
Thanks,
Limb
Code: Select all
<?
session_start();
session_register("username","password");
?>
<?
$session = session_id();
?>
<form action="login2.php?<? echo $session ?>" method="post">
<p>User: <input type="text" name="username"><br>
Pass: <input type="text" name="password"><br>
<input type="Submit" value="Login">
</p>
</form>Code: Select all
<?
session_start();
session_register("username","password");
?>
<?
if ($username == "limb") {
if ($password == "test") {
echo "Login Successful!";
}
if ($password == " ") {
echo "No password!";
}
}
else {
echo "Somethings missing!";
}
?>Thanks,
Limb