Use graphical display IP, file sunip.php
Copy the Code code as follows:
Header ("Content-type:image/gif");
$im = Imagecreate (130,15);
$background _color = imagecolorallocate ($im, 255, 255, 255);
Unset ($IP);
if ($_server[' http_client_ip ']) {
$ip =$_server[' http_client_ip '];
} else if ($_server[' http_x_forwarded_for ']) {
$ip =$_server[' http_x_forwarded_for '];
} else{
$ip =$_server[' remote_addr '];
}//Www.jbxue.com
$col = imagecolorallocate ($im, 0, 51, 102);
Imagestring ($im, 3, 5, 1, $ip, $col);
Imagegif ($im);
Imagedestroy ($im);
?>
1.
2. Header ("Content-type:image/gif");
The second line declares that the browser header output is GIF graphics
3. $im = Imagecreate (130,15);
Create a graphic imagecreate (130,15) in brackets 130, 15 for width and height, respectively
4. $background _color = imagecolorallocate ($im, 255, 255, 255);
Set the background color imagecolorallocate to assign a color to a picture ($im, 255, 255, 255) IM represents the 10 binary characters of the color table ffffff that represent the 3 255 behind the new shape mentioned earlier
5. unset ($IP);
Useless
6.if ($_server[' http_client_ip ')} {
$ip =$_server[' http_client_ip '];
} else if ($_server[' http_x_forwarded_for ']) {
$ip =$_server[' http_x_forwarded_for '];
} else{
$ip =$_server[' remote_addr '];
}
If $_server[' http_client_ip ' can be used then using $_server[' Http_client_ip ') is similar to judging this paragraph to be compatible with a variety of server settings
7. $col = Imagecolorallocate ($im, 0, 51, 102);
Define text color
8. Imagestring ($im, 3, 5, 1, $ip, $col);
The acquired IP is drawn onto the newly created canvas imagestring ($im, 3, 5, 1, $ip, $col); Represents imagestring (graphic representation, character size 1-5,x coordinates, y-coordinate, output IP, color), respectively
9. Imagegif ($im);
Output GIF Graphics
Imagedestroy ($im);
Freeing memory
?>.
End of program
http://www.bkjia.com/PHPjc/718606.html www.bkjia.com true http://www.bkjia.com/PHPjc/718606.html techarticle using the graphical display IP, the file sunip.php copy code code is as follows:? PHP header ("Content-type:image/gif"); $im = Imagecreate (130,15); $background _ color = Imagecolorallocate ($im, 2 ...