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.

adminbans.php 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?PHP
  2. require_once('lib/dashboard.php');
  3. require_once('lib/account.php');
  4. checkAccess(ADMIN);
  5. define('TITLE', 'Admin - Ban management');
  6. if (isset($_GET['n']) && ctype_digit($_GET['n'])) {
  7. $sql = 'SELECT ipban_ip, ipban_expires FROM ipbans WHERE ipban_id = ';
  8. $sql .= $_GET['n'];
  9. $res = mysql_query($sql) or mf(__FILE__, __LINE__, $sql);
  10. $row = mysql_fetch_array($res);
  11. logger::log('Expiring ban on '.$row['ipban_ip'].' (expirary: '.duration($row[
  12. 'ipban_expires'] - time()).'; id: '.$_GET['n'].')', logger::normal);
  13. $sql = 'UPDATE ipbans SET ipban_expires = 0 WHERE ipban_id = '.$_GET['n'];
  14. mysql_query($sql) or mf(__FILE__, __LINE__, $sql);
  15. header('Location: '.CP_PATH.'adminbans');
  16. exit;
  17. }
  18. if (isset($_GET['d']) && ctype_digit($_GET['d'])) {
  19. $sql = 'SELECT ipban_ip, ipban_expires FROM ipbans WHERE ipban_id = ';
  20. $sql .= $_GET['d'];
  21. $res = mysql_query($sql) or mf(__FILE__, __LINE__, $sql);
  22. $row = mysql_fetch_assoc($res);
  23. logger::log('Deleting ban on '.$row['ipban_ip'].' (expirary: '.duration($row['ipban_expires'] - time(), true).'; id: '.$_GET['d'].')', logger::normal);
  24. $sql = 'DELETE FROM ipbans WHERE ipban_id = ' . $_GET['d'];
  25. $res = mysql_query($sql) or mf(__FILE__, __LINE__, $sql);
  26. header('Location: '.CP_PATH.'adminbans');
  27. exit;
  28. }
  29. if (isset($_POST['ip'])) {
  30. $sql = 'INSERT INTO ipbans (ipban_ip, ipban_message, ipban_expires) VALUES ';
  31. $sql .= '(\''.m($_POST['ip']).'\', \''.m($_POST['reason']).'\', ';
  32. $sql .= strtotime($_POST['expirary']).')';
  33. logger::log('Placing ban on '.$_POST['ip'].' (reason: '.$_POST['reason'].'; expirary: '.duration(strtotime($_POST['expirary'])-time()).')', logger::normal);
  34. mysql_query($sql) or mf(__FILE__, __LINE__, $sql);
  35. header('Location: '.CP_PATH.'adminbans');
  36. exit;
  37. }
  38. require_once('admin.menu.php');
  39. require_once('lib/header.php');
  40. require_once('pages/admin.ipbans.php');
  41. require_once('pages/admin.addipban.php');
  42. require_once('pages/admin.userbans.php');
  43. require_once('lib/footer.php');
  44. ?>