Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1465 connectés 

  FORUM HardWare.fr
  Programmation
  PHP

  Coder son ANTI-FLOOD

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Coder son ANTI-FLOOD

n°1050289
Badze
Aime les frites
Posté le 17-04-2005 à 20:53:37  profilanswer
 

Bonjours voila, je veux cree un systeme anti flood grace a une image GD.
voici mon code de mon image

Code :
  1. <?
  2. if (isset($_GET['hazard1']))    $hazard1 = $_GET['hazard1'];
  3. if (isset($_GET['hazard2']))    $hazard2 = $_GET['hazard2'];
  4. if (isset($_GET['hazard3']))    $hazard3 = $_GET['hazard3'];
  5. header ("Content-type: image/png" );
  6. $image = imagecreate(48,15);
  7. $orange = imagecolorallocate($image, 255, 128, 0);
  8. $noir = imagecolorallocate($image, 0, 0, 0);
  9. $blanc = imagecolorallocate($image, 255, 255, 255);
  10. imagestring($image, 10, 5, 0, "$hazard1", $noir);
  11. imagestring($image, 10, 20, 0, "$hazard2", $noir);
  12. imagestring($image, 10, 35, 0, "$hazard3", $noir);
  13. imagecolortransparent($image, $orange);
  14. imagepng($image);
  15. ?>


 
et voici ma page qui doit afficher l'image

Code :
  1. <?
  2. $chiffre_lettre=array(1,2,3,4,5,6,7,8,9,'A','Z','E','R','T','Y','U','I','O','P','Q','S','D','F','G','H','J','K','L','M','W','X','C','V','B','N');
  3. $rand1=rand(0,34);
  4. $rand2=rand(0,34);
  5. $rand3=rand(0,34);
  6. echo "<img src=image.php?hazard1=$chiffre_lettre[$rand1]&hazard2=$chiffre_lettre[$rand2]&hazard3=$chiffre_lettre[$rand3]>";
  7. ?>


 
Cela marche tres bien , mais le truc qui est tres embetant et que l'on peu quand meme trouver mes variables a cause de la méthode GET dans ma barre d'adresse de l'image.
Pour un syteme anti flood, c'est pas le top on va dire.
 
Un petit conseil pour permettre de caché mes variable ca serai le top, je sais bien qu'il y a la methode POST ou SESSION, mais je ne vois pas du tout comment je pourrais faire fonctionner cela.
 
Merci

mood
Publicité
Posté le 17-04-2005 à 20:53:37  profilanswer
 

n°1050315
simogeo
j'ai jamais tué de chats, ...
Posté le 17-04-2005 à 21:31:30  profilanswer
 


Code :
  1. <?php
  2. session_start(); //ajout de session_start
  3. if (isset($_SESSION['hazard1']))    $hazard1 = $_SESSION['hazard1'];
  4. if (isset($_SESSION['hazard2']))    $hazard2 = $_SESSION['hazard2'];
  5. if (isset($_SESSION['hazard3']))    $hazard3 = $_SESSION['hazard3'];
  6. header ("Content-type: image/png" );
  7. $image = imagecreate(48,15);
  8. $orange = imagecolorallocate($image, 255, 128, 0);
  9. $noir = imagecolorallocate($image, 0, 0, 0);
  10. $blanc = imagecolorallocate($image, 255, 255, 255);
  11. imagestring($image, 10, 5, 0, $hazard1, $noir);
  12. imagestring($image, 10, 20, 0, $hazard2, $noir);
  13. imagestring($image, 10, 35, 0, $hazard3, $noir);
  14. imagecolortransparent($image, $orange);
  15. imagepng($image);
  16. ?>


 
 

Code :
  1. <?php
  2. session_start(); //ajout de session_start
  3. $chiffre_lettre=array(1,2,3,4,5,6,7,8,9,'A','Z','E','R','T','Y','U','I','O','P','Q','S','D','F','G','H','J','K','L','M','W','X','C','V','B','N');
  4. $rand1=rand(0,34);
  5. $rand2=rand(0,34);
  6. $rand3=rand(0,34);
  7. $_SESSION['hazard1']=$chiffre_lettre[$rand1];
  8. $_SESSION['hazard2']=$chiffre_lettre[$rand2];
  9. $_SESSION['hazard3']=$chiffre_lettre[$rand3];
  10. echo "<img src=\"image.php\" />";
  11. ?>

n°1050324
Badze
Aime les frites
Posté le 17-04-2005 à 21:48:50  profilanswer
 

Merci beaucoup, javais pourtant tester cette méthode mais je n'avais pas reussi.
 
Merci beaucoup :D


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  PHP

  Coder son ANTI-FLOOD

 

Sujets relatifs
coder un weblog en phpaidez moi à le coder.. mon système de points.
Forcer frame s'il y a un anti-frame[Cherche coder] Mod HL² (duel)
Comment coder/decoder un caractère sur 2 octets ?[Résolu] Resample d'image anti aliasé => interpolation BICUBIC
Code anti-popup[XHTML/CSS] Bien débuter, et coder un design proprement
[Resolu] [Mysql]Probleme d'insertion de string avec des anti slashsjava, truetype et anti-aliasing
Plus de sujets relatifs à : Coder son ANTI-FLOOD


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR