西宫太子东宫妃:求助!IP签名图片详细生成原理

来源:百度文库 编辑:高校问答 时间:2024/05/08 07:58:09
我要的是IP签名图片详细生成原理,不是去那里申请。就是生成的代码!

论坛代码签名显ip

论坛里某人的显IP签名搞得几位兄弟姐妹不爽,我也来说明哈。
那幅图片是个签名,称为显IP签名,其实它并不是个图片,而是一段代码,可以识别浏览者的IP信息,操作系统、端口等。
不是签名的本人知道,而是只有你自己看到的是自己的IP,也就是说,我看他的签名的时候显示的是我的IP,你看的时候显示的是你的。我不可能看到别人的IP信息的.
想拥有显目的地论坛签名,让访问者都能注意到你的签名档吗,签名显示IP是个不错的选择,其实非常简单,你只需要把下面网站中的代码复制粘贴到论坛的签名档中就可以了。

可以在这里找到的 http://www.hotik.com/

如图所示:
http://www.hotik.com/sign.png

http://www.myelogo.com/elogo_user/1.jpg

还可以用以下的网站中的软件来显示IP地址的

http://www.21tx.com/src/2005/08/04/11096.html

以下还有PHP显示IP签名图片的代码

代码如下:

<? Header("Content-type: image/png");
//注意以下内容都不支持中文,除非你用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 = "";
}
//以上为提取浏览者的真实IP
$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 = " 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 ";
}
else {
$User_Agent = " Other ";
}
//以上为获取浏览者操作系统信息
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 ";
}
//以上为获取浏览者IE信息
$time = date("Y-m-d H:i");
//以上为获取系统时间,如果要加个秒,里面的写成Y-m-d H:i:s这个你英语知道的,一看便知道怎么回事了。
$top = "Your Information:";
//顶部文字
$line = "-----------------";
$info = "Power: SBKCSTUDIO";
$WebInfo = "SBKC.CHXN.COM";
//上面两个为版权信息,随便你改,我不介意的
if(!$ip_agent){
$wenzi="IP:";
$ip_count=strlen($ip_real);
$left=22;
$width=105;
//图像宽度
$height=100;
//图像高度
$picture=Imagecreate($width,$height);
$bgcolor=ImageColorAllocate($picture,225,250,225);
//背景颜色,第一个225表示的是红色,250代表绿色,225代表黄色[三色原理],弄在一起就搭配出一种颜色来,这个可以自己调,范围0-255
$bordercolor=ImageColorAllocate($picture,0,0,0);
//边框颜色,原理同上
$fontcolor=ImageColorAllocate($picture,0,0,0);
//第一种字体颜色
$fontcolor2=ImageColorAllocate($picture,100,0,255);
//第二种字体颜色
$fontcolor3=ImageColorAllocate($picture,255,100,100);
//第三种字体颜色
$origImg = ImageCreateFromPNG("test.png");
//背景图像,要求必须用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);
//以上为边框设置
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);
//以上是将文字信息写到图片中去,其中的三个数字的含义为:第一个为字体大小,第二个为离图像左边的距离,第三个为离顶部的距离。
Imagepng($picture);
//合成图像
ImageDestroy($picture);
//破坏图像流,释放内存
}
//以上为获取单个IP时的代码
else{
$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);
$fontcolor=ImageColorAllocate($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);
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,$fontcolor2);
Imagepng($picture);
ImageDestroy($picture);
}
//以上为多个IP地址的代码,原理同单个IP的
?>

还需要一个test.png的背景图片
参考资料:http://www.21tx.com/src/2005/08/04/11096.html