Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = "localhost";
- $user = "root";
- $pass = "myw0wserver";
- $DB = "auth";
- $DB1 = "characters";
- mysql_connect($host, $user, $pass) or die("Server cannot Connect");
- mysql_select_db($DB);
- $qry = "SELECT * FROM uptime WHERE realmid='1' ORDER BY starttime DESC LIMIT 1";
- $res = mysql_query($qry) or die(mysql_error());
- while($row = mysql_fetch_array($res)){
- $start = $row['starttime'];
- if($row['uptime'] == '0'){$status = "online";}else{$status = "offline";}
- echo $status;
- if($status == "online"){
- echo "<br>";
- $now = time();
- $uptime = ($now - $start);
- $weeks=$uptime/604800;
- $d=($uptime%604800)/86400;
- $h=(($uptime%604800)%86400)/3600;
- $m=((($uptime%604800)%86400)%3600)/60;
- $s=(((($uptime%604800)%86400)%3600)%60);
- if(round($d) > 0){if(round($d) > 1){echo round($d)." Days ";}else{echo round($d)." Day ";}}
- if(round($h) > 0){if(round($h) > 1){echo round($h)." Hours ";}else{echo round($h)." Hour ";}}
- if(round($m) > 0){if(round($m) > 1){echo round($m)." Minutes ";}else{echo round($m)." Minute ";}}
- if(round($s) > 0){if($s > 1){echo $s." Seconds ";}else{echo $s." Second ";}}
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement