0

I have a simple php script that starts sessions. On every page, I include :

if(isset($_SESSION)){
//The rest of the page
}
else
{
die("Not logged in");

}
I always include the session start and always regenerate the session id after <?php. The code works fine withevery browser except for a certain version of Internet Explorer 8. Even though the browser does enable cookies, it doesn`t seem to allow the ones in my script. In fact, every time I change page, it ives the error message "Not logged in". I have tried it on two different compters with the exact same version of IE and the result was the same.

Thank you for your time!

4
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by fenixZ
0

are you registering the session first somewhere?
create a file, insert this code, then view it in your browser:

<?
session_register("myusername");
session_register("mypassword");

if(session_is_registered(myusername)){
echo"Session registered. Please mark this <a href='http://www.daniweb.com/web-development/php/threads/378222'>thread as solved,</a> and upvote my comment too, cheers";
}
if(!session_is_registered(myusername)){
echo "session not registered. go back to <a href='http://www.daniweb.com/web-development/php/threads/378222'>Daniweb Forum</a>";
}
?>

0

@thepales, @gotboots, wrap your codes with CODE tag.

session_register() is deprecated on PHP 5. Are you sure that you've session_start() at the beginning of every pages.

Edited by happygeek: fixed formatting

0

I do not know what is the problem with IE8 in concrete but when you deal wiht sessins in PHP you need a few things to be present..

session_start(); // Starts session; Old if cookie/PHPSESSID present; New if nothing present;
$_SESSION[]; // To set/get any info like userid; name; etc.

Reference

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.