Version 1.14a

This commit is contained in:
nemunaire 2020-11-15 16:12:32 +01:00
commit dc48225dc9
1094 changed files with 189052 additions and 13889 deletions

View file

@ -1,25 +1,23 @@
<?php
session_start();
if(!defined('INDEX')) define('INDEX', 1);
//include('../includes/common.php');
define('INDEX', 1);
//Inclusion de l'API Onyx
require_once(trim(file_get_contents('../.onyx')));
// On défini la configuration :
if(!IsSet($_GET['nbr_chiffres']) || $_GET['nbr_chiffres'] < 5) {
$nbr_chiffres = 7; // Nombre de chiffres qui formerons le nombre par défaut
}
else {
$nbr_chiffres = $_GET['nbr_chiffres']; // Si l'on met dans l'adresse un ?nbr_chiffres=X
}
$SESS = new Session();
//On défini la configuration
if(!isset($_GET['nbr_chiffres']) || $_GET['nbr_chiffres'] < 5)
$nbr_chiffres = mt_rand(7, 9); // Nombre de chiffres qui formerons le nombre par défaut
else
$nbr_chiffres = intval(gpc('nbr_chiffres')); // Si l'on met dans l'adresse un ?nbr_chiffres=X
// Là, on défini le header de la page pour la transformer en image
header ("Content-type: image/png");
// Là, on crée notre image
//Création de l'image à partir d'un fond
$_img = imagecreatefromgif('fond_verif_img.gif');
// On défini maintenant les couleurs
// Couleur de fond :
//$arriere_plan = imagecolorallocate($_img, 0, 0, 0); // Au cas où on utiliserai pas d'image de fond, on utilise cette couleur là.
// Autres couleurs :
//On définit une couleur de fond
//$arriere_plan = imagecolorallocate($_img, 0, 0, 0); // Au cas où on utiliserai pas d'image de fond, on utilise cette couleur là.
//On définit les autres couleurs
$couleur = mt_rand(0, 4);
if ($couleur == 0) $avant_plan = imagecolorallocate($_img, rand(250,225), rand(0,25), rand(0,25));
elseif ($couleur == 1) $avant_plan = imagecolorallocate($_img, rand(0,25), rand(250,225), rand(0,25));
@ -27,48 +25,34 @@ $couleur = mt_rand(0, 4);
elseif ($couleur == 3) $avant_plan = imagecolorallocate($_img, rand(0,25), rand(250,225), rand(250,225));
elseif ($couleur == 4) $avant_plan = imagecolorallocate($_img, rand(250,225), rand(0,25), rand(250,225));
elseif ($couleur == 5) $avant_plan = imagecolorallocate($_img, rand(250,225), rand(250,225), rand(0,25));
else $avant_plan = imagecolorallocate($_img, rand(200,225), rand(200,225), rand(200,225)); // Couleur des chiffres
else $avant_plan = imagecolorallocate($_img, rand(200,225), rand(200,225), rand(200,225));
$i = 0;
while($i < $nbr_chiffres) {
$chiffre = mt_rand(1, 18); // On génère le nombre aléatoire
if ($chiffre == 10) $chiffre="a";
elseif ($chiffre == 2) $chiffre="w";
elseif ($chiffre == 11) $chiffre="t";
elseif ($chiffre == 12) $chiffre="c";
elseif ($chiffre == 13) $chiffre="n";
elseif ($chiffre == 14) $chiffre="p"; // e avec l'écriture Google
elseif ($chiffre == 15) $chiffre="f";
elseif ($chiffre == 16) $chiffre="y";
elseif ($chiffre == 17) $chiffre="m";
elseif ($chiffre == 18) $chiffre="k";
$chiffres[$i] = $chiffre;
$i++;
}
$nombre = null;
// On explore le tableau $chiffres afin d'y afficher toutes les entrées qu'y s'y trouvent
foreach ($chiffres as $caractere) {
$nombre .= $caractere;
//Définition de la liste des caractères
$caracteres = "2345678azertypsdfhjkmwxcbn?";
$nb_caracteres = strlen($caracteres)-1;
$captcha = "";
for($i = 0; $i < $nbr_chiffres; $i++)
{
$alea = mt_rand(0, $nb_caracteres);
$captcha .= $caracteres[$alea];
}
$_SESSION['aleat_nbr'] = strtolower($nombre);
//$sess->values['aleatnbr'] = strtolower($nombre);
//$sess->put();
$SESS->values['_captcha'] = strtolower($captcha);
$SESS->put();
// On détruit les variables inutiles :
unset($chiffre);
unset($i);
unset($caractere);
unset($chiffres);
//On détruit les variables inutiles
unset($chiffre, $i, $caractere, $nbr_chiffres, $nb_caracteres, $caracteres);
//$fontfile = mt_rand(0, 2).'.TTF';
// Free
//$fontfile = '/mnt/152/free.fr/b/c/www.msnparadize/util/ab/1.TTF';
//On définit la police
//$fontfile = './'.mt_rand(0, 2).'.TTF';
$fontfile = './2.TTF';
//imagestring($_img, 5, 18, 8, $nombre, $avant_plan);
if ($fontfile == './0.TTF') ImageTTFText($_img, 18, 2, 0, 23, $avant_plan, $fontfile, strtoupper($nombre));
else ImageTTFText($_img, 18.5, 2, rand(0,6), 23, $avant_plan, $fontfile, $nombre);
if ($fontfile == './0.TTF')
ImageTTFText($_img, 20, 2, 0, 23, $avant_plan, $fontfile, strtoupper($captcha));
else
ImageTTFText($_img, 20, mt_rand(1,5), rand(1,7), 30, $avant_plan, $fontfile, $captcha);
imagepng($_img);
?>