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.

bans.php 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?PHP
  2. require_once('lib/dashboard.php');
  3. require_once('lib/account.php');
  4. define('TITLE', 'Admin - Ban management');
  5. addDashboardItem('Other admin tools', 'Overview', 'admin');
  6. addDashboardItem('Other admin tools', 'Sites', 'adminsites');
  7. addDashboardItem('Other admin tools', 'Reports', 'reports');
  8. addDashboardItem('Other admin tools', 'Discounts', 'discounts');
  9. addDashboardItem('External tools', 'Wiki', 'http://admin.utd-hosting.com/wiki'
  10. );
  11. addDashboardItem('External tools', 'Service monitor', 'http://admin.utd-hostin
  12. g.com/mon');
  13. addDashboardItem('External tools', 'Finances', 'http://admin.utd-hosting.com/f
  14. inances');
  15. if (defined('ADMIN') && isset($_GET['n']) && ctype_digit($_GET['n'])) {
  16. $sql = 'SELECT ipban_ip, ipban_expires FROM ipbans WHERE ipban_id = ';
  17. $sql .= $_GET['n'];
  18. $res = mysql_query($sql) or mf(__FILE__, __LINE__, $sql);
  19. $row = mysql_fetch_array($res);
  20. logger::log('Expiring ban on '.$row['ipban_ip'].' (expirary: '.duration($row[
  21. 'ipban_expires'] - time()).'; id: '.$_GET['n'].')', logger::normal);
  22. $sql = 'UPDATE ipbans SET ipban_expires = 0 WHERE ipban_id = '.$_GET['n'];
  23. mysql_query($sql) or mf(__FILE__, __LINE__, $sql);
  24. header('Location: '.CP_PATH.'bans');
  25. exit;
  26. }
  27. if (defined('ADMIN') && isset($_POST['ip'])) {
  28. $sql = 'INSERT INTO ipbans (ipban_ip, ipban_message, ipban_expires) VALUES ';
  29. $sql .= '(\''.m($_POST['ip']).'\', \''.m($_POST['reason']).'\', ';
  30. $sql .= strtotime($_POST['expirary']).')';
  31. logger::log('Placing ban on '.$_POST['ip'].' (reason: '.$_POST['reason'].'; expirary: '.duration(strtotime($_POST['expirary'])-time()).')', logger::normal);
  32. mysql_query($sql) or mf(__FILE__, __LINE__, $sql);
  33. header('Location: '.CP_PATH.'bans');
  34. exit;
  35. }
  36. require_once('lib/header.php');
  37. if (defined('ADMIN') && ADMIN) {
  38. require_once('pages/adminipbans.php');
  39. require_once('pages/adminaddipban.php');
  40. } else {
  41. define('ERROR', 'You\'re no admin!');
  42. }
  43. require_once('lib/footer.php');
  44. ?>