Hits : 1623
Έγραψα μία
captcha function με όνομα paptcha
I wrote a php function for capthca by the name papthca
Παίρνει 2 ορίσματα,
It takes 3 arguments,
Αρχικές τιμές είναι οι παρακάτω:
Default values are:
Επιστρέφει:
Returns:
Τι πρέπει να γίνουν:
Παρακάτω είναι ο κώδικας (ημιτελής ακόμα)
Below is the source code (not complete yet)
Version 0.0.2
<?php function paptcha() { error_reporting ( E_ERROR ); if (is_int(func_get_arg(0)) && abs(func_get_arg(0)) < 10) $dig = abs(func_get_arg(0)); else $dig = 1; if (is_int(func_get_arg(1)) && abs(func_get_arg(1)) < 10 && abs(func_get_arg(1)) > 1) $chs = abs(func_get_arg(1)); else $chs = 2; for($i = 0; $i < $dig; $i++) $res .= rand(0, 9); // I put the result to first position of the choice array $choices[0] = $res; // File the choice array with options (numbers) for($k = 1; $k < $chs; $k++) for($i = 0; $i < $dig; $i++) $choices[$k] .= rand(0, 9); // Mix up a little the numbers shuffle ($choices); /* * I put the result to the final position of the choice array. * Now we know that one of the results of the array is our Captcha Choice * and we can verify the answer with the last number of the array */ $choices[$k] = $res; return($choices); } //end of func ?>
Παρακάτω είναι ένα παράδειγμα του paptcha:
Below is an online demo example for paptcha: