PluginProbe
BulletProof Security / 7.1
BulletProof Security v7.1
5.7 5.8 5.9 6.0 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.2 trunk 0.44 0.44.1 0.45 0.45.1 0.45.2 0.45.3 0.45.4 0.45.5 All 154 releases
bulletproof-security / 410.php

410.php in BulletProof Security 7.1, at 410.php

142 lines 5.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php ob_start(); ?>
2 <?php session_cache_limiter('nocache'); ?>
3 <?php session_start(); ?>
4 <?php error_reporting(0); ?>
5 <?php session_destroy(); ?>
6 <?php
7 # BEGIN HEADERS
8 header($_SERVER['SERVER_PROTOCOL'].' 410 Gone', true, 410);
9 header('Status: 410 Gone');
10 header('Content-type: text/html; charset=UTF-8');
11 header('Cache-Control: no-store, no-cache, must-revalidate' );
12 header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
13 header('Pragma: no-cache' );
14 # END HEADERS
15 #
16 # Forum Topic with Help Info & Examples: https://forum.ait-pro.com/forums/topic/410-htaccess-redirect-redirect-html-files-redirect-query-strings-redirect-posts-or-categories/
17 #
18 ?>
19 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
20 <html xmlns="http://www.w3.org/1999/xhtml">
21 <head>
22 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
23 <title>410 Gone</title>
24
25 <style type="text/css">
26 <!--
27 body {
28 background-color:#fff;
29 line-height:normal;
30 /* If you want to add a background image uncomment the CSS properties below */
31 /* background-image:url(http://www.example.com/path-to-some-image-file/example-image-file.jpg); /*
32 /* background-repeat:repeat; */
33 }
34
35 #bpsMessage {
36 text-align:center;
37 background-color:#fff;
38 padding:0px;
39 }
40
41 p {
42 font-family:Verdana, Arial, Helvetica, Tahoma, sans-serif;
43 line-height:21px;
44 font-size:14px;
45 font-weight:normal;
46 }
47 -->
48 </style>
49
50 </head>
51
52 <body>
53
54 <div id="bpsMessage">
55 <!-- This code needs to be standard php code (not WP code) in case wp-load.php is not loaded -->
56 <?php
57 $http_status_code = '<p style="font-size:21px;font-weight:600">410 Gone Request</p>';
58 $message = '<p>This page no longer exists.</p>';
59 $bps_hostname = '<p>Website: ' . htmlspecialchars( $_SERVER['SERVER_NAME'], ENT_QUOTES ) . '</p>';
60 $ip_address = '<p>Your IP Address: ' . htmlspecialchars( $_SERVER['REMOTE_ADDR'], ENT_QUOTES ) . '</p>';
61 $bps_plugin_footer = '<p>BPS Plugin 410 Error Page</p>';
62
63 echo $http_status_code . $message . $bps_hostname . $ip_address . $bps_plugin_footer;
64 ?>
65 </div>
66
67 <?php
68 if ( file_exists( dirname(dirname(dirname(dirname(__FILE__)))) . '/wp-load.php' ) ) {
69 require_once '../../../wp-load.php';
70 } else {
71 ob_end_flush();
72 return;
73 }
74
75 $bpsPro_http_referer = false;
76
77 if ( array_key_exists('HTTP_REFERER', $_SERVER) ) {
78 $bpsPro_http_referer = $_SERVER['HTTP_REFERER'];
79 }
80
81 $bpsPro_http_user_agent = false;
82
83 if ( array_key_exists('HTTP_USER_AGENT', $_SERVER) ) {
84 $bpsPro_http_user_agent = $_SERVER['HTTP_USER_AGENT'];
85 }
86
87 $bpsProLog = WP_CONTENT_DIR . '/bps-backup/logs/http_error_log.txt';
88 $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
89 $timeNow = time();
90 $gmt_offset = get_option( 'gmt_offset' ) * 3600;
91
92 $query_string = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
93
94 if ( ! get_option( 'gmt_offset' ) ) {
95 $timestamp = date("F j, Y g:i a", time() );
96 } else {
97 $timestamp = date_i18n(get_option('date_format'), strtotime("11/15-1976")) . ' - ' . date_i18n(get_option('time_format'), $timeNow + $gmt_offset);
98 }
99
100 $event = '410 Gone';
101 $solution = 'N/A - 410 Gone - Not an Attack';
102
103 if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
104
105 $log_contents = "\r\n" . '[410 Gone POST Request: ' . $timestamp . ']' . "\r\n" . 'BPS: ' . $bps_version . "\r\n" . 'WP: ' . $wp_version . "\r\n" . 'Event Code: ' . $event . "\r\n" . 'Solution: ' . $solution . "\r\n" . 'REMOTE_ADDR: '.$bpsPro_remote_addr . "\r\n" . 'Host Name: ' . $hostname . "\r\n" . 'SERVER_PROTOCOL: ' . $_SERVER['SERVER_PROTOCOL'] . "\r\n" . 'HTTP_CLIENT_IP: ' . $bpsPro_http_client_ip . "\r\n" . 'HTTP_FORWARDED: ' . $bpsPro_http_forwarded . "\r\n" . 'HTTP_X_FORWARDED_FOR: ' . $bpsPro_http_x_forwarded_for . "\r\n" . 'HTTP_X_CLUSTER_CLIENT_IP: ' . $bpsPro_http_x_cluster_client_ip."\r\n" . 'REQUEST_METHOD: '.$_SERVER['REQUEST_METHOD']."\r\n" . 'HTTP_REFERER: '.$bpsPro_http_referer."\r\n" . 'REQUEST_URI: '.$_SERVER['REQUEST_URI']."\r\n" . 'QUERY_STRING: '.$query_string."\r\n" . 'HTTP_USER_AGENT: '.$bpsPro_http_user_agent."\r\n";
106
107 if ( is_writable( $bpsProLog ) ) {
108
109 if ( ! $handle = fopen( $bpsProLog, 'a' ) ) {
110 exit;
111 }
112
113 if ( fwrite( $handle, $log_contents) === false ) {
114 exit;
115 }
116
117 fclose($handle);
118 }
119 }
120
121 if ( $_SERVER['REQUEST_METHOD'] != 'POST' ) {
122
123 $log_contents = "\r\n" . '[410 Gone GET Request: ' . $timestamp . ']' . "\r\n" . 'BPS: ' . $bps_version . "\r\n" . 'WP: ' . $wp_version . "\r\n" . 'Event Code: ' . $event . "\r\n" . 'Solution: ' . $solution . "\r\n" . 'REMOTE_ADDR: '.$bpsPro_remote_addr . "\r\n" . 'Host Name: ' . $hostname . "\r\n" . 'SERVER_PROTOCOL: ' . $_SERVER['SERVER_PROTOCOL'] . "\r\n" . 'HTTP_CLIENT_IP: ' . $bpsPro_http_client_ip . "\r\n" . 'HTTP_FORWARDED: ' . $bpsPro_http_forwarded . "\r\n" . 'HTTP_X_FORWARDED_FOR: ' . $bpsPro_http_x_forwarded_for . "\r\n" . 'HTTP_X_CLUSTER_CLIENT_IP: ' . $bpsPro_http_x_cluster_client_ip."\r\n" . 'REQUEST_METHOD: '.$_SERVER['REQUEST_METHOD']."\r\n" . 'HTTP_REFERER: '.$bpsPro_http_referer."\r\n" . 'REQUEST_URI: '.$_SERVER['REQUEST_URI']."\r\n" . 'QUERY_STRING: '.$query_string."\r\n" . 'HTTP_USER_AGENT: '.$bpsPro_http_user_agent."\r\n";
124
125 if ( is_writable( $bpsProLog ) ) {
126
127 if ( ! $handle = fopen( $bpsProLog, 'a' ) ) {
128 exit;
129 }
130
131 if ( fwrite( $handle, $log_contents) === false ) {
132 exit;
133 }
134
135 fclose($handle);
136 }
137 }
138
139 ?>
140 </body>
141 </html>
142 <?php ob_end_flush(); ?>