I’m having problems with time on my hosting account.
While I’m checking the session time from a database table, then comparing it to time(), the time is an hour off.
First I save the time to the database with SET `session_time` = FROM_UNIXTIME(".time()."). (I also tried SET `session_time` = NOW() )
Later in the same script, I recall the saved value from the database and compare it to time() to check how long the user has been inactive.
The times are an hour off even though I saved and recalled the time in the same execution of the script! I know the script works because I test it on another sever before putting it on x10.
I have had the times change on me twice so far. The first time, about a week ago, the time difference was an hour off. It was back to normal when I checked again the next day. The second time started about three hours ago, and is still an hour apart. My sever name is Lotus.x10 and my domain name is rforum.x10hosting.com. Help?
Part of the function:
While I’m checking the session time from a database table, then comparing it to time(), the time is an hour off.
First I save the time to the database with SET `session_time` = FROM_UNIXTIME(".time()."). (I also tried SET `session_time` = NOW() )
Later in the same script, I recall the saved value from the database and compare it to time() to check how long the user has been inactive.
The times are an hour off even though I saved and recalled the time in the same execution of the script! I know the script works because I test it on another sever before putting it on x10.
I have had the times change on me twice so far. The first time, about a week ago, the time difference was an hour off. It was back to normal when I checked again the next day. The second time started about three hours ago, and is still an hour apart. My sever name is Lotus.x10 and my domain name is rforum.x10hosting.com. Help?
Part of the function:
PHP:
$check = getuser($iuser); #('SELECT * FROM `user` WHERE `user_id` = \''.$iuser.'\' LIMIT 1';)
$timelast = strtotime($check['session_time']);
$timenow = time();
echo '<BR>Time diff:'.($timenow - $timelast); #(=3600)
if ($timelast != $timenow){
$query = "UPDATE `user` SET `session_time` = FROM_UNIXTIME(".time()."), `session_ip` = '$ipnow' WHERE `user_id` = '$iuser'";
}