SHARE
TWEET

[PHP] Cloudflare Real Vistor IP - Patch

Mayur_Pipaliya Mar 19th, 2014 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. error_reporting(0);
  4. ini_set('display_errors', '0');
  5.  
  6. if( $_SERVER["HTTP_X_FORWARDED_FOR"] != null)
  7. {
  8.         $__REMOTE_ADDR = $_SERVER["HTTP_X_FORWARDED_FOR"];
  9.         putenv("REMOTE_ADDR=$__REMOTE_ADDR");
  10.         $_ENV["REMOTE_ADDR"] = $__REMOTE_ADDR;
  11.         $_SERVER["REMOTE_ADDR"] = $__REMOTE_ADDR;
  12. }      
  13.  
  14. if( $_SERVER["HTTP_CF_CONNECTING_IP"] != null)
  15. {
  16.         $__REMOTE_ADDR = $_SERVER["HTTP_CF_CONNECTING_IP"];
  17.         putenv("REMOTE_ADDR=$__REMOTE_ADDR");
  18.         $_ENV["REMOTE_ADDR"] = $__REMOTE_ADDR;
  19.         $_SERVER["REMOTE_ADDR"] = $__REMOTE_ADDR;
  20. }      
  21.  
  22. if( $_SERVER["HTTP_X_REAL_IP"] != null)
  23. {
  24.         $__REMOTE_ADDR = $_SERVER["HTTP_X_REAL_IP"];
  25.         putenv("REMOTE_ADDR=$__REMOTE_ADDR");
  26.         $_ENV["REMOTE_ADDR"] = $__REMOTE_ADDR;
  27.         $_SERVER["REMOTE_ADDR"] = $__REMOTE_ADDR;
  28. }      
  29.  
  30. ?>
RAW Paste Data
Top