Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Kusaba X DEFCON Flood protection module
- //
- //
- // It's a piece of pony pooping all over PHP without prior knowledge of appropriate, perfect usage.
- //
- //
- //
- // The comments also have a lot of alliteration.
- // But yeah it sucks.
- // include() this in the posting section of board.php. This should enable more spam control.
- // Before installing it, run the following query on the database:
- /*
- CREATE TABLE IF NOT EXISTS defcon (
- time_set INT(11) NOT NULL,
- time_expires INT(11) NOT NULL,
- set_from int(1) NOT NULL,
- set_to int(1) NOT NULL,
- PRIMARY KEY(set_to)
- ) ENGINE=InnoDB;
- */
- include_once('config.php');
- $server = $cf['KU_DBHOST'];
- $databaes = $cf['KU_DBDATABASE'] ;
- $username = $cf['KU_DBUSERNAME'] ;
- $password = $cf['KU_DBPASSWORD'] ;
- $db = new mysqli($server, $username, $password, $databaes);
- $query = '';
- $db->query($query) or die($db->error);
- $defcons = $db->query('SELECT * FROM defcon ORDER BY time_set LIMIT 1') or die($db->error);
- while($current_defcon == $defcons->fetch_array())
- {
- if($current_defcon['set_to'] == '1' || $current_defcon['set_to'] == '2')
- {
- die('Posting is temporarily disabled. Sorry for the inconvenience.');
- } else {
- if($current_defcon['set_to'] == '3')
- {
- $user_posts = $db->query('SELECT * FROM '.PREFIX.'_posts WHERE ip="'.$_SERVER['REMOTE_ADDR'].'"') or die($db->error);
- if($user_posts->num_rows <= '500')
- {
- die('Posting is disabled unless you have more than 500 active posts.');
- }
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment