session_start();

$sessi " /> 7777精品伊人久久久大香线蕉经典版下载,亚洲一区二区偷拍精品,超碰97免费在线

色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

php 數學運算驗證碼實現代碼

復制代碼 代碼如下:
<?php
//-------------------------------------
// 文件說明:數學運算驗證碼
// 文件作者:Jesse Lee
// 最后更新:2008-09-07
//-------------------------------------

session_start();

$sessionvar = 'vdcode'; //Session變量名稱
$width = 150; //圖像寬度
$height = 20; //圖像高度

$operator = '+-*'; //運算符

$code = array();
$code[] = mt_rand(1,9);
$code[] = $operator{mt_rand(0,2)};
$code[] = mt_rand(1,9);
$code[] = $operator{mt_rand(0,2)};
$code[] = mt_rand(1,9);
$codestr = implode('',$code);
eval("/$result = ".implode('',$code).";");
$code[] = '=';

$_SESSION[$sessionvar] = $result;

$img = ImageCreate($width,$height);
ImageColorAllocate($img, mt_rand(230,250), mt_rand(230,250), mt_rand(230,250));
$color = ImageColorAllocate($img, 0, 0, 0);

$offset = 0;
foreach ($code as $char) {
$offset += 20;
$txtcolor = ImageColorAllocate($img, mt_rand(0,255), mt_rand(0,150), mt_rand(0,255));
ImageChar($img, mt_rand(3,5), $offset, mt_rand(1,5), $char, $txtcolor);
}

for ($i=0; $i<100; $i++) {
$pxcolor = ImageColorAllocate($img, mt_rand(0,255), mt_rand(0,255), mt_rand(0,255));
ImageSetPixel($img, mt_rand(0,$width), mt_rand(0,$height), $pxcolor);
}

header('Content-type: image/png');
ImagePng($img);
?>

php技術php 數學運算驗證碼實現代碼,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 通州市| 抚州市| 乃东县| 黄大仙区| 华蓥市| 石狮市| 寿宁县| 彰化市| 阳江市| 汨罗市| 玉田县| 万宁市| 寻乌县| 博白县| 舞阳县| 马公市| 昭平县| 平顺县| 泽州县| 舞钢市| 乐至县| 综艺| 本溪| 沁水县| 射阳县| 佛教| 巴青县| 西宁市| 乐山市| 陆河县| 桃江县| 灵璧县| 博客| 朝阳市| 玛多县| 玉田县| 卢湾区| 西畴县| 鄂伦春自治旗| 酒泉市| 海林市|