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!

Recommended Answers

All 3 Replies

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>";
}
?>

@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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.