ip簽名探針_PHP

來源:互聯網
上載者:User
關鍵字 簽名 picture bordercolor Imagel
可以用做簽名,論壇頭像

PHP代碼:--------------------------------------------------------------------------------
/****************************************************
殘風製作ip簽名探針---stormor@163.com
如果有顯示不正確的地方請發E-mail給我,以便修改!
*****************************************************/
Header("Content-type: image/png");

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 = "";
}

if(!$ip_agent){
$wenzi="IP:";
$ip_count=strlen($ip_real);
$left=22;
$width=$ip_count*6+$left+5;
$height=14;
$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);
Imagestring($picture,2,2,0,$wenzi,$fontcolor);
Imagestring($picture,2,$left+2,0,$ip_real,$fontcolor);
Imagepng($picture);
ImageDestroy($picture);
}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);
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);
}

?>

--------------------------------------------------------------------------------
  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.