Jump to content

Recommended Posts

Timestamps are timezone-agnostic. It's the same number everywhere in the world. What timezones affect is how that timestamp is written as a string.

 

Is $user_data->lock_date in GMT? Then

date_default_timezone_set("GMT");
if (strtotime($user_data->lock_date) > time()) {

Link to comment
https://forums.phpfreaks.com/topic/268000-gmt-timezone/#findComment-1375216
Share on other sites

Nothing to do with the current time setting on the server then?

 

The timezone setting in PHP affects how php interprets string dates (eg, strtotime()) and formatting, (eg date()) but has no bearing on the actual numeric timestamp that is returned.  That number is always the same for any given time at any location, because it is, by definition, in GMT (# of seconds since 1/1/1970 @ 00:00:00 GMT).

 

 

Link to comment
https://forums.phpfreaks.com/topic/268000-gmt-timezone/#findComment-1375244
Share on other sites

Well this is confusing I"m trying to figure out why line 108 isn't sending the output array to be shown to the user.

 

echo strtotime($user_data->lock_date);  shows 1346794857

echo $current_gmt_time; shows 1346793958 so I don't know why it doesn't show that message

 

http://pastebin.com/ETDGY5My

Link to comment
https://forums.phpfreaks.com/topic/268000-gmt-timezone/#findComment-1375252
Share on other sites

Well this is confusing I"m trying to figure out why line 108 isn't sending the output array to be shown to the user.

 

echo strtotime($user_data->lock_date);  shows 1346794857

echo $current_gmt_time; shows 1346793958 so I don't know why it doesn't show that message

 

http://pastebin.com/ETDGY5My

 

That's okay, but..... what about next statement :

if (strtotime($user_data->lock_date) > $current_gmt_time)

Link to comment
https://forums.phpfreaks.com/topic/268000-gmt-timezone/#findComment-1375259
Share on other sites

Well this is confusing I"m trying to figure out why line 108 isn't sending the output array to be shown to the user.

 

echo strtotime($user_data->lock_date);  shows 1346794857

echo $current_gmt_time; shows 1346793958 so I don't know why it doesn't show that message

 

http://pastebin.com/ETDGY5My

 

That's okay, but..... what about next statement :

if (strtotime($user_data->lock_date) > $current_gmt_time)

 

What about it? I posted the two echoed amounts and not sure why it doesn't send the output array in that true statement.

Link to comment
https://forums.phpfreaks.com/topic/268000-gmt-timezone/#findComment-1375264
Share on other sites

Well this is confusing I"m trying to figure out why line 108 isn't sending the output array to be shown to the user.

 

echo strtotime($user_data->lock_date);  shows 1346794857

echo $current_gmt_time; shows 1346793958 so I don't know why it doesn't show that message

 

http://pastebin.com/ETDGY5My

 

That's okay, but..... what about next statement :

if (strtotime($user_data->lock_date) > $current_gmt_time)

 

What about it? I posted the two echoed amounts and not sure why it doesn't send the output array in that true statement.

Exactly , 1346794857 is not greater than time() !

Link to comment
https://forums.phpfreaks.com/topic/268000-gmt-timezone/#findComment-1375267
Share on other sites

Well this is confusing I"m trying to figure out why line 108 isn't sending the output array to be shown to the user.

 

echo strtotime($user_data->lock_date);  shows 1346794857

echo $current_gmt_time; shows 1346793958 so I don't know why it doesn't show that message

 

http://pastebin.com/ETDGY5My

 

That's okay, but..... what about next statement :

if (strtotime($user_data->lock_date) > $current_gmt_time)

 

What about it? I posted the two echoed amounts and not sure why it doesn't send the output array in that true statement.

Exactly , 1346794857 is not greater than time() !

 

Yes it is. 1346794857 >  1346793958

Link to comment
https://forums.phpfreaks.com/topic/268000-gmt-timezone/#findComment-1375268
Share on other sites

This is odd I did my five failed logins and everything posted correctly then tried logging in again and it gave me that same long message. I even put echo 'testing' inside of the if statement on 108 above the output array and it still echos true which means the message below is over ridding the output array on 108.

 

Your account is currently locked, we appologize for the inconvienence. You must wait 15 minutes before you can login again! An email was sent to the owner of this account! Forgotten your username or password? <a href="forgotusername">Forgot Username</a> or <a href="forgotpassword">Forgot Password</a>

Link to comment
https://forums.phpfreaks.com/topic/268000-gmt-timezone/#findComment-1375278
Share on other sites

The way your script is structured, it is not going to stop if your if (strtotime($user_data->lock_date) > $current_gmt_time) condition is true.  It will set the output variable but then keep going and continue to process all the subsequent if statements.  Assuming your putting in an invalid password rather than the correct one you'll end up triggering that section of code that locks the user out and displays that long message.  If you put in the valid password you'd get logged in, even though the user is supposed to be locked out.

 

Link to comment
https://forums.phpfreaks.com/topic/268000-gmt-timezone/#findComment-1375329
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.