PDA

View Full Version : login problems


huwey
02-20-2003, 06:03 PM
hiya all i'm having a small problem with logging in to go to a page of mine...the code for the login is this


<?
if (!$_COOKIE['username']){
header ("location: results.php");
}

// username is the name of the form input tag
// same as the password name of the input form
if(($_POST['username'] == "") OR ($_POST['password']== "")){
// if empty then we take them to the login page
header ("location: index.php");
} elseif (($_POST['username'] == "hosts") AND ($_POST['password'] == "hosts") OR ($_COOKIE['username'])){
setcookie("username", $_POST['username'], time() + 7200);
?>


and when i go to log in all it does is just refresh the login page it wont follow thru to the next page...it was having me login twice then go to the page...but now it wont even do that i have tried to login about 10 times and nothing.

any help on this would be much apprectiated

also if there is a better way of doing this for just 1 user/pass combo please let me know...i can't use the htaccess and htpasswd files for some reason i can't upload them to the server reason i'm asking about this is cause there is someone that would be using the form that this goes to probably more than anyone...and they are not able to get in for some odd reason while everyone else could (when it was working that is)

jollyfactory
02-20-2003, 10:49 PM
I think it may be because session_start(); must come as the first line i.e.

<?
session_start();

huwey
02-20-2003, 11:13 PM
not sure it worked before...but now it's not working at all :(