mysql_select_db("mangos", $link); $getuptime = mysql_query("SELECT `uptime` FROM `uptime` ORDER BY `starttime` DESC LIMIT 1") or die(mysql_error()); $getmaxplayers = mysql_query("SELECT `uptime` FROM `uptime` ORDER BY `maxplayers` DESC LIMIT 1") or die(mysql_error()); $maxplayers_row = mysql_fetch_array($getmaxplayers); $maxplayers = $maxplayers_row[0]; $uptime3 = mysql_fetch_array($getuptime); $getmaxuptime = mysql_query("SELECT `uptime` FROM `uptime` ORDER BY `uptime` DESC LIMIT 1") or die(mysql_error()); $getmaxuptime3 = mysql_fetch_array($getmaxuptime); $maxuptime2 = $getmaxuptime3[0]; $uptime2 = $uptime3[0]; function secs2timestring ($secs, $pad = false, $format="%d% day(s) %h% hour(s) %m% min(s) %s% sec(s)") { $output = array(); $output[0] = $secs % 60; // secs $temp = ($secs - $output[0]) / 60; // total mins $output[1] = $temp % 60; // mins $temp = ($temp - $output[1]) / 60; // total hours $output[2] = $temp % 24; // hours $output[3] = ($temp - $output[2]) / 24; // days if ($pad) { for ($i = 0; $i < 4; $i++) { $output[$i] = str_pad($output[$i], 2, "0", STR_PAD_LEFT); } } return str_replace(array(0 => "%s%", 1 => "%m%", 2 => "%h%", 3 => "%d%"), $output, $format); } $uptime = secs2timestring($uptime2,1); $maxuptime = secs2timestring($maxuptime2,1); $maxplayers = secs2timestring($maxplayers); ?> Uptime =
Max Uptime = Max Players =