$data[$i][$j]=0,++$i) { for($j=0,$sign[$j] .= $binstr{$base + $i * $column},$rgbarray['green']<125 || $rgbarray['blue'] < 125) { $data[$i][$j]=1 有97%新玩家认为php验证码识别程序()值得一读!

{image}

4条解答

一.php识别验证码

/这个验证码如何使用PHP自动识别并输出文字 在网上找到2个PHP识别程序 但是不会修改里面的代码其中一个显示 不正确 /ceshi/这个地址是我自己传到空间以后 测试的效果 上面输出的文字跟图片对不上 另外一个程序/phpcrash/直接显示错误下面我提供他们的下载地址/:///希望明白的人给于指导我个人感觉应该是程序需要修改设置 但是我看不是很明白里面的代码上面提供的地址是我自己空间的setImage(' /'); //引号内原值为 $valite->getHec();$ert = $valite->run();//$ert = "1234";print_r($ert);echo '
'; //引号内 这个部分我自己修改过 原值为 ?>=================以上代码为 内容===========================ImagePath = $Image; } public function getData() { return $data; } public function getResult() { return $DataArray; } public function getHec() { $res = imagecreatefromjpeg($this->ImagePath); $size = getimagesize($this->ImagePath); $data = array(); for($i=0; $i < $size[1]; ++$i) { for($j=0; $j < $size[0]; ++$j) { $rgb = imagecolorat($res,$j,$i); $rgbarray = imagecolorsforindex($res, $rgb); if($rgbarray['red'] < 125 || $rgbarray['green']<125 || $rgbarray['blue'] < 125) { $data[$i][$j]=1; }else{ $data[$i][$j]=0; } } } $this->DataArray = $data; $this->ImageSize = $size; } public function run() { $result=""; // 查找4个数字 $data = array("","","",""); for($i=0;$i<4;++$i) { $x = ($i*(WORD_WIDTH+WORD_SPACING))+OFFSET_X; $y = OFFSET_Y; for($h = $y; $h < (OFFSET_Y+WORD_HIGHT); ++ $h) { for($w = $x; $w < ($x+WORD_WIDTH); ++$w) { $data[$i].=$this->DataArray[$h][$w]; } } } // 进行关键字匹配 foreach($data as $numKey => $numString) { $max=0.0; $num = 0; foreach($this->Keys as $key => $value) { $percent=0.0; similar_text($value, $numString,$percent); if(intval($percent) > $max) { $max = $percent; $num = $key; if(intval($percent) > 95) break; } } $result.=$num; } $this->data = $result; // 查找最佳匹配数字 return $result; } public function Draw() { for($i=0; $i<$this->ImageSize[1]; ++$i) { for($j=0; $j<$this->ImageSize[0]; ++$j) { echo $this->DataArray[$i][$j]; } echo "\n"; } } public function __construct() { $this->Keys = array( '0'=>'', '1'=>'', '2'=>'', '3'=>'', '4'=>'', '5'=> '', '6'=>'', '7'=>'', '8'=>'', '9'=>'', ); } protected $ImagePath; protected $DataArray; protected $ImageSize; protected $data; protected $Keys; protected $NumStringArray;}?>==============以上内容为 另外一个程序差不多需要的话自己下载看看比较清楚一些吧为什么没人来看啊这个代码获取的不准确啊 。有没有样式希求,没有的话我自己写了一个验证码 。发给你PHP: error_reporting(E_ALL);

class PNG_READER {
var $pngdata;
var $offset;
var $width;
var $height;
var $bitdepth; //bit depth
var $rowbytes;
var $irowbytes;
var $colortype;

var $bmpdata;
var $code = '';

function PNG_READER(&$data)
{
$this->pngdata = $data;
$this->offset = 0;
}

function _read_raw($len)
{
$start = $this->offset;
$this->offset += $len;
return substr($this->pngdata, $start, $len);
}

//return tag name and data
function _read_chunk(&$tag)
{
$chunk = unpack('Nlength', $this->_read_raw(4));
$data = $this->_read_raw($chunk['length'] + 4);
$chunk = unpack('Ncrc', $this->_read_raw(4));
if ($chunk['crc'] !== crc32($data)) {
exit("crc error\n");
}
$tag = substr($data, 0, 4);
return substr($data, 4);
}

function read()
{
$signature = $this->_read_raw(8);
$sign_str = pack('C8', 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A);
if ($signature != $sign_str) {
exit("invalid signature\n");
}
$tag = '';
do {
$data = $this->_read_chunk($tag);
switch($tag) {
case 'IHDR':
$fileheader = unpack('Nwidth/Nheight/Cdepth/Ctype/Ccompression/Cfilter/Cinterlace', $data);
$this->bitdepth = $fileheader['depth']; //2 == 2 palette index ,refrer to PLTE chunk
//the sample depth is always 8 bits.
$this->colortype = $fileheader['type']; //3 == indexed-color
$this->width = $fileheader['width'];
$this->height = $fileheader['height'];
$this->rowbytes = (($fileheader['depth'] * $fileheader['width']) + 7)>> 3;
//$this->row_bytes = ($fileheader['depth'] * $fileheader['width'])>> 3;
break;
case 'IDAT':
$this->irowbytes = $this->rowbytes + 1;
$size = ($this->irowbytes) * $this->height;
$this->bmpdata = gzuncompress($data);
break;
case 'PLET':
break;
default:
break;
}
} while('IEND' !== $tag);
unset($data);
}

function _convert_hex_binstr($hex)
{
$bin['0'] = ' ';
$bin['1'] = ' 1';
$bin['2'] = ' 1 ';
$bin['3'] = ' 11';
$bin['4'] = ' 1 ';
$bin['5'] = ' 1 1';
$bin['6'] = ' 11 ';
$bin['7'] = ' 111';
$bin['8'] = '1 ';
$bin['9'] = '1 1';
$bin['a'] = '1 1 ';
$bin['b'] = '1 11';
$bin['c'] = '11 ';
$bin['d'] = '11 1';
$bin['e'] = '111 ';
$bin['f'] = '1111';
return $bin[$hex];
}

function analyze_row()
{
$binstr = '';
$hexstr = bin2hex($this->bmpdata);
unset($this->bmpdata);
$hexlen = $this->irowbytes * 2;

for ($i = 0; $i <$this->height; $i ++) {
//echo bin2hex(substr($this->bmpdata, $i * $this->irowbytes, $this->irowbytes));
for ($j = 0; $j <$hexlen; $j ++) {
$pos = $hexlen * $i + $j;
$tmpstr = $this->_convert_hex_binstr($hexstr{$pos});
$binstr .= $tmpstr;
//echo $tmpstr;
}
//echo "\n";
}
$this->_reconstruct($binstr, $hexlen*4, $this->height-1);
}

function _reconstruct($binstr, $column, $row)
{
$base = 29;
for ($j = 0; $j <4; $j ++) {
$sign[$j] = '';
for ($i = 9; $i <$row; $i ++) {
$sign[$j] .= $binstr{$base + $i * $column};
}
$base += 14;

$rcode = $this->_convert_signature_to_num($sign[$j]);
if (0 == $rcode) {
$dot = 11 * $column + 29 + 14 * $j;
if ($binstr{$dot+8} == 0) {
$rcode = 6;
}
}
$this->code .= $rcode;
}
}

function _convert_signature_to_num($str)
{
$fingermark[' '] = 0;
$fingermark[' 1 1'] = 1;
$fingermark[' 11 11'] = 2;
$fingermark[' 1 1 '] = 3;
$fingermark[' 11 '] = 4;
$fingermark['1111 1 '] = 5;
$fingermark['1 '] = 7;
$fingermark[' 11 111 '] = 8;
$fingermark[' 111 1 '] = 9;

return $fingermark[$str];
}
}

$filedata = file_get_contents(' /pagemydns/');
$png = & new PNG_READER($filedata);
$png->read();
$png->analyze_row();

print_r($png->code);
echo "\n";

你直接发代码来看.

二.php来自注册验证码判断问题

现在验证的话大多数都是用ajax了。建议去看下这方面的书籍。

三.php注册验证码判断问题

来自 目前验证的话大多数都是用ajax了 。建议去看下这方面的书籍。

四.php怎么识别验证码啊

重点还是在于我们选择发布外链的平 来自 台上 ,选择高质量的、稳定的 、权威的外链平台是非常关键的。

本文版权归去快排wWw.seogUrublog.com 所有,如有转发请注明来出,竞价开户托管,seo优化请联系qq❉61910465