Hi all, I was wondering if you could take a quick look at this code and tell me what is wrong with it.
As you can guess i'm trying to save some sessions data, but as soon as I reload the page all the information is lost, and i'm presented with the login page againPHP Code:<?
require("config.php"); // contains functions
session_start();
dbconnect(); // connects to mysql
if (!isset($username)) {
// login screen
?>
<form method=get action=users.php>
Username <input type=text name=username size=30 maxlength=50><br>
Password <input type=password name=password size=30 maxlength=50><br>
<input type=submit value=Submit>
</form>
<?
} else {
// sets username and password into sessions
session_register("$username");
session_register("$password");
// mysql query to pull info from database
$auth = mysql_query("SELECT * FROM users WHERE username = '$username' AND password = '$password'");
$yesorno = mysql_num_rows ($auth);
if (!$yesorno) {
// Incorrect username or password
session_unregister("$username");
session_unregister("$password");
echo "Error, wrong login details";
} else {
// logged in
echo "logged in";
}
}
?>
HELP!!!!!!!!!
(BTW, i'm not 100% sure with this sessions stuff, but i'm sure that it should be saving some cookies to my machine, i've got my browser set to promt on cokies and nothing is happening)
Cheers people.





Bookmarks