MuerteTG
June 30th, 2001, 12:08 PM
I need help, I finally got my sessions working but now, if you accidently type something wrong in the login, you have to close the browser before you can login again. I can't find anywhere to put the "unset($username)
unset($password)"
commands. Everywhere I put them it gives me a parse error where there is none or it just screws up the whole script. To get a good idea of what I am trying to do, I have the loginthing check the MySQL database for the username and password and I am trying to get it to when they successfully login, if they go back to the login page it will redirect them the their starting page where it says"Welcome $username" and gives info. But so far I have been unnsucessful and I tried to put in the
session_start()
session_register(username)
session register(password)
lines, and now I get the problem I mentioned above where I can't find how to put the unset username and unset password lines... here's the code:
<?
session_start();
session_register("username");
session_register("password");
mysql_connect("localhost","root")
or die ("Unable to connect to server.");
mysql_select_db("agents")
or die ("Unable to select database.");
$sql = "SELECT username
FROM users
WHERE username='$username' and password='$password'";
$result = mysql_query($sql)
or die ("Unable to get results.");
$num = mysql_numrows($result)
or die("
!------this is where it says their username or password is wrong
");
if ($num == 1) {
?>
!----THIS IS WHERE THEIR START PAGE GOES
<?
}
?>
the url for the page is
PLEASE HELP ME!!!!! null (http://www.coordinatedconcepts.com/agents/login.php)
unset($password)"
commands. Everywhere I put them it gives me a parse error where there is none or it just screws up the whole script. To get a good idea of what I am trying to do, I have the loginthing check the MySQL database for the username and password and I am trying to get it to when they successfully login, if they go back to the login page it will redirect them the their starting page where it says"Welcome $username" and gives info. But so far I have been unnsucessful and I tried to put in the
session_start()
session_register(username)
session register(password)
lines, and now I get the problem I mentioned above where I can't find how to put the unset username and unset password lines... here's the code:
<?
session_start();
session_register("username");
session_register("password");
mysql_connect("localhost","root")
or die ("Unable to connect to server.");
mysql_select_db("agents")
or die ("Unable to select database.");
$sql = "SELECT username
FROM users
WHERE username='$username' and password='$password'";
$result = mysql_query($sql)
or die ("Unable to get results.");
$num = mysql_numrows($result)
or die("
!------this is where it says their username or password is wrong
");
if ($num == 1) {
?>
!----THIS IS WHERE THEIR START PAGE GOES
<?
}
?>
the url for the page is
PLEASE HELP ME!!!!! null (http://www.coordinatedconcepts.com/agents/login.php)