Not logged in. · Lost password · Register
Forum: Support Bug reports and troubleshooting RSS
Return to forum while still logged in, session ID in links, time displays server not local timezone
20070225-dev
Avatar
Keith #1
User title: 漢字おたく
Member since Feb 2007 · 60 posts · Location: Japan
Group memberships: Members
Show profile · Link to this post
Subject: Return to forum while still logged in, session ID in links, time displays server not local timezone
I've noticed that when I return to my forum via my bookmark after having been away a number of hours or a whole day, even though I am still logged in, the displayed time of posts and current time at the bottom of the page are in the server's timezone instead of my timezone. Also I notice when I hover over a link, that the links have session IDs in them, although I am still logged in and I do, of course, accept cookies for my website.

When I follow a link, everything is back to normal.

Has anyone else noticed this? I guess I can notice this easily because my local timezone and the webhost server's timezone are 14 hours apart.
Avatar
Yves (Administrator) #2
User title: UNB developer & webmaster
Member since Jan 2004 · 3855 posts · Location: Erlangen, Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Timezone:
Did you set your timezone in your board profile? If not, I can imagine that it is auto-detected every time through JavaScript every time you start a new session (see next point). This can only be done when the page output meets the browser, at which point it is already compiled and certain contents like times cannot be changed anymore. When you register to the board, this auto-detected timezone should be set for your profile automatically. This will not be the case for the pre-setup account #1 (Admin) or if you registered to the board more than a couple of years ago.

Session ID:
Being logged in and a session's lifetime are two different things. You start a new session every time your browser doesn't hold the previous session's ID cookie anymore. Then, the default way of PHP is to start a new session. Since the auto-login cookie, controlled by UNB, is more longliving, it will still be present to the browser and already be sent to the server with the first request. With this login cookie, you are logged in immediately, you won't see anything of that. But since PHP doesn't know if your browser accepts cookies*, if must assume that it doesn't and include a session ID URL parameter with every link on that page to not lose the ID of the new session. Only at the second request, PHP can see if your browser came back with the session cookie and can drop that additional parameter for subsequent requests. This is why you see the session ID in links only of the first requested page in a while.

*) Now as I'm explaining this, I see that there is a way to detect if the browser supports cookies: the auto-login cookie. Since I copied that PHP mechanism into my code, I have some influence on it so I can decide whether to include that parameter or not. When a login cookie is already present, I could decide not to include the parameter. This will of course only work for registered, logged in users with the auto-login enabled.
♪ ...nanananah, all in all we’re just brilliant thieves, nanananah... ♪♬
Avatar
Keith #3
User title: 漢字おたく
Member since Feb 2007 · 60 posts · Location: Japan
Group memberships: Members
Show profile · Link to this post
I had not specified the timezone for account #1.
I thought it must have been set since it was auto-detected.

Thanks.
謝謝你
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
This board is powered by the Unclassified NewsBoard software, 20120620-dev, © 2003-2011 by Yves Goergen
Page created in 159 ms (107.1 ms) · 56 database queries in 111.8 ms
Current time: 2013-05-25, 07:16:56 (UTC +02:00)