
- You are not logged in. | Login
January 16, 2007 1:57 pm
- SRG
- Member


create an antibot system with random numbers generating
I need to create an antibot system with random numbers generating…to enable output in html…And how to do it with a picture? Someone may have a ready-made script…
January 16, 2007 1:59 pm
- phppat
- Member


Re: create an antibot system with random numbers generating
$number =rand(0,100000); // Generate a random number from 0 to 100000
$background = imagecreatefromjpeg ('path to the file with background'); // Create a picture on the base of background
imagestring ($background, 5, 0, 0, $number, $color); // Record number on the picture
imagejpeg( $ background,'where to save a new picture',"100"); // We save the picture into jpg with quality 100
Something like that….
PHP monster
January 16, 2007 1:59 pm
- SRG
- Member


Re: create an antibot system with random numbers generating
Not bad. I could think of it myself!
January 16, 2007 2:00 pm
- Stre@m
- Member


Re: create an antibot system with random numbers generating
To produce noise on a picture you can draw dots in massive in ‘n’ pixels. I’ve already seen something like this…
January 16, 2007 2:01 pm
- shadow122
- Member


Re: create an antibot system with random numbers generating
phppat , it’s better to put out a picture with headers to evade its writing every time on the server. You can write ten pictures and include them in a page this way…
Last edited by shadow122 (January 16, 2007 2:03 pm)
January 16, 2007 2:04 pm
- phppat
- Member


Re: create an antibot system with random numbers generating
shadow122, you are right. I always do like this because this way a picture isn’t going to be actioned and there is no possibility of repeated recording.
PHP monster
January 17, 2007 7:13 am
- purplebean
- Member


Re: create an antibot system with random numbers generating
Super! You’d better do like this.
register.php
$_SESSION['str'] = rand_str(5); // function of symbols generation <img width=90 height=20 title="secret number" src='/images/?<? echo rand_str(10);?>' border=1>
/image/index.php
$str = $_SESSION['str'];
$font= 14;
$tng = rand(-5,5);
$font_x=25;
$filename='key.jpg';
$imgout=imagecreatefromjpeg($filename);
$color= imagecolorresolve($imgout, '0', '0', '0');
$font_y=15;
$fontfile="arial.ttf";
imagettftext($imgout, $font, $tng, $font_x, $font_y, $color, $fontfile, $str);
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Content-type: image/jpeg");
imagejpeg($imgout);
January 17, 2007 7:15 am
- SRG
- Member


Re: create an antibot system with random numbers generating
Cool! I’ve done like that
<form xyz> $code=rand(10000,99999); <tr> <td class="row1">write password *<input type=text name=code ></td> <td class="row2" width="38%"><input type=hidden name=cur_code value=47154> <img src='view_code.php?code=4 7 1 5 4'><td> </tr>
'view_code.php?code=4 7 1 5 4' simply puts out a picture with inscription
then within form handling script cur_code and code are compared; if they coincide, the code is valid
And such a question: why do bots keep on registering???
It means $code :huh: is written instead of 47154
January 17, 2007 7:16 am
- purplebean
- Member


Re: create an antibot system with random numbers generating
Do you keep on a page the code itself? What for?
January 17, 2007 7:17 am
- SRG
- Member


Re: create an antibot system with random numbers generating
They read a variable somehow and insert it into a field?! And what should I do? And how will bots know that it relates namely to the password?
January 17, 2007 7:19 am
- biopd42
- Member


Re: create an antibot system with random numbers generating
Use letters and numbers written by hand. By means of Paint they can be drawn in 5 seconds. This provides the necessary distortions and a bot will be unaware of the precise pixels number in a symbol (for standard fonts it was indicated a long time ago). You are to use low colors contrast and different colors. You may also use symbols superposition (if the bot functions according to pixels calculation principle, it will be confused this way and beside that it will be made perceive the whole code as one symbol). Here are the basic principles.
January 17, 2007 7:19 am
- SRG
- Member


Re: create an antibot system with random numbers generating
I don’t understand! Bot scans a picture and compares numbers from it?! How does it find out the password?
January 17, 2007 7:20 am
- biopd42
- Member


Re: create an antibot system with random numbers generating
It does exactly like this.


