Jump to content
php.lv forumi

Nestrādā capcha


kalabox

Recommended Posts

Sveiki, nevaru ierubiities, kaut kas ar serveri laikam, uzliku lapu uz jauna hosta, un nestraada capcha, luuk kods

 

antirobot.php

<?

$wdth=160;
$hght=60;
$cch=4;
$font='../images/bent_titul.ttf';
$alpha_bg=120;
$fontsize=8;
$let=array('1','2','3','4','5','6','7','8','9','0');
session_start();
$host=parse_url(@$_SERVER['HTTP_REFERER']);
if(@$host['host']!=@$_SERVER['HTTP_HOST']){header('HTTP/1.0 404 Not Found');die();}
$fntsz=intval($hght/(($hght/$wdth)*$fontsize));$cc=array();
$src=imagecreatetruecolor($wdth,$hght);$fon=imagecolorallocate($src,255,255,255);imagefill($src,0,0,$fon);
for($i=0;$i<$cch;$i++){$hw=1;$color=imagecolorallocatealpha($src,0,0,0,75);$letter=$let[rand(0,sizeof($let)-1)];
$size=rand($fntsz*2.1-1,$fntsz*2.1+1);
$x=(empty($x)) ? $wdth*0.08 : $x+($wdth*0.8)/$cch+rand(0,$wdth*0.01);
$y=($hw==rand(1,2))?(($hght*1.15*3)/4)+ rand(0,$hght*0.02):(($hght*1.15*3)/4)- rand(0,$hght*0.02);
$angle=rand(20,40);$cc[]=$letter;
if($hw==rand(1,2))$angle=rand(355,340);imagettftext($src,$size,$angle,$x,$y,$color,$font,$letter);
}
$_SESSION['securityCode']=implode('',$cc);$timemodified=time();
header('ETag: "'.md5($timemodified).'"');
header('Last-Modified: '.gmdate("D, d M Y H:i:s",$timemodified).' GMT');
header('Expires: Fri, 22 May 2009 14:37:18 GMT');
header('Cache-Control: no-cache');
header('Pragma: no-cache');
header("Content-type: image/GIF");
imagejpeg($src);imagedestroy($src);
?>

 

htacesaa man ir taads kods

RewriteRule code.GIF core/antirobot.php

 

un kur tiek izvadiits capcha ir taads kods

 

<a href=\"#\" onclick=\"document.getElementById('hello_bot').src='code.GIF?'+Math.random();return false;\">".$lang[2031]."</a>)<br /><br />


<img alt=\"".$lang[203]."\" id=\"hello_bot\" src=\"code.GIF?".microtime()."\" />

Link to comment
Share on other sites

atverot antirobot.php izmet tādu kļūdu

Fatal error: Call to undefined function imagettftext() in /home/kalaboxs/public_html/core/antirobot.php on line 19

 

Hostam laikam nav freetypes uzinstaleets?

 

jaameiko uz imagestring

Edited by kalabox
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...