Exemple #1
0
 /**
  * Change the HTTP header to retrieve the real IP address.
  *
  * @param  string $header Valid HTTP header name.
  * @return void
  */
 public static function setAddrHeader($header = 'REMOTE_ADDR')
 {
     $header = strtoupper($header);
     $allowed = SucuriScan::allowedHttpHeaders(true);
     if (array_key_exists($header, $allowed)) {
         $message = 'HTTP header was set to <code>' . $header . '</code>';
         self::update_option(':addr_header', $header);
         SucuriScanEvent::report_info_event($message);
         SucuriScanEvent::notify_event('plugin_change', $message);
         SucuriScanInterface::info($message);
     } else {
         SucuriScanInterface::error('HTTP header is not in the allowed list');
     }
 }