Advertisement
Guest User

Untitled

a guest
Jul 11th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. <?php
  2. $host = "localhost";
  3. $user = "root";
  4. $pass = "myw0wserver";
  5. $DB = "auth";
  6. $DB1 = "characters";
  7. mysql_connect($host, $user, $pass) or die("Server cannot Connect");
  8. mysql_select_db($DB);
  9. $qry = "SELECT * FROM uptime WHERE realmid='1' ORDER BY starttime DESC LIMIT 1";
  10. $res = mysql_query($qry) or die(mysql_error());
  11. while($row = mysql_fetch_array($res)){
  12. $start = $row['starttime'];
  13. if($row['uptime'] == '0'){$status = "online";}else{$status = "offline";}
  14. echo $status;
  15. if($status == "online"){
  16. echo "<br>";
  17. $now = time();
  18. $uptime = ($now - $start);
  19. $weeks=$uptime/604800;
  20. $d=($uptime%604800)/86400;
  21. $h=(($uptime%604800)%86400)/3600;
  22. $m=((($uptime%604800)%86400)%3600)/60;
  23. $s=(((($uptime%604800)%86400)%3600)%60);
  24. if(round($d) > 0){if(round($d) > 1){echo round($d)." Days ";}else{echo round($d)." Day ";}}
  25. if(round($h) > 0){if(round($h) > 1){echo round($h)." Hours ";}else{echo round($h)." Hour ";}}
  26. if(round($m) > 0){if(round($m) > 1){echo round($m)." Minutes ";}else{echo round($m)." Minute ";}}
  27. if(round($s) > 0){if($s > 1){echo $s." Seconds ";}else{echo $s." Second ";}}
  28. }
  29. }
  30.  
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement