SEO Forums


Chess, Go & Poker Server









                                          
User   Password   remember   (register)  ?

Free captcha script


Vous suivez la philosophie et la politique sur Facebook ou Twitter ?
     
     

Back to php.


*captcha    (2008-12-12)
Free captcha script


Hi,

Here is a very nice captcha script (french comments) that you can use with a function. You just have to place a file captcha.ttf with characters in the same folder :


<?php


function captcha($code)
{

/************************************************** Configuration **************************************************/

// Attention, le code est fait pour un code de 5 caractères (pas de minuscules)

$startOffset = 10; // offset de départ sur l'image (en pixels)
$size_min = 35; // taille minimum des caractères
$size_max = 60; // taille maximum des caractères
$angle_min = 0; // angle minimum d'inclinaison des caractères
$angle_max = 20; // angle maximum d'inclinaison des caractères
$width = 201; // largeur de l'image
$height = 71; // hauteur de l'image
$addBlur = true; // ajouter un floutage au code
$blurLevel = 1; // niveau de floutage (entre 1 et 10 / 1 ou 2 conseillé après ça forme une bande autour des caractères)
$policePath =  dirname(__FILE__).DIRECTORY_SEPARATOR.'captcha.ttf'; // chemin de la police à utiliser

/********************************************* Ne rien toucher au dela *********************************************/

// création de l'image contenant le code
$_charsImgHandler = imagecreatetruecolor($width,$height) OR exit('please activate GD lib');
$white = imagecolorallocate($_charsImgHandler, 255, 255, 255);
imagefill($_charsImgHandler, 0, 0,$white);

// on prépare et on copie le code en session et sur l'image
$i = -1;
$pos_x = $startOffset;
$cnt = strlen($code)-1;

while(++$i<=$cnt)
{
$char = $code[$i];
$color = imagecolorallocate($_charsImgHandler,mt_rand(0,200),mt_rand(0,200),mt_rand(0,200));
$size =  mt_rand($size_min, $size_max);
$pos_y = mt_rand($size, $height-3);
imagettftext($_charsImgHandler, $size, mt_rand($angle_min,$angle_max), $pos_x, $pos_y, $color, $policePath, $char);
$pos_x += 35;
}

/* on choisi et on applique l'effet brouillant */
switch(mt_rand(0,4))
{
/* effet de dispersion */
case 0:
$x = -1;
while(++$x<$width)
{
$y = -1;
while(++$y<$height)
{
$dispx = 1/(mt_rand(0,1) ? mt_rand(-2,-5) : mt_rand(2,5));
$dispy = 1/(mt_rand(0,1) ? mt_rand(-2,-5) : mt_rand(2,5));

if (($x + $dispx >= $width) ||
($y + $dispy >= $height) ||
($x + $dispx < 0) ||
($y + $dispy < 0))
continue;

$oldcol = imagecolorat($_charsImgHandler, $x, $y);
$newcol = imagecolorat($_charsImgHandler, $x + $dispx, $y + $dispy);
imagesetpixel($_charsImgHandler, $x, $y, $newcol);
imagesetpixel($_charsImgHandler, $x + $dispx, $y + $dispy, $oldcol);
}
}
break;

/* effet de cryptage */
case 1:
$ystop = $height-3;
$y = -1;

while(++$y<$ystop)
{
$j = $y+mt_rand()%3;
$x = -1;

while(++$x<$width)
{
$pixel = @imagecolorat($_charsImgHandler, $x, $y);
$rgb = array( 'red' => ($pixel >> 16) & 0xFF, 'green' => ($pixel >> 8) & 0xFF, 'blue' => $pixel & 0xFF);
$pixel = @imagecolorat($_charsImgHandler, $x, $j);
$rgb2 = array( 'red' => ($pixel >> 16) & 0xFF, 'green' => ($pixel >> 8) & 0xFF, 'blue' => $pixel & 0xFF);

$tmp = $rgb2['red'];
$rgb2['red'] = $rgb['red'];
$rgb['red'] = $tmp;

$tmp = $rgb2['green'];
$rgb2['green'] = $rgb['green'];
$rgb['green'] = $tmp;

$tmp = $rgb2['blue'];
$rgb2['blue'] = $rgb['blue'];
$rgb['blue'] = $tmp;

imagesetpixel($_charsImgHandler,$x,$y,imagecolorallocate($_charsImgHandler,$rgb['red'],$rgb['green'],$rgb['blue']));
imagesetpixel($_charsImgHandler,$x,$j,imagecolorallocate($_charsImgHandler,$rgb2['red'],$rgb2['green'],$rgb2['blue']));
}
}
break;

/* vagues horizontales */
case 2:
$_tempImg = imagecreatetruecolor($width,$height);
imagefill($_tempImg,0,0,$white);
$up = true;
$offset = 0;
$stop = $width-3;

for($y=0;$y<$height;++$y)
{
if($up === true)
$offset++;
else

$offset--;

for($x=3;$x<$stop;++$x)
{
$color = @imagecolorat($_charsImgHandler, $x, $y);
imagesetpixel($_tempImg,$x+$offset,$y, $color ? $color : $white);
}

if($offset === 3)
$up = false;
elseif(empty($offset))
$up = true;
}
imagedestroy($_charsImgHandler);
$_charsImgHandler = $_tempImg;
break;

/* vagues verticales */
case 3:
$_tempImg = imagecreatetruecolor($width,$height);
imagefill($_tempImg,0,0,$white);
$up = true;
$offset = 0;
$stop = $height-3;

for($x=0;$x<$width;++$x)
{
if($up === true)
$offset++;
else
$offset--;

for($y=3;$y<$stop;++$y)
{
$color = @imagecolorat($_charsImgHandler, $x+$offset, $y);
imagesetpixel($_tempImg,$x,$y, $color ? $color : $white);
}

if($offset === 3)
$up = false;
elseif(empty($offset))
$up = true;
}
imagedestroy($_charsImgHandler);
$_charsImgHandler = $_tempImg;
break;

/* effet fish eye */
default:
$_tempImg = imagecreatetruecolor($width,$height);
imageFill($_tempImg,0,0,$white);
$xmid = (int)($width/2);
$ymid = (int)($height/2);
$start = (int)sqrt((float)($xmid*$xmid+$ymid*$ymid));

$x = -1;
while(++$x<$width)
{
$y = -1;
while(++$y<$height)
{
$nx = $xmid-$x;
$ny = $ymid-$y;
$radius = sqrt((float)($nx*$nx+$ny*$ny));

if($radius < $start)
{
$angle = atan2((double)$ny,(double)$nx);
$rnew = ($radius*$radius/$start);
$nx = $xmid + (int)($rnew * cos($angle));
$ny = $y;

$nx = max(0,min($nx,$width));
$ny = max(0,min($ny,$height));

if(false === ($color = @imagecolorat($_charsImgHandler, $nx, $ny)))
$color = $white;
}
else $color = $white;

imagesetpixel($_tempImg, $x, $y, $color);
}
}

imagedestroy($_charsImgHandler);
$_charsImgHandler = imagecreatetruecolor($width, $height);

for ($x=0;$x<$width;$x++)
imagecopy($_charsImgHandler,$_tempImg, $x, 0, $width - $x - 1, 0, 1, $height);

imagedestroy($_tempImg);
}

if($addBlur === true)
{
if($blurLevel < 1)
$blurLevel = 1;
elseif($blurLevel > 10)
$blurLevel = 10;

$coeffs = array (
array ( 1),
array ( 1,  1),
array ( 1,  2,  1),
array ( 1,  3,  3,  1),
array ( 1,  4,  6,  4,  1),
array ( 1,  5, 10,  10,  5,  1),
array ( 1,  6, 15,  20,  15,  6,  1),
array ( 1,  7, 21,  35,  35,  21,  7,  1),
array ( 1,  8, 28,  56,  70,  56,  28,  8,  1),
array ( 1,  9, 36,  84, 126, 126,  84,  36,  9,  1),
array ( 1, 10, 45, 120, 210, 252, 210, 120,  45, 10,  1)
);

$sum = pow(2, $blurLevel);
$temp1 = imagecreatetruecolor($width, $height);
$temp2 = imagecreatetruecolor($width, $height);
imagecopy($temp2,$_charsImgHandler,0,0,0,0,$width,$height);

$y = -1;
while(++$y<=$height)
{
$x = -1;
while(++$x<=$width)
{
$sumr = 0;
$sumg = 0;
$sumb = 0;
$k = -1;

while(++$k<=$blurLevel)
{
$color = @imagecolorat($_charsImgHandler,($x-(($blurLevel)/2)+$k), $y);
$sumr += (($color >> 16) & 0xFF) * $coeffs[$blurLevel][$k];
$sumg += (($color >> 8) & 0xFF) * $coeffs[$blurLevel][$k];
$sumb += ($color & 0xFF) * $coeffs[$blurLevel][$k];
}

$color = imagecolorallocate ($temp1,($sumr/$sum),($sumg/$sum),($sumb/$sum));
imagesetpixel($temp1,$x,$y,$color);
}
}

imagedestroy($_charsImgHandler);
$_charsImgHandler = $temp2;

for($x=0;$x<$width;++$x)
{
for($y=0;$y<$height;++$y)
{
$sumr=0; $sumg=0; $sumb=0;

for($k=0;$k<=$blurLevel;++$k)
{
$color = @imagecolorat($temp1, $x,($y-(($blurLevel)/2)+$k));
$sumr += (($color >> 16) & 0xFF) * $coeffs[$blurLevel][$k];
$sumg += (($color >> 8) & 0xFF) * $coeffs[$blurLevel][$k];
$sumb += ($color & 0xFF) * $coeffs[$blurLevel][$k];
}

$color = imagecolorallocate ($_charsImgHandler,($sumr/$sum),($sumg/$sum),($sumb/$sum));
imagesetpixel($_charsImgHandler,$x,$y,$color);
}
}

imagedestroy($temp1);
}


// on rend transparent le fond de l'image contenant les caractères
imagecolortransparent($_charsImgHandler,$white);

// création image de fond
$_bgImgHandler = imagecreatetruecolor($width,$height);
imagefill($_bgImgHandler, 0, 0,$white);

// choix de la couleur des lignes et du type de quadrillage
$line = imagecolorallocate($_bgImgHandler,mt_rand(200,230),mt_rand(200,230),mt_rand(200,230));
$lineType = mt_rand(0,11);

switch($lineType)
{
/* Lignes et grilles "normales" */
case 0:
case 1:
case 2:
if($lineType !== 0) // ligne horizontales ou grille
{
for($y=0;$y<$height;$y+=5)
imageline( $_bgImgHandler, 0, $y, $width, $y,$line);
}
if($lineType !== 1) // ligne verticales ou grille
{
for($y=0;$y<$width;$y+=5)
imageline( $_bgImgHandler, $y, 0, $y, $width, $line);
}
break;

/* éventails */
case 3:
case 4:
case 5:
if($lineType !== 3) // eventail horizontal ou en grille
{
for($y=0,$z=0; $y<$width; ++$y,$z+=5)
imageline( $_bgImgHandler, $width*2, 0, 0, $z, $line);
}
if($lineType !== 4) // eventail vertical ou en grille
{
for($y=0,$z=0; $y<$height; ++$y,$z+=5)
imageline( $_bgImgHandler, 0, $width, $z, 0, $line);
}
break;

/* effet "matrix" */
case 6:
for($x=0;$x<$width;$x+=mt_rand(1,4))
{
for($y=0;$y<$height;$y+=mt_rand(1,4))
imagesetpixel( $_charsImgHandler, $x, $y, $line);
}
break;

/* grille de points */
case 7:
for($x=0;$x<$width;$x+=2)
{
for($y=0;$y<$height;$y+=2)
imagesetpixel( $_charsImgHandler, $x, $y, $line);
}
break;

/* autre grille de points */
case 8:
for($x=0;$x<$width;$x+=3)
{
for($y=0;$y<$height;$y+=2)
imagesetpixel( $_charsImgHandler, $x, $y, $line);
}
break;

/* vaguelettes horizontales */
case 9:
$up = true;
$offset = 0;

for($y=0;$y<$height;$y+=5)
{
for($x=0;$x<$width;++$x)
{
if($up === true)
$offset++;
else
$offset--;

imagesetpixel( $_bgImgHandler, $x, $y+$offset, $line);

if($offset === 3)
$up = false;
elseif(empty($offset))
$up = true;
}
}
break;

/* vaguelettes verticales */
case 10:
$up = true;
$offset = 0;

for($x=0;$x<$width;$x+=5)
{
for($y=0;$y<$height;++$y)
{
if($up === true)
$offset++;
else
$offset--;

imagesetpixel( $_bgImgHandler, $x+$offset, $y, $line);

if($offset === 3)
$up = false;
elseif(empty($offset))
$up = true;
}
}
break;

/* grille irrégulière */
default:
for($y=0;$y<$height;$y+=mt_rand(2,5))
imageline( $_bgImgHandler, 0, $y, $width, $y,$line);

for($y=0;$y<$width;$y+=mt_rand(2,5))
imageline( $_bgImgHandler, $y, 0, $y, $width, $line);
}

// fusion du code et du fond
imagecopymerge($_bgImgHandler, $_charsImgHandler, 0, 0, 0, 0, $width, $height,100);
imagedestroy($_charsImgHandler);

// on affiche
header('Pragma: no-cache');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: private',false);
header ('Content-type: image/gif');
imagegif($_bgImgHandler);

}


?>




(more options below)

*fanasi    (2010-06-23 15:40:25)
Free captcha script

Thanks. Now I use a php form that includes captcha. Nevertheless it can be useful for me in future


Voir aussi


ficgs
Plus de sources

Vous devez vous enregistrer pour consulter ces sources, vous pourrez alors changer leur ordre en cliquant sur les icones les précédant.



admin
Autres sources

Ce projet est collaboratif, vous pouvez remonter les sources suivantes dans la liste si vous les trouvez utiles.


 Securimage PHP CAPTCHA - Free PHP *
phpcaptcha

 Free PHP * s (thefreecountry.com)
thefreecountry > php/captcha.shtml

Should You Choose a Linux or a Windows Web Hosting Package? Is There...
How to Add Google Advertisements (Google AdSense) to Your Blog or...

 Free Contact Form Scripts
freecontactform

Looking for a simple website contact form? our Free contact...
Flagship product - powers large corporate sites to small hobby...

 PHP Captcha Security
white hat web design > articles/php captcha.php

// Insert your code for showing an error message...
Due to a security bug in the script please ensure you are using the...

 PHP CAPTCHA, image validation example :: Free PHP Scripts and Classes
finalwebsites > snippets.php?id=39

 ASP Security Systems | Scripts & Components | Hot Scripts
hotscripts > category/asp/scripts components/security systems

technology including up to 256-bit Advanced Encryption Standard...
script is recommended for users of the secpay (c) system as it uses...

 Free captcha Download - * Software
script.wareseeker

var pageOptions = { 'pubId' : 'pub-8098918000470057', 'channel' :...
CAPTCHA is released to be a helpful and creative program that...

 34 * s and Anti-Spam Services | NetWaver
netwaver > 35/34

...ipts and Anti-Spam Services / Alabama Website Design and Development...
Inspiring Design Links for Creatives for 2009-04-24 | This Inspires...

 Free Form-to-Email script with Captcha by SnapHost - Free Tools and Utilities - The Script Dungeon
scriptdungeon

Free PHP Scripts, ASP Scripts, Java Scripts, Tools and...
This Form-to-Email script with Captcha is intended to collect data...

 Captcha form mail script in php free downloadable version | SendBlaster | Email broadcaster
sendblaster

Create your own permission based email list using Php Captcha Form...

 Best PHP Scripts | PHP * s
best php scripts > captcha scripts.htm

Start your Own Craiglist or Car Classified Site with Flynax...
PHP contact form features: (1) to prevent spam, a user is required to...
BotProof Email is a very useful script class which hides contact...

 » *
findmysoft > scripts/captcha script

 Free Captcha Creator Standard Edition - PHP * software that generates Captcha Images.
sharewarecheap > Captcha Creator Standard Edition software 1644

Click here to download Captcha Creator Standard Edition...
Captcha Creator is a powerful and complete PHP Captcha...

 Download Free CAPTCHA - Free CAPTCHA is an ASP script that allows you to protect your forms from spiders. - Softpedia
webscripts.softpedia > script/Security Systems

 HIOX FREE PHP SCRIPTS - Captcha image verification code,picture authentication
hscripts > scripts/php/captcha.php

You can check whether the user is human or robot by using the...
Release Date - 27/08/07 Get free version without...
Use this Captcha maker tool as picture caputre for human...

 PHP * for Comment Forms & Registration Forms | Web Design and Development Blog
itmdesign > blog/2009/02/php captcha script for comment forms registration forms

 Captcha Creator PHP Script 1.2 download free - Captcha Creator is a professional PHP Script
filecluster > Web Authoring/ASP PHP/Download Captcha Creator PHP Script

Captcha Creator PHP Script is periodically updated by FileCluster...
How To: Synchronize Google Chrome browser across all your...

 a good free PHP * [Archive] - CodingForums.com
codingforums > archive/index.php/t 124830

hi, are you sre that your php has support for true type fonts? if not...
Posted above - Have you checked your web server log for errors? If...

 10 * s and services for websites... (Woork) » TechNews.AM
technews > conversations/woork/10

Honda brings the CR-X Hatchback back to us with the...
Follow @Soshable Because Mainstream Media Doesn’t Get Social...

 PHP * : Securimage
webresourcesdepot > php captcha script securimage

64 Beautiful And Free Nature Brush Sets And Vectors - Giant Design...
ScheduledTweets: Free And Fully Ajaxed PHP Application To Schedule...

 Free Captcha // BlogCatalog Topic // BlogCatalog
blogcatalog > topic

 Captcha Creator PHP Script. downloadsoftware4free.com. Download Free Software. Search shareware and freeware downloads.
captcha creator php script.captcha creator php script.downloadsoftware4free

Captcha Creator is a professional fully customizable PHP Script that...
Subtitles Creator is a software to create a list of...

 SI Captcha for Wordpress Plugin PHP Script - Long Beach Weather
642weather > weather/scripts wordpress captcha.php

WordPress Blog Add-on Theme for WD/PHP/AJAX Website...
Color Theme Switcher Plugin for WD/PHP/AJAX Website...
Volcano Conditions Add-on for WD/PHP/AJAX Website...

 Download Captcha Creator PHP Script 1.2 Free Trial - Captcha Creator is a professional PHP Script
download3000 > download 45787

could put your computer and activity at risk by infecting the system...
Please do use the following linking code to link to Captcha Creator...
It is not legal to make use of cracks, patches, pirate...

 Free PHP * , no database, no images : teasso
teasso > products/captcha

 10 * s and services for websites | Queness
queness > post/40/10

Giveaway 5 Developer Subscriptions of WordPress club by...
6 Typography Wordpress Plugins for Your Blog: Improve Readability and...
16 Impressive Flash-Like Javascript Animation Inspirations, Tutorials...

 Free Contact Form PHP Script with image captcha - contact.php
weather watch > smf/index.php?topic=33604.0

added features: checks for required mail and image PHP functions...
added a few settings for email message headers few other small...

 WebSpamProtect.com - PHP * to protect your web form from spambots
webspamprotect > php captcha.php

This license allows the usage of the software on any number of...
Online WYSIWYG form builder, receiving submissions instantly by...



Response  
  Smilies

Guest name   (optional)       Register for more options.



Trackbacks : If you talked about this article in your blog or website, you may instantly get a backlink 
  There's no trackback at the moment.











 

FICGS message




SEO forums and chat - Search engines optimization



 


Make your profile in the social network :

- Create groups, pages and events.
- Promote your website (free backlink).
- Keep in touch with your friends.
- Discover what your friends think about you.
- And many more features soon...

 


Pagerank       Copy this code to display your site's Pagerank




Write upside down to your friends!   In your blog, anywhere...
(works with MySpace, Twitter, Facebook, Youtube, MSN, Hi5, Bebo, Yahoo...)







FICGS is also a Free Internet Correspondence Games Server.

Here you can play Chess, Go & Poker Texas Holdem online for free in rated class tournaments and a unique world championship.

Free Internet Chess & Go Server


Feel free to link to this page and to FICGS chess server :