Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Obrazki- jak zrobić
-Getog-
post
Post #1





Goście







Witam. Mam pytanie. Jak zrobić obrazki na stronie żeby można było zabezpieczyć się przed botami. Do tego jest jakaś funkcja w php? Proszę o pomoc
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
marcio
post
Post #2





Grupa: Zarejestrowani
Postów: 2 291
Pomógł: 156
Dołączył: 23.09.2007
Skąd: ITALY-MILAN

Ostrzeżenie: (10%)
X----


Ze jestem dobry dam ci klase
  1. <?php 
  2.  
  3.  
  4. class Token 
  5. { 
  6.  
  7. var $token; 
  8.  
  9. function GetSessionVars() 
  10. { 
  11. $this->token = $_SESSION['randtoken']; 
  12. } 
  13.  
  14. function RandToken()
  15. { 
  16.  
  17. $RandNumber = rand(1,1000); 
  18. $this->token = substr(md5($RandNumber), 0,6); 
  19. $_SESSION['randtoken'] = $this->token; 
  20.  
  21. } 
  22.  
  23.  
  24. function ReturnToken() 
  25. { 
  26.  
  27. return $this->token; 
  28. } 
  29.  
  30. function Reset() 
  31. { 
  32.  
  33. $_SESSION['randtoken'] = ""; 
  34. $this->token = "";  
  35. } 
  36.  
  37. function ReturnDrawToken() 
  38. { 
  39.  
  40. // header("Content-type: image/png"); 
  41. $image = @imagecreate(100,20); 
  42.  
  43. if($image) 
  44. { 
  45. $background = imagecolorallocate($image, 0,0,0); 
  46. $text = imagecolorallocate($image, 255,255,235); 
  47. imagestring($image, 4, 25,5, $this->token, $text); 
  48. header("Content-type: image/png"); 
  49. imagepng($image); 
  50. imagedestroy($image);
  51. }
  52. }
  53. } 
  54.  ?>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 5.10.2025 - 06:05