Guest User

Untitled

a guest
Oct 22nd, 2017
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. <?php
  2. // Kusaba X DEFCON Flood protection module
  3. //
  4. //
  5. // It's a piece of pony pooping all over PHP without prior knowledge of appropriate, perfect usage.
  6. //
  7. //
  8. //
  9. // The comments also have a lot of alliteration.
  10. // But yeah it sucks.
  11. // include() this in the posting section of board.php. This should enable more spam control.
  12. // Before installing it, run the following query on the database:
  13. /*
  14. CREATE TABLE IF NOT EXISTS defcon (
  15. time_set INT(11) NOT NULL,
  16. time_expires INT(11) NOT NULL,
  17. set_from int(1) NOT NULL,
  18. set_to int(1) NOT NULL,
  19. PRIMARY KEY(set_to)
  20. ) ENGINE=InnoDB;
  21. */
  22. include_once('config.php');
  23. $server = $cf['KU_DBHOST'];
  24. $databaes = $cf['KU_DBDATABASE'] ;
  25. $username = $cf['KU_DBUSERNAME'] ;
  26. $password = $cf['KU_DBPASSWORD'] ;
  27. $db = new mysqli($server, $username, $password, $databaes);
  28. $query = '';
  29. $db->query($query) or die($db->error);
  30. $defcons = $db->query('SELECT * FROM defcon ORDER BY time_set LIMIT 1') or die($db->error);
  31. while($current_defcon == $defcons->fetch_array())
  32. {
  33. if($current_defcon['set_to'] == '1' || $current_defcon['set_to'] == '2')
  34. {
  35. die('Posting is temporarily disabled. Sorry for the inconvenience.');
  36. } else {
  37. if($current_defcon['set_to'] == '3')
  38. {
  39. $user_posts = $db->query('SELECT * FROM '.PREFIX.'_posts WHERE ip="'.$_SERVER['REMOTE_ADDR'].'"') or die($db->error);
  40. if($user_posts->num_rows <= '500')
  41. {
  42. die('Posting is disabled unless you have more than 500 active posts.');
  43. }
  44. }
  45. }
  46. }
  47. ?>
Add Comment
Please, Sign In to add comment