PHP显示IP的原理[转帖]

作者 TombCrow, 2004 七月 23, 21:40:37

« 上一篇主题 - 下一篇主题 »

TombCrow

jackie发表于蓝色魔法论坛

很多朋友问我的显IP签名是怎么搞出来的,其实就是一段PHP代码,以下这段代码就是网友sron的作品,当然你也可以随你喜好修改一下。

PHP代码:--------------------------------------------------------------------------------


=$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);
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,$wenzi1,$fontcolor);
Imagestring($picture,2,$left+2,0,$ip_real,$fontcolor);
Imagestring($picture,2,2,$middle,$wenzi2,$fontcolor);
Imagestring($picture,2,$left+2,$middle,$ip_agent,$fontcolor);
Imagepng($picture);
ImageDestroy($picture);
}

?>


————————————————————————————————————————
把以上这段代码保存为PHP格式,然后上传到支持PHP的空间里。
在你的签名里用链接图片(就是[IMG])的方式链接就OK了。



astronomer


TombCrow