$_SESSIONS Not Working

Status
Not open for further replies.

mirrgx10

New Member
Messages
12
Reaction score
0
Points
1
Hi all,
I have found that I cannot store values in my $_SESSION variable.
After checking my site, I noticed that the PHPSESSID value keeps refreshing.
For example, my PHPSESSID value could start at f3e5d9f7580415f6f33e8168baebacd8, then, when I reload the page, it changes to 51650bc39fa118082101a7ec56303ecd.
I am wondering if this is a server issue, as my code was working just fine a couple months ago. I have noticed this issue on two accounts, both of which are on server xo3.
Has anyone else noticed this?
Is there an easy way to fix this?
Thank you very much! I am hoping to get x10premium hosting soon!
Thanks again,
Josiah
 

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
Hi Josiah,

I've just run a test script on your server, xo3, using purely session_start() and session_id(), and it appears to be working fine. Please could you provide me with the PHP code that is doing this? :)

Thank you,
 

mirrgx10

New Member
Messages
12
Reaction score
0
Points
1
So here is most of the code that deals with the sessions:
PHP:
/*---included on every page---*/
ini_set('session.cookie_domain', '.mirrg.x10.mx' );
session_start();

require_once("classes/account.class.php");

$a=new account;

if(isset($_COOKIE['UID']) && !$a->loggedIn){
    $UID=$_COOKIE['UID'];
    $a->setSession($UID);
    $a->setCookie($UID);
}

/*---logout.php (only called when logging out)---*/
$a->clearSession();
$a->clearCookie();

/*---the session part of account.class.php---*/
public function setSession($UID){
        $query=$this->select("users", "WHERE `UID`='$UID'");
        while($rows = mysql_fetch_assoc($query)){
            $username = $rows['username'];
            $firstName = $rows['firstName'];
            $lastName = $rows['lastName'];
            $backupEmail = $rows['backupEmail'];

            $_SESSION['UID']=$UID;
            $_SESSION['username']=$username;
            $_SESSION['firstName']=$firstName;
            $_SESSION['lastName']=$lastName;
            $_SESSION['backupEmail']=$backupEmail;

            $this->setVaribles();
        }
    }

    public function clearSession(){
        unset($_SESSION['UID']);
        unset($_SESSION['username']);
        unset($_SESSION['firstName']);
        unset($_SESSION['lastName']);
        unset($_SESSION['backupEmail']);

        $this->setVaribles();
    }

I hope this helps! Let me know if there are any other portions of code that may be helpful.
Thank you!
Josiah
 

bdistler

Well-Known Member
Prime Account
Messages
3,534
Reaction score
196
Points
63
my free-hosting account is on server [ xo3 ]
I made three (3) PHP test scripts
the first two (2) are to test going back and forth and reloading
the third one deletes the current session - so you can start over
all three (3) have links to the other two (2)
I have no issues with var [ $_SESSION ] or [ session_id ]

see --> [ http://realhandydata.x10host.com/page1.php ]
 
Status
Not open for further replies.
Top