Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]token, token nie chce sie wyswietlic
marcio
post 30.09.2007, 18:19:49
Post #1





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

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


czesc mam problem probowalem przerobc kod tokena ktory jest napisany na klasach i chodzi na funckje wiec mam 3 pliki
funkcje_tokena.php
  1. <?php
  2.  
  3.  function Sesja_tokena() { 
  4.  
  5. $token = $_SESSION['randtoken']; 
  6.  
  7.  } 
  8.  
  9.  function Generuj_token() {
  10.  
  11.  
  12.  $RandNumber = rand(1,1000);  $token = substr(md5($RandNumber), 0,6); 
  13.  $_SESSION['randtoken'] = $token; 
  14. }
  15.  
  16.  function Zwroc_token() {
  17.  
  18.  return $token;
  19.  
  20.  }
  21.  
  22.  function Resetuj() { 
  23.  
  24.  $_SESSION['randtoken'] = &#092;"\"; 
  25. $token = &#092;"\"; 
  26.  
  27.  }
  28.  
  29.  
  30.  function Zrob_obrazek_tokena() { 
  31.  
  32.  
  33.  // header(\"Content-type: image/png\"); 
  34.  $image = @imagecreate(100,20); 
  35. if($image) { 
  36.  
  37.  $background = imagecolorallocate($image, 0,0,0); 
  38.  $text = imagecolorallocate($image, 255,255,235); 
  39.  imagestring($image, 4, 25,5, $token, $text); 
  40.  header(&#092;"Content-type: image/png\"); 
  41.  imagepng($image); 
  42.  imagedestroy($image);
  43.  } 
  44.  
  45.  }
  46.  
  47.  
  48.  
  49.  
  50.  ?>


potem token.php

  1. <?php
  2. include('funkcje_tokena.php');
  3.  
  4. Sesja_tokena($token);
  5. Zrob_obrazek_tokena($token);
  6. ?>


i strone na ktora ma wyswietlic tokena wys_token.php

  1. <?php
  2. include('funkcje_tokena.php');
  3.  
  4. Generuj_token($token);
  5. Zwroc_token();
  6. ?>
  7.  
  8. <html>
  9. <head><meta http-equiv="content-type" charset="utf-8" /></head>
  10. <body>
  11. <form method="post" action="wys_token.php" />
  12. <table>
  13. <tr><td width="80"><img src="token.php"></td><td><input type="text" name="token" /></td></tr>
  14. </table>
  15. </form>
  16. </body>
  17. </html>


nie wywala zadnego bledy ale zamiast obrazka jest nom wiecie jak sie obrazek nie wysweitli taka chodzby karta i nie wiem co jest zle sad.gif

Ten post edytował marcio 1.10.2007, 16:18:58


--------------------
Zainteresowania: XML | PHP | MY(SQL)| C# for .NET | PYTHON
http://code.google.com/p/form-builider/
Moj blog
Go to the top of the page
+Quote Post

Posty w temacie
- marcio   [PHP]token   30.09.2007, 18:19:49
- - my salsa   wlaczona biblioteka GD?   30.09.2007, 20:01:17
- - marcio   omg ze mnie jest totalny debil zapomnialem..Jak mo...   30.09.2007, 21:24:14
- - marcio   OK mysle ze teraz jest dobrze jesli nie to prosze ...   1.10.2007, 21:45:08


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

 



RSS Wersja Lo-Fi Aktualny czas: 19.07.2025 - 09:35