Oddness with Login Script
Posted: Fri Jan 07, 2005 7:58 am
Hi guys! I'm working on a login script where only me and another administrator can login. (As in it's not a login/register script.) It was all going wonderfully until I went to run it. If you put in the right password, you get to a page that says "Names names names!". If you put in the wrong password, you get something like "Wrong username/password". Or at least your supposed to. As of right now, you get the same page for right or wrong. I got the script when I was browsing through oooold topics, it's off something like page 714. Here's my code:
login.php
Thanks in advance guys!
login.php
Code: Select all
<?php
function index()
{
echo "Login<br>
";
echo "<form action='?mode=login' method='post'>
Username: <input type='text' name='username' size='20'><br>
Password: <input type='password' name='password' size='20'><br>
<input type='submit' value='Log In'>
</form>
";
echo "";
}
$choice=$_GET['mode'];
switch($choice)
{
case "login":
$name = "Kate";
$name2 = "Abby";
$pass = "misty";
$pass2 = "tipsy";
if ( ($name != $name2) || ($pass != $pass2) ) { print "Names names names!\n";}
else { print "Wrong username/password!!\n"; }
break;
default:
index();
}
?>