Ok, i have a similar problem with cookies, i.e they are not being set when i put the site live. I also have sotware that 'pretends' to be an apache server.
Ok, i am using a cookie, again to log in. The authentication page is working and redirecting. but the logged in page when checking for the cookie cannot find it.
Im a begginer at php so am not very familiar with all the avalible functions.
Ok, here are the scripts:
(auth.php) > > > >
<?php
if ($WhoAreYou == "pablo" && $password == "pablo") {
if ($RememberMe == "true") {
setcookie("WhoAreYou", "pablo", mktime (0, 0, 1, 1, 1, 2100));
setcookie("permissions", "mod", mktime (0, 0, 1, 1, 1, 2100));
setcookie("permissionsbraemar", "true", mktime (0, 0, 1, 1, 1, 2100));
header("location: loggedin.php");
} else {
setcookie("WhoAreYou", "pablo", time ()+3600);
setcookie("permissions", "mod", time ()+3600);
setcookie("permissionsbraemar", "true", time ()+3600);
header("location: loggedin.php");
}
} elseif ($WhoAreYou == "graeme_88" && $password == "livelife") {
if ($RememberMe == "true") {
setcookie("WhoAreYou", "graeme_88", mktime (0, 0, 1, 1, 1, 2100));
setcookie("permissions", "mod", mktime (0, 0, 1, 1, 1, 2100));
setcookie("permissionsbraemar", "true", mktime (0, 0, 1, 1, 1, 2100));
header("location: loggedin.php");
} else {
setcookie("WhoAreYou", "graeme_88", time ()+3600);
setcookie("permissions", "mod", time ()+3600);
setcookie("permissionsbraemar", "true", time ()+3600);
header("location: loggedin.php");
}
}
?>
this sets the cookies which allow the pages to recognise the users various details, i.e their username, their permissions, and various other folder permissions.
This all works fine and well, but when the next page (loggedin.php) looks for the cookie, ITS NOT THERE!!!🙁
Im using this syntax to check of the cookie:
<?php
// This just checks to make sure that there is a WhoAreYou value. If not it redirects the user to default.php to login.
if (!isset($WhoAreYou)) {
header ("location: default.php?redirect=true");
} ?>
this is the very first thing in all of my pages. Also all the pages are in the same folder so there shouldnt be a problem with the root thing???
I'm lost. php.net hasnt provided any useful answers either! ANY help at all would really be appreciated.
🙂 Pablo de la Pena
for those of you who are interested (or if it helps decypher my question) the page im relating to is this:
http://www.mountaincanon.com/photos/php/default.php
this is basically just a normal HTML form.