forked from halo-battle/game
Version 0.7
This commit is contained in:
parent
e0f55450e1
commit
c117da6d77
148 changed files with 1914 additions and 801 deletions
BIN
ab/0.TTF
Normal file
BIN
ab/0.TTF
Normal file
Binary file not shown.
BIN
ab/1.TTF
Normal file
BIN
ab/1.TTF
Normal file
Binary file not shown.
BIN
ab/2.TTF
Normal file
BIN
ab/2.TTF
Normal file
Binary file not shown.
70
ab/ab.php
Normal file
70
ab/ab.php
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
<?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'] = strtolower($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);
|
||||
?>
|
||||
BIN
ab/fond_verif_img.gif
Normal file
BIN
ab/fond_verif_img.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 914 B |
BIN
ab/fond_verif_img.png
Normal file
BIN
ab/fond_verif_img.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 240 B |
128
ab/sound.php
Normal file
128
ab/sound.php
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
<?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
Normal file
BIN
ab/un.ttf
Normal file
Binary file not shown.
BIN
ab/wave/1.WAV
Normal file
BIN
ab/wave/1.WAV
Normal file
Binary file not shown.
BIN
ab/wave/2.WAV
Normal file
BIN
ab/wave/2.WAV
Normal file
Binary file not shown.
BIN
ab/wave/3.WAV
Normal file
BIN
ab/wave/3.WAV
Normal file
Binary file not shown.
BIN
ab/wave/4.WAV
Normal file
BIN
ab/wave/4.WAV
Normal file
Binary file not shown.
BIN
ab/wave/5.wav
Normal file
BIN
ab/wave/5.wav
Normal file
Binary file not shown.
BIN
ab/wave/6.WAV
Normal file
BIN
ab/wave/6.WAV
Normal file
Binary file not shown.
BIN
ab/wave/7.WAV
Normal file
BIN
ab/wave/7.WAV
Normal file
Binary file not shown.
BIN
ab/wave/8.WAV
Normal file
BIN
ab/wave/8.WAV
Normal file
Binary file not shown.
BIN
ab/wave/9.WAV
Normal file
BIN
ab/wave/9.WAV
Normal file
Binary file not shown.
BIN
ab/wave/A.WAV
Normal file
BIN
ab/wave/A.WAV
Normal file
Binary file not shown.
BIN
ab/wave/B.WAV
Normal file
BIN
ab/wave/B.WAV
Normal file
Binary file not shown.
BIN
ab/wave/C.WAV
Normal file
BIN
ab/wave/C.WAV
Normal file
Binary file not shown.
BIN
ab/wave/D.WAV
Normal file
BIN
ab/wave/D.WAV
Normal file
Binary file not shown.
BIN
ab/wave/E.WAV
Normal file
BIN
ab/wave/E.WAV
Normal file
Binary file not shown.
BIN
ab/wave/F.WAV
Normal file
BIN
ab/wave/F.WAV
Normal file
Binary file not shown.
BIN
ab/wave/G.WAV
Normal file
BIN
ab/wave/G.WAV
Normal file
Binary file not shown.
BIN
ab/wave/H.WAV
Normal file
BIN
ab/wave/H.WAV
Normal file
Binary file not shown.
BIN
ab/wave/I.WAV
Normal file
BIN
ab/wave/I.WAV
Normal file
Binary file not shown.
BIN
ab/wave/J.WAV
Normal file
BIN
ab/wave/J.WAV
Normal file
Binary file not shown.
BIN
ab/wave/K.WAV
Normal file
BIN
ab/wave/K.WAV
Normal file
Binary file not shown.
BIN
ab/wave/L.WAV
Normal file
BIN
ab/wave/L.WAV
Normal file
Binary file not shown.
BIN
ab/wave/M.WAV
Normal file
BIN
ab/wave/M.WAV
Normal file
Binary file not shown.
BIN
ab/wave/N.WAV
Normal file
BIN
ab/wave/N.WAV
Normal file
Binary file not shown.
BIN
ab/wave/O.WAV
Normal file
BIN
ab/wave/O.WAV
Normal file
Binary file not shown.
BIN
ab/wave/P.WAV
Normal file
BIN
ab/wave/P.WAV
Normal file
Binary file not shown.
BIN
ab/wave/Q.WAV
Normal file
BIN
ab/wave/Q.WAV
Normal file
Binary file not shown.
BIN
ab/wave/R.WAV
Normal file
BIN
ab/wave/R.WAV
Normal file
Binary file not shown.
BIN
ab/wave/S.WAV
Normal file
BIN
ab/wave/S.WAV
Normal file
Binary file not shown.
BIN
ab/wave/T.WAV
Normal file
BIN
ab/wave/T.WAV
Normal file
Binary file not shown.
BIN
ab/wave/U.WAV
Normal file
BIN
ab/wave/U.WAV
Normal file
Binary file not shown.
BIN
ab/wave/V.WAV
Normal file
BIN
ab/wave/V.WAV
Normal file
Binary file not shown.
BIN
ab/wave/W.WAV
Normal file
BIN
ab/wave/W.WAV
Normal file
Binary file not shown.
BIN
ab/wave/X.WAV
Normal file
BIN
ab/wave/X.WAV
Normal file
Binary file not shown.
BIN
ab/wave/Y.WAV
Normal file
BIN
ab/wave/Y.WAV
Normal file
Binary file not shown.
BIN
ab/wave/Z.WAV
Normal file
BIN
ab/wave/Z.WAV
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue