Memnoch Posted January 28, 2008 Posted January 28, 2008 I am a relatively new programmer to PHP and am designing a game based on MCCodes V2. The following script is causing my game to shoot up an error on any page that I display when trying to view my game for testing. Is there a reason why or something I can do to stop it? Notice: Undefined index: HTTP_X_FORWARDED_FOR in D:\domains\blackheartworks.com\wwwroot\anarchystreet\login.php on line 210 Notice: Undefined index: HTTP_X_FORWARDED_FOR in D:\domains\blackheartworks.com\wwwroot\anarchystreet\header.php on line 110 $IP = ($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; Please remember that I am relatively new at PHP.:S Quote
hamster01 Posted January 28, 2008 Posted January 28, 2008 Re: HTTP_X_FORWARDED_FOR' Try putting this somewhere in your script: error_reporting(E_ERROR); Or for debugging purposes, try this on a seperate script, then just post the output. print_r($_SERVER); Or just use HTTP_SEVER_VARS. $IP = ($HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR']) ? $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'] : $HTTP_SERVER_VARS['REMOTE_ADDR']; Just add HTTP_SERVER_VARS as a global when used in functions. Quote
Memnoch Posted January 28, 2008 Author Posted January 28, 2008 Re: HTTP_X_FORWARDED_FOR' Thanks Hamster01. Had to tinker with it a bit but I got it working now. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.