...

View Full Version : user login time



sradha
03-10-2010, 06:16 PM
How can I get the time of user login?

Dormilich
03-10-2010, 06:52 PM
$_SESSION['login_time'] = $_SERVER['REQUEST_TIME'];

sradha
03-10-2010, 07:58 PM
$_SESSION['login_time'] = $_SERVER['REQUEST_TIME'];

See I want to get the user's login time..if I use the above code whenver the page gets refreshed the time gets updated...How can I get the exact time of login...that is the time at which the user gets into the site.

Dormilich
03-10-2010, 08:02 PM
why do you call that on every page load? it belongs only in the login script and it shouldn’t be reset once set.

if (!isset($_SESSION['login_time']))
{
$_SESSION['login_time'] = $_SERVER['REQUEST_TIME'];
}

mlseim
03-10-2010, 08:33 PM
Who's time are you talking about?
Your time, your server's time, or your visitor's time?

Your server might not be in your timezone, so you can
force the server to use your city's timezone ...


// Set the timezone to your city .. based on a valid city identifier
// See: http://www.php.net/manual/en/timezones.php
date_default_timezone_set('America/Chicago');



.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum