Jump to content
MakeWebGames

Recommended Posts

Posted

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

Posted

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.

Posted
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:
Posted
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.

Posted

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

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.   Paste as plain text instead

  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...