Version 2007-11-09

This commit is contained in:
nemunaire 2007-11-09 12:00:00 +01:00
commit e0f55450e1
87 changed files with 513 additions and 741 deletions

BIN
ab/0.TTF

Binary file not shown.

BIN
ab/1.TTF

Binary file not shown.

BIN
ab/2.TTF

Binary file not shown.

View file

@ -1,70 +0,0 @@
<?php
// On crée la session avant tout
session_start();
// 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
}
// 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
$_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 :
$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));
// elseif ($couleur == 2) $avant_plan = imagecolorallocate($_img, rand(0,55), rand(0,55), rand(250,255));
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
$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;
}
$_SESSION['aleat_nbr'] = $nombre;
// On détruit les variables inutiles :
unset($chiffre);
unset($i);
unset($caractere);
unset($chiffres);
//$fontfile = mt_rand(0, 2).'.TTF';
// Free
//$fontfile = '/mnt/152/free.fr/b/c/www.msnparadize/util/ab/1.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);
imagepng($_img);
?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 914 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 B

View file

@ -1,128 +0,0 @@
<?php
session_start();
class wave
{
public $nombre;
public function __construct($nombre = 0)
{
if(!empty($nombre))
{
$this->nombre = $nombre.'r'.$nombre;
$strlen = strlen($this->nombre);
$binary = ''; // Contiendra les donnees, juste les donnees.
for($i = 0; $i < $strlen; $i++)
{
$binary .= $this->get_datas('../'.$this->nombre{$i}.'.wav');
}
$this->package($binary);
}
}
public function analyse($wav,$arg = FALSE)
{
if(file_exists('../'.$wav))
{
$entete_unpack = 'a4file_type/Lfile_size/a4file_id/A4nom_zone1/Ltaille_zone1/SFormatTag/SChannels/LSamplesPerSec/LAvgBytesPerSec/SBlockAlign/SBitsPerSample/A4nom_data/Ltaille_data';
$fp = fopen('../'.$wav,'r');
$file = fread($fp, 44 );
$entete = unpack($entete_unpack,$file);
fclose($fp);
if( ($entete['file_type'] !== chr(0x52).chr(0x49).chr(0x46).chr(0x46) ) OR ( $entete['file_id'] !== chr(0x57).chr(0x41).chr(0x56).chr(0x45) ) )
{
trigger_error('Le fichier '.$wav.' n\'est pas un fichier wav',E_USER_ERROR);
}
if(!$arg)
return $entete;
else
return $entete[$arg];
}
else
{
trigger_error('fonction analyse, le fichier '.$wav.' est neccessaire mais manquant', E_USER_ERROR);
return FALSE;
}
}
private function get_datas($wav)
{
if(file_exists('../'.$wav))
{
$fp = fopen('../'.$wav,'r');
fseek($fp, 44 );
$datas = fread($fp, $this->analyse($wav, 'taille_data'));
fclose($fp);
return $datas;
}
else
{
trigger_error('fonction analyse, le fichier '.$wav.' est neccessaire mais manquant', E_USER_ERROR);
return FALSE;
}
}
private function package($datas)
{
$entete_pack = 'a4La4A4LSSLLSSA4L';
$entete = $this->analyse('../'.$this->nombre{0}.'.wav');
for($i = 1;$i<strlen($this->nombre); $i ++)
{
$entete2 = $this->analyse('../'.$this->nombre{$i}.'.wav');
if($entete !== $entete2)
{
if($entete['Channels'] !== $entete2['Channels'])
{
trigger_error('fonction package, un ou plusieurs fichiers wad n\'ont pas le même nombre de canaux',E_USER_ERROR);
}
if($entete['BitsPerSample'] !== $entete2['BitsPerSample'])
{
trigger_error('fonction package, un ou plusieurs fichiers wad, n\'on pas le même nombres d\'échantillons par seconde', E_USER_ERROR);
}
if($entete['SamplesPerSec'] !== $entete2['SamplesPerSec'])
{
trigger_error('fonction package, un ou plusieurs fichiers wad, n\'ont pas la même fréquence d\'échantillonage', E_USER_WARNING);
}
}
}
/* On calcule la taille des donnees que l'on à creer selon la formule de soundeditor */
$entete['taille_data'] = strlen($datas);
$entete['taille_data'] /= $entete['BlockAlign'];
$entete['taille_data'] *= $entete['BlockAlign'];
$entete['file_size'] = 44 + strlen($datas);
/* on "pack l entete et on y ajoute les donnees */
$binary = pack($entete_pack, $entete['file_type'],$entete['file_size'],$entete['file_id'],$entete['nom_zone1'],
$entete['taille_zone1'],$entete['FormatTag'],$entete['Channels'],$entete['SamplesPerSec'],$entete['AvgBytesPerSec'],
$entete['BlockAlign'],$entete['BitsPerSample'],$entete['nom_data'],$entete['taille_data']);
$binary .= $datas;
/* On transmet ou enregistre */
header('Content-type: audio/x-wav');
header('Content-Disposition: attachment; filename="code.wav"');
echo $binary;
}
}
$wav = new wave($_SESSION['aleat_nbr']);
?>

BIN
ab/un.ttf

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.