Advertisement
clark

Bans Page

Feb 12th, 2012
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.50 KB | None | 0 0
  1. <head>
  2. <style type="text/css">
  3. A:link {text-decoration: none}
  4. A:visited {text-decoration: none}
  5. A:active {text-decoration: none}
  6. A:hover {text-decoration: none; color: red;}
  7. </style>
  8. </head>
  9. <body>
  10. <?php
  11. $todaysdate = time();
  12. $link = mysql_connect("ip", "host", "readonly"); // We secured with read only premissions
  13.     if (!$link)
  14.     {
  15.         die('Could not connect: ' . mysql_error());
  16.     }
  17.     mysql_select_db("bans");
  18.     $result = mysql_query("SELECT * FROM bans");
  19.     if (!$result)
  20.     {
  21.         $message  = 'Invalid query: ' . mysql_error() . "\n";
  22.         $message .= 'Whole query: ' . $result;
  23.         die($message);
  24.     }
  25.  
  26. print "<center><table width='500' border='0'>
  27. <tr>
  28. <td><b>Name</b></td>
  29. <td><b>SteamID</b></td>
  30. <td><b>Time</b></td>
  31. <td ><b>Reason</b></td>
  32. <td><b>Admin</b></td><tr>";
  33.  
  34. while($row = mysql_fetch_array($result, MYSQL_ASSOC))
  35. {
  36.     $row['cid'] = 'http://steamcommunity.com/profiles/' . $row['cid'];
  37.     if ($row['time'] == 0)
  38.     {
  39.         $row['time'] = "Permanent";
  40.     }
  41.     elseif ($row['time'] > $todaysdate)
  42.     {
  43.         $timeleft = $row['time'] - $todaysdate;
  44.         $Minutes = floor($timeLeft / 60);
  45.         $Seconds = $timeLeft - ($Minutes * 60);
  46.         $Hours = floor($Minutes / 60);
  47.         $Minutes = $Minutes - ($Hours * 60);
  48.         $Days = floor($Hours / 24);
  49.         $Hours = $Hours - ($Days * 24);
  50.         if ($Days >= 1)
  51.         {
  52.             $row['time'] = $Days + 1 . " days";
  53.             if ($Days == 0)
  54.             {
  55.                 $row['time'] = $Days + 1 . " days " . $Hours + 1 . " hours";
  56.             }
  57.             elseif (($Hours == 0) && ($Days == 0))
  58.             {
  59.                 $row['time'] = $Days + 1 . " days " . $Minutes + 1 . " minutes";
  60.             }
  61.             else
  62.             {
  63.                 $row['time'] = $Days + 1 . " days " . $Seconds + 1 . " seconds.";
  64.             }
  65.         }
  66.         elseif ($Days == 0)
  67.         {
  68.             $row['time'] = $Hours + 1 . " hours";
  69.             if (($Hours == 0) && ($Days == 0))
  70.             {
  71.                 $row['time'] = $Hours + 1 . " hours " . $Minutes + 1 . " minutes";
  72.             }
  73.             else
  74.             {
  75.                 $row['time'] = $Hours + 1 . " hours " . $Seconds + 1 . " seconds.";
  76.             }
  77.         }
  78.         elseif (($Hours == 0) && ($Days == 0))
  79.         {
  80.             $row['time'] = $Minutes + 1 . " minutes";
  81.             if ($Seconds >= 1)
  82.             {
  83.                 $row['time'] = $Minutes + 1 . " minutes " . $Seconds + 1 . " seconds";
  84.             }
  85.         }
  86.         else
  87.         {
  88.             $row['time'] = $Seconds + 1 . " seconds.";
  89.         }
  90.     }
  91.     elseif ($row['time'] < $todaysdate && $row['time'] != 0)
  92.     {
  93.      $row['time'] = "Unbanned";
  94.     }
  95.  
  96. echo"
  97. <tr>
  98. <td><a href={$row['cid']}>{$row['name']}</a></td>
  99. <td>{$row['steamid']}</td>
  100. <td>{$row['time']}</td>
  101. <td>{$row['reason']}</td>
  102. <td>{$row['admin']}</td>
  103. </tr>
  104. ";
  105. }
  106. print "</table>";
  107. ?>
  108. </body>
  109. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement