<?php
//ç®åéªè¯ç +å¾ç,è°ç¨æ¹æ³<img src='image_s.php'>
session_start();
srand((double)microtime()*1000000);
$authnum=strtoupper(substr(md5(rand()),0,4));
$_SESSION["vcode"]=$authnum;
header("content-type:image/png");
function creat_image($width,$height,$authnum)
{
srand((double)microtime()*1000000);
$im = imagecreate($width,$height);
$red = ImageColorAllocate($im, 2,74,187);
$white = ImageColorAllocate($im, 255,255,255);
$gray = ImageColorAllocate($im, 200,200,200);
imagefill($im,0,0,$gray);
//å°åä½æ´æ°éªè¯ç ç»å
¥å¾ç
imagestring($im, 5,8, 3, $authnum, $red);
for($i=0;$i<150;$i++)
{
$randcolor = ImageColorallocate($im,rand(0,255),rand(0,255),rand(0,255));
imagesetpixel($im, rand()%70 , rand()%30 , $randcolor);
}
ImagePNG($im);
ImageDestroy($im);
}
creat_image(50,20,$authnum);
?>
æèªå·±åç
追é®å¤§å¥ããæ¾ç¤ºè¿æ¯ä¸ä¸ªåååãã
追çgd2.dll è¿ä¸ªå¼å¯ä¹åï¼éå¯æå¡äºåï¼