Hi everyone ive searched the forums for this with no luck im trying to find the coding for time online (example) Time online: 1 hour 46 mins 3 secs any help wud be grateful
Time Online
Collapse
X
-
GuestTags: None
-
i made this code can use it for idle and online time it will give the msg from seconds so like doing time()-lastseen then that value goes in this function also it does up to weeks if u want put months and years in jus add them lol its easy
Code:function TimeMsg($secs) { $mins=floor(($secs)/60); $hours=floor(($mins)/60); $days=floor(($hours)/24); $weeks=floor(($days)/7); if($secs>59)$secs=$secs-($mins*60); if($mins>59)$mins=$mins-($hours*60); if($hours>23)$hours=$hours-($days*24); if($days>6)$days=$days-($weeks*7); $msg=""; if($weeks>0)$msg.=$weeks." week"; if($weeks>1)$msg.="s"; if($weeks>0&&$days>0)$msg.=", "; if($days>0)$msg.=$days." day"; if($days>1)$msg.="s"; if(($days>0||$weeks>0)&&$hours>0)$msg.=", "; if($hours>0)$msg.=$hours." hour"; if($hours>1)$msg.="s"; if(($hours>0||$days>0)&&$mins>0)$msg.=", "; if($mins>0)$msg.=$mins." minute"; if($mins>1)$msg.="s"; if($mins>0&&$secs>0)$msg.=", "; if($secs>0)$msg.=$secs." second"; if($secs>1)$msg.="s"; if(!$secs&&!$mins&&!$hours&&!$days)$msg="0 seconds"; return $msg; }
Comment
-
<div class='quotetop'>QUOTE (ori @ Oct 3 2008, 12:17 AM) <{POST_SNAPBACK}></div>i made this code can use it for idle and online time it will give the msg from seconds so like doing time()-lastseen then that value goes in this function also it does up to weeks if u want put months and years in jus add them lol its easy
Code:function TimeMsg($secs) { $mins=floor(($secs)/60); $hours=floor(($mins)/60); $days=floor(($hours)/24); $weeks=floor(($days)/7); if($secs>59)$secs=$secs-($mins*60); if($mins>59)$mins=$mins-($hours*60); if($hours>23)$hours=$hours-($days*24); if($days>6)$days=$days-($weeks*7); $msg=""; if($weeks>0)$msg.=$weeks." week"; if($weeks>1)$msg.="s"; if($weeks>0&&$days>0)$msg.=", "; if($days>0)$msg.=$days." day"; if($days>1)$msg.="s"; if(($days>0||$weeks>0)&&$hours>0)$msg.=", "; if($hours>0)$msg.=$hours." hour"; if($hours>1)$msg.="s"; if(($hours>0||$days>0)&&$mins>0)$msg.=", "; if($mins>0)$msg.=$mins." minute"; if($mins>1)$msg.="s"; if($mins>0&&$secs>0)$msg.=", "; if($secs>0)$msg.=$secs." second"; if($secs>1)$msg.="s"; if(!$secs&&!$mins&&!$hours&&!$days)$msg="0 seconds"; return $msg; }
Thanks
Comment
-
Guest
<div class='quotetop'>QUOTE (friend @ Oct 23 2008, 05:26 AM) <{POST_SNAPBACK}></div>Thanks ori but whats usage code?
Thanks[/b]
Comment
-
<div class='quotetop'>QUOTE (DarkSilent @ Oct 23 2008, 05:48 AM) <{POST_SNAPBACK}></div>just use methos script author hehehe..[/b]
Thanks
Comment
-
Guest
in index.php?action=viewuser
Code:$totaltimeonline = mysql_fetch_array(mysql_query("SELECT tottimeonl FROM ibwf_users WHERE id='".$who."'")); $num = $totaltimeonline[0]/86400; $days = intval($num); $num2 = ($num - $days)*24; $hours = intval($num2); $num3 = ($num2 - $hours)*60; $mins = intval($num3); $num4 = ($num3 - $mins)*60; $secs = intval($num4); echo "Time Online: "; if(($days==0) and ($hours==0) and ($mins==0)){ echo "[b]$secs[/b] seconds "; }else if(($days==0) and ($hours==0)){ echo "[b]$mins[/b] mins, "; echo "[b]$secs[/b] seconds "; }else if(($days==0)){ echo "[b]$hours[/b] hours, "; echo "[b]$mins[/b] mins, "; echo "[b]$secs[/b] seconds "; }else{ echo "[b]$days[/b] days, "; echo "[b]$hours[/b] hours, "; echo "[b]$mins[/b] mins, "; echo "[b]$secs[/b] seconds "; } $noi = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id='".$who."'")); echo "$idleofline "; $idleofline = "Idle For:"; $remain = time() - $noi[0]; $num = $remain/86400; $days = intval($num); $num2 = ($num - $days)*24; $hours = intval($num2); $num3 = ($num2 - $hours)*60; $mins = intval($num3); $num4 = ($num3 - $mins)*60; $secs = intval($num4); if(($days==0) and ($hours==0) and ($mins==0)){ echo "[b]$secs[/b] seconds "; }else if(($days==0) and ($hours==0)){ echo "[b]$mins[/b] mins, "; echo "[b]$secs[/b] seconds "; }else if(($days==0)){ echo "[b]$hours[/b] hours, "; echo "[b]$mins[/b] mins, "; echo "[b]$secs[/b] seconds "; }else{ echo "[b]$days[/b] days, "; echo "[b]$hours[/b] hours, "; echo "[b]$mins[/b] mins, "; echo "[b]$secs[/b] seconds "; }
Code:`tottimeonl` int(100) NOT NULL default '0',
Comment
-
<div class='quotetop'>QUOTE (jsyguy23 @ Oct 24 2008, 04:14 AM) <{POST_SNAPBACK}></div>you must of replacet the old time format pmsl[/b]
Comment
-
<div class='quotetop'>QUOTE (bijaybd @ Oct 28 2008, 10:27 PM) <{POST_SNAPBACK}></div>can somebody make it for mobile chat 2.0.2 by ghost and device[/b]
sigpicthe italian/international COMMUNITY of friendship
http://people2000.netne.net
WAP/WEB
peoplemailbox@katamail.com
Comment
Comment