There is also code below to display the IP signature image in PHP
The code is as follows:
<? Header("Content-type: image/png");
// Note that none of the following supports Chinese unless you write it in utf-8
if(getenv("HTTP_CLIENT_IP")) {
$ip = getenv("HTTP_ CLIENT_IP");
$ip_agent = getenv("REMOTE_ADDR");
} elseif(getenv("HTTP_X_FORWARDED_FOR")) {
$ip_real = getenv("HTTP_X_ FORWARDED_FOR");
$ip_agent = getenv("REMOTE_ADDR");
} else {
$ip_real = getenv("REMOTE_ADDR");
$ip_agent = "";
}
// Above is extracting the real IP of the viewer
$User = getenv("HTTP_USER_AGENT");
if(eregi("Windows[[:space:]]]98",$User)) {
$User_Agent = "Windows 98";
}
elseif (eregi("Win[[:space:]]9x[[:space:]]4.90",$User)) {
$User_Agent = " Windows ME ";
}
elseif (eregi("Windows[[:space:]]NT[[:space:]]5.0",getenv("HTTP_USER_AGENT")) {
$User_Agent = "Windows 2000";
}
elseif (eregi("Windows[[:space:]]NT[[:space:]]5.1",getenv("HTTP_USER_AGENT")) {
$User_Agent = " Windows XP ";
}
elseif (eregi("Windows[[:space:]]NT[[:space:]]5.2",getenv("HTTP_USER_AGENT")) {
$User_Agent = "Windows 2003";
}
elseif ( eregi("Windows[[:space:]]NT",getenv("HTTP_USER_AGENT")) {
$User_Agent = " Windows NT ";
}
elseif (eregi("unix",getenv("HTTP_USER_AGENT")) {
$User_Agent = "Windows NT ";
}
elseif (eregi("unix",getenv( "HTTP_USER_AGENT")) {
$User_Agent = " Unix ";
}
elseif (eregi("Linux",getenv("HTTP_USER_AGENT"))) {
$User_Agent = " Linux ";
}
elseif (eregi("SunOS",getenv("HTTP_USER_AGENT")) {
$User_Agent = " SunOS ";
}
elseif (eregi(" Operating System Information
if (eregi("MSIE[[:space:]]6",getenv("HTTP_USER_AGENT")) {
$ClientInfo = "Microsoft IE 6.0";
}
elseif ( eregi("MSIE[[:space:]]5",getenv("HTTP_USER_AGENT")) {
$ClientInfo = "Microsoft IE 5.0";
}
elseif (eregi("MSIE[[:space :]]4",getenv("HTTP_USER_AGENT"))) {
$ClientInfo = "Microsoft IE 4.0";
}
elseif (eregi("Netscape",getenv("HTTP_USER_ AGENT")) {
$ClientInfo = " Netscape ";
}
elseif (eregi("Opera",getenv("HTTP_USER_AGENT"))) {
$ClientInfo = " Opera " ;
}
else {
$ClientInfo = " Other ";
}
// Above is to get the viewer's IE information$time = date("Y-m-d H:i");
// Above is to get the system time, if you want to Add a second, inside the written Y-m-d H:i:s this you know the English, a look will know how it is.$top = "Your Information:";
//top text
$line = "-----------------";
$info = "Power: SBKCSTUDIO";
$WebInfo = "SBKC .CHXN.COM";
// The above two are copyrighted information, feel free to change them, I don't mind
if(! $ip_agent){
$wenzi="IP:";
$ip_count=strlen($ip_real);
$left=22;
$width=105;
///Image width
$height=100 ;
//Image height
$picture=Imagecreate($width,$height);
$bgcolor=ImageColorAllocate($picture,225,250,225);
///Background color. The first 225 represents red, 250 represents green, 225 represents yellow [three-color principle], get together with a color, this can be adjusted by yourself, the range of 0-255
$bordercolor=ImageColorAllocate($picture,0,0,0);
// border color, same principle as above
// border color, same principle as above
// background color, same principle as above
// background color. color, same principle as above
$f($picture,0,0,0);
//first font color
$fontcolor2=ImageColorAllocate($picture,100,0,255);
//second font color
$fontcolor3=ImageColorAllocate($picture,255,100,100);
//third font color
$origImg = ImageCreateFromPNG("test.png");
/// Background image. Requires that it must be in png format.
ImageCopyResized($picture,$origImg,0,0,0,0,$width,$height,ImageSX($origImg),ImageSY($origImg));
///Compose the code for the background image and the original image
Imageline($picture,0,0,$width-1,0,$bordercolor);
Imageline($picture,0,0,0,$height-1,$bordercolor);
Imageline($picture ,$width-1,$height-1,$width-1,0,$bordercolor);
Imageline($picture,$width-1,$height-1,0,$height-1,$bordercolor);
/// Above is the border Set
Imagestring($picture,2,2,0,$top,$fontcolor3);
Imagestring($picture,2,2,10,$line,$fontcolor);
Imagestring($ picture,2,2,20,$wenzi,$fontcolor);
Imagestring($picture,2,$left+2,20,$ip_real,$fontcolor);
Imagestring($picture,2,14, 32,$User_Agent,$fontcolor);
Imagestring($picture,2,4,44,$ClientInfo,$fontcolor);
Imagestring($picture,2,4,54,$time,$ fontcolor);
Imagestring($picture,2,2,62,$line,$fontcolor);
Imagestring($picture,2,2,72,$info,$fontcolor2);
Imagestring($picture,2,14,84,$WebInfo,$fontcolor2);
// Above is to write the text information to the image, where the meaning of the three numbers is: the first is the font size, the second is the distance from the left side of the image, and the third is the distance from the top.
$wenzi1="IP1:";
$wenzi2="IP2:";
$ip_count1=strlen($ip_real);
$ip_count2=strlen($ip_agent);
$left=26 ;
if($ip_count1>=$ip_count2){$width=$ip_count1*6+$left+5;}else{$width=$ip_count2*6+$left+5;}
$height=29;
$ middle=$height/2+1;
$picture=Imagecreate($width,$height);
$bgcolor=ImageColorAllocate($picture,225,250,225);
$ bordercolor=ImageColorAllocate($picture,0,0,0);
$f($picture,0,0,0);
$fontcolor2=ImageColorAllocate($picture,100,0,255) ;
$fontcolor3=ImageColorAllocate($picture,255,100,100);
$origImg = ImageCreateFromPNG("test.png");
ImageCopyResized($picture,$origImg,0,0,0,0,$width,$height,ImageSX($origImg),ImageSY($origImg));
Imageline($picture,0,0,$ width-1,0,$bordercolor);
Imageline($picture,0,0,0,$height-1,$bordercolor);
Imageline($picture,$width-1,$height-1,$ width-1,0,$bordercolor);
Imageline($picture,$width-1,$height-1,0,$height-1,$bordercolor);
Imageline($picture,$width-1, $middle-1,0,$middle-1,$bordercolor);
Imagestring($picture,2,2,0,$top,$fontcolor3);
Imagestring($picture,2,2,10,$line,$ fontcolor);
Imagestring($picture,2,2,20,$wenzi1,$fontcolor);
Imagestring($picture,2,$left+2,20,$ip_real,$fontcolor); p>
Imagestring($picture,2,2,32,$wenzi2,$fontcolor);
Imagestring($picture,2,$left+2,32,$ip_agent,$fontcolor);
Imagestring($picture,2,14,44,$User_Agent,$fontcolor);
Imagestring($picture,2,4,54,$ClientInfo,$fontcolor);
Imagestring ($picture,2,4,62,$time,$fontcolor);
Imagestring($picture,2,2,72,$line,$fontcolor);
Imagestring($picture,2,2,84,$info,$ .png background image
.