2348 characters | 78 lines | 2.29 KB
- <?php
- /******************************************************************************
- --
- -- Table structure for table `blocked_ips`
- --
- CREATE TABLE IF NOT EXISTS `blocked_ips` (
- `ip` varchar(39) COLLATE utf8_bin NOT NULL DEFAULT '0.0.0.0',
- PRIMARY KEY (`ip`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
- /******************************************************************************/
- $dbhost = 'localhost'; // hostname of the database server
- $dbuser = 'user'; // database username
- $dbpass = 'pass'; // database password
- $dbname = 'database'; // name of the database to use
- $admin_mail = 'admin@localhost'; // admin's email address
- /******************************************************************************
- get_ip() - Attempts to retrieve the most accurate IP possible from user.
- /******************************************************************************/
- function get_ip()
- {
- {
- {
- return $_SERVER['X_FORWARDED_FOR'];
- }
- }
- return $_SERVER['REMOTE_ADDR'];
- }
- $ip = get_ip();
- // connect to the database
- // build query
- if ( $result == "1" )
- {
- echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html>
- <head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <title>ERROR: 403 Forbidden - You have been banned!</title>
- <style type="text/css">
- </style>
- </head>
- <body>
- <h1>ERROR: 403 FORBIDDEN</h1>
- <p>
- It appears that your IP ( '.$ip.' ) has been banned from accessing
- this sites content. If you feel that this banning is in error, feel
- free to contact the sites administrator to have it removed.
- </p>
- <p>Admin Contact: <a href="MAILTO:'.$admin_mail.'">'.$admin_mail.'</a></p>
- </body>
- </html>
- ';
- }
- // clean up variables
- /* end of file */
