J_StrauD Posted December 21, 2009 Posted December 21, 2009 Okay, I'm having this really annoying problem with usersonline and the time it gives. On the mainmenu where it says "Staff Online", it says my name or another staff and then it says (-170 secs). Its not saying 0 seconds like it should. I also have this problem on viewuser and usersonline and its really frustrating me because Im not good with timestamp or anything and I don't even know what would cause this problem because I have not edited anything that involves time. Any help would be greatly appreciated. :D Thanks, MasterMetallica Quote
Equinox Posted December 21, 2009 Posted December 21, 2009 Can you post the code with the problem? Quote
J_StrauD Posted December 21, 2009 Author Posted December 21, 2009 The code on view user is this: if($r['laston'] > 0) { $la=time()-$r['laston']; $unit="seconds"; if($la >= 60) { $la=(int) ($la/60); $unit="minutes"; } if($la >= 60) { $la=(int) ($la/60); $unit="hours"; if($la >= 24) { $la=(int) ($la/24); $unit="days"; } } $str="$la $unit ago"; } else { $str="--"; } if($r['last_login'] > 0) { $ll=time()-$r['last_login']; $unit2="seconds"; if($ll >= 60) { $ll=(int) ($ll/60); $unit2="minutes"; } if($ll >= 60) { $ll=(int) ($ll/60); $unit2="hours"; if($ll >= 24) { $ll=(int) ($ll/24); $unit2="days"; } } $str2="$ll $unit2 ago"; } else { $str2="--"; } And then later on it says Last Action: $str Last Login: $str2 I dont understand why its doing it because I haven't touched any of the code that shows time. Quote
J_StrauD Posted December 28, 2009 Author Posted December 28, 2009 Also I should add that everyday, it goes -1 more. Like right now it is -183 seconds ago and it started at -150. Is it possible that this is something with my host? Quote
wick3d38 Posted December 28, 2009 Posted December 28, 2009 Sounds like a server time issue to me. Quote
J_StrauD Posted December 28, 2009 Author Posted December 28, 2009 Sounds like a server time issue to me.Yes, I confirmed that it is a server time issue. Does anyone know what I can do to fix this? Quote
Zero-Affect Posted December 29, 2009 Posted December 29, 2009 try contacting your host provider support and asking them for help, my hosts normally very compliant when it comes to issues like this. If they don't sort it out i recommend switching to another hosting company byethost is a good one. Quote
J_StrauD Posted December 29, 2009 Author Posted December 29, 2009 try contacting your host provider support and asking them for help, my hosts normally very compliant when it comes to issues like this. If they don't sort it out i recommend switching to another hosting company byethost is a good one.Alright thanks, I'll send them a message. I heard byethost was pretty good, I'll look into switching if this doesnt get sorted out. Thanks for the help :thumbsup: Quote
ddupuis Posted December 30, 2009 Posted December 30, 2009 try contacting your host provider support and asking them for help, my hosts normally very compliant when it comes to issues like this. If they don't sort it out i recommend switching to another hosting company byethost is a good one.Alright thanks, I'll send them a message. I heard byethost was pretty good, I'll look into switching if this doesnt get sorted out. Thanks for the help :thumbsup:may not have seen this thread. i need a better freehost to make my game work proper but that host does not allow games for free. Quote
J_StrauD Posted December 30, 2009 Author Posted December 30, 2009 Okay, I posted this problem on my hosting's support forum and this is the answer I got: mySQL time is not the same as PHP time. There's a brutal fix but I'm not 100% sure -how- exactly to fix it in code. The two ways I can think of are either to evaluate the current time in php -first- and then insert the returned value into mysql (this is probably the "correct" way to do it), OR when getting time via php, replace it with a query to the mysql server to get the current time instead. The former's better; don't use mysql's time, evaluate all the time's in php first and just insert that into the database. This way you're never working with mysql time, just php time. Does anyone have any idea how to do this :?: ?? Because I have no Idea! Any help would be great :D Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.