Please use the 'Search' function before asking for help. Guidelines, Tips & Frequently Asked Questions -> 1. GUIDELINES -> 1.6 Search before you post: Before you post a new thread, search the forum. Chances are a similar question has already been answered. It's also expected that you at least do a google search as well. The truth is, people wont help anyone who isn't willing to put at least some effort into the problem they ran into.
If you haven't found your answer... Here you go: <?php $ip = $_SERVER['REMOTE_ADDR']; echo "Your IP: " . $ip; ?> PHP:
i got an full script that i made that dose this i use it to sell products to diffet people on where they live let me now if you need this script as i made this script and it took me time to make maybe we could come up with an price
<?php $img_number = imagecreate(275,25); $backcolor = imagecolorallocate($img_number,102,102,153); $textcolor = imagecolorallocate($img_number,255,255,255); imagefill($img_number,0,0,$backcolor); $number = " Your IP is $_SERVER[REMOTE_ADDR]"; Imagestring($img_number,10,5,5,$number,$textcolor); header("Content-type: image/jpeg"); imagejpeg($img_number); ?>
The idea of having people search for the resolution to their problem themselves is to have them view what others have done, *hopefully* giving them new ideas on what they want to do. <?php if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP"); else if(getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv ("HTTP_X_FORWARDED_FOR"); else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR"); else $ip = "UNKNOWN"; ?> PHP: The above code attempts to find the environment variable via getenv() of the clients IP address, and if not found will try and resolve the forwarded for IP address. Last it checks the remote address if the user is using a proxy.