Jump to content

intermitent SESSIONS issue


freelance84

Recommended Posts

Has anybody ever heard of this?

 

I came to my computer one morning having not changed a thing all night.

I try to log in with the correct login details, but it appears not to login correctly.

    NB, the home page it should be loading has some checks which look like the following:

<?php
session_start();
if (isset($_SESSION['username']))
{
$u_ID = $_SESSION['ID'];
$u_name = $_SESSION['username'];
$u_type = $_SESSION['type'];
$u_email = $_SESSION['email'];
$u_forename = $_SESSION['forename'];
$u_surname = $_SESSION['surname'];
if($u_type == 5)
{
                  content of the php page
}
else echo "Sorry something has gone wrong with your user type.  Please <a href=index.php>click here</a> to log in again.";
}
else {header("location:index.php");};

 

After some tests I found that what was happening was a problem in line three: the "isset($_SESSION['username']". I know that the $_SESSION['username'] was there as the authenticate page sets it, and if it doesn't it throws an error message back to the index.php. But for some reason it kept seeing the session username as not being there and going to the last line which went back to the index.php.

 

However, the index.php also checks the SESSION variables and then goes to the appropriate page. However it was loading.

 

What's weirder is that when I pressed back in the browser (FF) after the attempt to sign in, it loaded OK and I could continue browsing through the rest of my site with no probs.

 

When I clear the FF History (everything), I can then sign in with no problems too. But then the problem isn't as strict as that, it is very intermittent. EG, I have cleared the browser about 15mins ago and logged in and out several times with no problems. I have even restarted FF a few times.

 

When this problem went away at lunch time i choose to ignore it, but now, 2hrs later it happened again.

 

 

Does anyone have any ideas? Could it be a server thing? Or a virus or something?

 

(I do have ie6, ff 3.6.6, chrome and opera10.60 loaded onto my computer to check my site as I am building it. Could this be causing the issue?)

 

 

PS,

 

The site does not use and cookies except the SESSIONS. It also does not use and Javascript.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.