| 1 | <?php if (!defined('BB2_CORE')) die('I said no cheating!'); |
| 2 | |
| 3 | // Functions called when a request has been denied |
| 4 | // This part can be gawd-awful slow, doesn't matter :) |
| 5 | |
| 6 | require_once(BB2_CORE . "/responses.inc.php"); |
| 7 | |
| 8 | function bb2_display_denial($settings, $key, $previous_key = false) |
| 9 | { |
| 10 | if (!$previous_key) $previous_key = $key; |
| 11 | if ($key == "e87553e1") { |
| 12 | // FIXME: lookup the real key |
| 13 | } |
| 14 | // Create support key |
| 15 | $ip = explode(".", $_SERVER['REMOTE_ADDR']); |
| 16 | $ip_hex = ""; |
| 17 | foreach ($ip as $octet) { |
| 18 | $ip_hex .= str_pad(dechex($octet), 2, 0, STR_PAD_LEFT); |
| 19 | } |
| 20 | $support_key = implode("-", str_split("$ip_hex$key", 4)); |
| 21 | |
| 22 | // Get response data |
| 23 | $response = bb2_get_response($previous_key); |
| 24 | header("HTTP/1.1 " . $response['response'] . " Bad Behavior"); |
| 25 | header("Status: " . $response['response'] . " Bad Behavior"); |
| 26 | ?> |
| 27 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 28 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 29 | <head> |
| 30 | <title>HTTP Error <?php echo $response['response']; ?></title> |
| 31 | </head> |
| 32 | <body> |
| 33 | <h1>Error <?php echo $response['response']; ?></h1> |
| 34 | <p>We're sorry, but we could not fulfill your request for |
| 35 | <?php echo htmlspecialchars($_SERVER['REQUEST_URI']) ?> on this server.</p> |
| 36 | <p><?php echo $response['explanation']; ?></p> |
| 37 | <p>Your technical support key is: <strong><?php echo $support_key; ?></strong></p> |
| 38 | <p>You can use this key to <a href="http://www.ioerror.us/bb2-support-key?key=<?php echo $support_key; ?>">fix this problem yourself</a>.</p> |
| 39 | <p>If you are unable to fix the problem yourself, please contact <a href="mailto:<?php echo htmlspecialchars(str_replace("@", "+nospam@nospam.", bb2_email())); ?>"><?php echo htmlspecialchars(str_replace("@", " at ", bb2_email())); ?></a> and be sure to provide the technical support key shown above.</p> |
| 40 | <?php |
| 41 | } |
| 42 | |
| 43 | function bb2_log_denial($settings, $package, $key, $previous_key=false) |
| 44 | { |
| 45 | if (!$settings['logging']) return; |
| 46 | bb2_db_query(bb2_insert($settings, $package, $key)); |
| 47 | } |
| 48 | |
| 49 | ?> |
| 50 | |