Unsupported scripts and control panel web app for a hosting company
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

admin.ipbans.php 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?PHP
  2. require_once('lib/database.php');
  3. require_once('lib/common.php');
  4. ?>
  5. <div class="block" id="users">
  6. <h2>ADMIN: IP Bans</h2>
  7. <table class="innerblock">
  8. <tr>
  9. <th>&nbsp;</th>
  10. <th>IP</th>
  11. <th>Reason</th>
  12. <th>Expires in</th>
  13. <th>Actions</th>
  14. </tr>
  15. <?PHP
  16. $i = 0;
  17. $n = 0;
  18. $sql = 'SELECT ipban_id, ipban_ip, ipban_expires, ipban_message FROM ipbans';
  19. $res = mysql_query($sql) or mf(__FILE__, __LINE__, $sql);
  20. if (mysql_num_rows($res) == 0) {
  21. echo '<tr><td colspan="5" style="text-align: center; font-style: italic;">';
  22. echo 'No IP bans</td></tr>';
  23. }
  24. while ($row = mysql_fetch_array($res)) {
  25. $n++;
  26. ?>
  27. <tr class="<?PHP echo ($i == 0) ? 'even' : 'odd'; ?>">
  28. <td><?PHP echo $n; ?>.</td>
  29. <td><?PHP echo h($row['ipban_ip']); ?></td>
  30. <td><?PHP echo h($row['ipban_message']); ?></td>
  31. <?PHP
  32. if ($row['ipban_expires'] < time()) {
  33. echo '<td style="color: red;">Expired</td><td>';
  34. } else {
  35. echo '<td>'.duration($row['ipban_expires'] - time()).'</td>';
  36. ?>
  37. <td>
  38. <a href="?n=<?PHP echo $row['ipban_id']; ?>">
  39. Remove
  40. </a> or
  41. <?PHP
  42. }
  43. ?>
  44. <a href="?d=<?PHP echo $row['ipban_id']; ?>">Delete</a>
  45. </td>
  46. </tr>
  47. <?PHP
  48. $i = 1 - $i;
  49. }
  50. ?>
  51. </table>
  52. </div>