Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies


impermanent HTTP_USER_AGENT, changes on each click



10:46 am on Jan 8, 2011 (gmt 0)

5+ Year Member


I use HTTP_USER_AGENT information in session validation something like that


$agent = getenv('HTTP_USER_AGENT');

$agentnow = getenv('HTTP_USER_AGENT');

if ($_SESSION['o'] != $agentnow) {

There are no problem with it. It works for all users but today I got a support request from one user that he can login but on the next click he is being logged out.

So, how is it possible that his HTTP_USER_AGENT information changes on each click?



2:41 pm on Jan 10, 2011 (gmt 0)

10+ Year Member

Does he accept cookies?


6:04 pm on Jan 10, 2011 (gmt 0)

5+ Year Member

I don't know. I will check.


7:14 pm on Jan 10, 2011 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member

Hi all,

Whether I am reading this issue wrong or not, not sure, but a quick google reveals this [bugs.php.net].

You could use an alternative way to do login's and credential checks, I personally have never used getenv() before, but that's not to say it doesn't function, it could be to do with the way as the server is setup, which version of php is running and the OS too..

Simple way to check cookies would be to try and set one, and if the call returns false you can display a message asking the user to enable cookies, that's kinda how it's done on here when you first login, check, ok, set, continue.

A few options open to you..

Hope that makes sense.


Featured Threads

Hot Threads This Week

Hot Threads This Month