论坛签名如何显示对方信息?
还有PHP显示IP签名图片的代码。
代码如下:
& lt?头(" Content-type:image/png ");
//注意,下面的内容没有一个支持中文的,除非你用utf-8写。
if(getenv(" HTTP _ CLIENT _ IP "){
$ IP = getenv(" HTTP _ CLIENT _ IP ");
$ip_agent = getenv("远程_ ADDR ");
} else if(getenv(" HTTP _ X _ FORWARDED _ FOR "){
$ IP _ real = getenv(" HTTP _ X _ FORWARDED _ FOR ");
$ip_agent = getenv("远程_ ADDR ");
}否则{
$ip_real = getenv("远程_ ADDR ");
$ ip _ agent =
}
//以上是提取浏览器的真实IP。
$ User = getenv(" HTTP _ User _ AGENT ");
if(eregi("Windows[[:space:]]98 ",$User)) {
$ User _ Agent = " Windows 98
}
else if(eregi(" Win[[:space:]]9x[[:space:]]4.90 ",$User)) {
$ User _ Agent = " Windows ME
}
else if(eregi(" Windows[[:space:]]NT[[:space:]]5.0 ",getenv(" HTTP _ USER _ AGENT ")){
$ User _ Agent = " Windows 2000
}
else if(eregi(" Windows[[:space:]]NT[[:space:]]5.1 ",getenv(" HTTP _ USER _ AGENT ")){
$ User _ Agent = " Windows XP
}
else if(eregi(" Windows[[:space:]]NT[[:space:]]5.2 ",getenv(" HTTP _ USER _ AGENT ")){
$ User _ Agent = " Windows 2003
}
else if(eregi(" Windows[[:space:]]NT ",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("BSD ",getenv(" HTTP _ USER _ AGENT ")){
$ User _ Agent = " BSD
}
否则{
$ User _ Agent = " Other
}
//以上是获取浏览器的操作系统的信息。
if (eregi("MSIE[[:space:]]6 ",getenv(" HTTP _ USER _ AGENT ")){
$ClientInfo = "微软IE 6.0 ";
}
elseif (eregi("MSIE[[:space:]]5 ",getenv(" HTTP _ USER _ AGENT ")){
$ClientInfo = "微软IE 5.0 ";
}
elseif (eregi("MSIE[[:space:]]4 ",getenv(" HTTP _ USER _ AGENT ")){
$ClientInfo = "微软IE 4.0 ";
}
elseif (eregi("Netscape ",getenv(" HTTP _ USER _ AGENT ")){
$ ClientInfo = " Netscape
}
elseif (eregi("Opera ",getenv(" HTTP _ USER _ AGENT ")){
$ ClientInfo = " Opera
}
否则{
$ ClientInfo = " Other
}
//以上是获取浏览器的IE信息。
$ time = date(" Y-m-d H:I ");
//以上是获取系统时间。如果要加一秒的话,就写成Y-m-d H:i:s,你懂的英文,一看就知道是怎么回事了。
$top = "您的信息:";
//顶部文本
$ line = "-";
$ info = " Power:SBKCSTUDIO ";
$WebInfo = "SBKC。CHXN . COM ";
//以上两个是版权信息。你可以随意改变它们。我不介意。
如果(!$ip_agent){
$文子= " IP:";
$ IP _ count = strlen($ IP _ real);
$ left = 22
$ width = 105;
//图像宽度
$ height = 100;
//图像高度
$picture=Imagecreate($width,$ height);
$ bgcolor = imagecolorlallocate($ picture,225,250,225);
//背景色,前225代表红色,250代表绿色,225代表黄色【三色原理】。凑在一起可以搭配一个颜色。这个可以自己调整,从0到255不等。
$ border color = imagecolorlallocate($ picture,0,0,0);
//边框颜色,原理同上
$ f($图片,0,0,0);
//第一种字体颜色
$ font color 2 = imagecolorlallocate($ picture,100,0,255);
//第二种字体颜色
$ font color 3 = imagecolorloculate($图片,255,100,100);
//第三种字体颜色
$ orig img = ImageCreateFromPNG(" test . png ");
//背景图像必须是png格式。
imagecopyrefized($ picture,$origImg,0,0,0,$width,$height,ImageSX($origImg),ImageSY($ origImg));
//将背景图和原图合成代码。
Imageline($picture,0,0,$width-1,0,$ border color);
Imageline($picture,0,0,0,$height-1,$ border color);
imageline($图片,$width-1,$height-1,$width-1,0,$ border color);
imageline($图片,$width-1,$height-1,0,$height-1,$ border color);
//以上是边框设置。
Imagestring($picture,2,2,0,$top,$ font color 3);
Imagestring($picture,2,2,10,$line,$ font color);
image string($图片,2,2,20,$文子,$ font color);
Imagestring($picture,2,$left+2,20,$ip_real,$ font color);
Imagestring($picture,2,14,32,$User_Agent,$ font color);
Imagestring($picture,2,4,44,$ClientInfo,$ font color);
Imagestring($picture,2,4,54,$time,$ font color);
Imagestring($picture,2,2,62,$line,$ font color);
Imagestring($picture,2,2,72,$info,$ font color 2);
Imagestring($picture,2,14,84,$WebInfo,$ font color 2);
//以上是将文字信息写入图片,其中三个数字的意思是:第一个是字号,第二个是距图片左侧的距离,第三个是距顶部的距离。
imagepng($图片);
//合成图像
image destroy($图片);
//销毁图像流,释放内存。
}
//以上是获取单个IP时的代码。
否则{
$ wenzi 1 = " IP1:";
$ wenzi 2 = " IP2:";
$ IP _ count 1 = strlen($ IP _ real);
$ IP _ count 2 = strlen($ IP _ agent);
$ left = 26
if($ IP _ count 1 & gt;= $ IP _ count 2){ $ width = $ IP _ count 1 * 6+$ left+5;} else { $ width = $ IP _ count 2 * 6+$ left+5;}
$ height = 29
$ middle = $ height/2+1;
$picture=Imagecreate($width,$ height);
$ bgcolor = imagecolorlallocate($ picture,225,250,225);
$ border color = imagecolorlallocate($ picture,0,0,0);
$ f($图片,0,0,0);
$ font color 2 = imagecolorlallocate($ picture,100,0,255);
$ font color 3 = imagecolorloculate($图片,255,100,100);
$ orig img = ImageCreateFromPNG(" test . png ");
imagecopyrefized($ picture,$origImg,0,0,0,$width,$height,ImageSX($origImg),ImageSY($ origImg));
Imageline($picture,0,0,$width-1,0,$ border color);
Imageline($picture,0,0,0,$height-1,$ border color);
imageline($图片,$width-1,$height-1,$width-1,0,$ border color);
imageline($图片,$width-1,$height-1,0,$height-1,$ border color);
imageline($图片,$width-1,$middle-1,0,$middle-1,$ border color);
Imagestring($picture,2,2,0,$top,$ font color 3);
Imagestring($picture,2,2,10,$line,$ font color);
Imagestring($picture,2,2,20,$wenzi1,$ font color);
Imagestring($picture,2,$left+2,20,$ip_real,$ font color);
Imagestring($picture,2,2,32,$wenzi2,$ font color);
Imagestring($picture,2,$left+2,32,$ip_agent,$ font color);
Imagestring($picture,2,14,44,$User_Agent,$ font color);
Imagestring($picture,2,4,54,$ClientInfo,$ font color);
Imagestring($picture,2,4,62,$time,$ font color);
Imagestring($picture,2,2,72,$line,$ font color);
Imagestring($picture,2,2,84,$info,$ font color 2);
imagepng($图片);
image destroy($图片);
}
//以上代码是针对多个IP地址的,原理和单个IP的一样。
& gt
你还需要一张test.png的背景图片。