一個用圖片顯示來訪者ip的例子

    Header("Content-type: image/PNG"); 
    $myip=$REMOTE_ADDR;
    $im = imagecreate(158,35); 
    $bkg = ImageColorAllocate($im, 128,128,128 ); //背景色
    $red = ImageColorAllocate($im, 204,204,204 ); //紅色
    $blue = ImageColorAllocate($im, 255,255,255 ); //藍色
    for ($i = 0; $i < strlen($myip); $i++) {
    imagestring($im, 3, $i*10+5, 0, substr($myip,$i,1), $blue);//ImageColorAllocate($im,rand(5, 255),rand(5, 255),rand(5, 255))改成這樣就成了隨機色
    }
    imagestring($im,3,5,10,"--------------------",$red);
    imagestring($im,3,20,20,"Designed By Arcow",$red);
    ImagePNG($im); 
    ImageDestroy($im); 
    ?>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章