Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [ZendFramework]Token, Wstawianie tokena.
ahead
post
Post #1





Grupa: Zarejestrowani
Postów: 33
Pomógł: 2
Dołączył: 13.08.2008

Ostrzeżenie: (0%)
-----


Nie wiem dokładnie jak zaimplementować token w ZF(jest zintegrowany ze smarty). Jako src obrazka ustawiłem odpowiednią akcje generującą token. Sama akcja wyświetla error, "obrazek nie może być wyświetlony, ponieważ zawiera błędy."
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
ahead
post
Post #2





Grupa: Zarejestrowani
Postów: 33
Pomógł: 2
Dołączył: 13.08.2008

Ostrzeżenie: (0%)
-----


  1. <?php
  2. public function genAction(){
  3.        
  4.        $app = Zend_Registryget(Alib_RegistryAPP);
  5.        
  6.  $session = new Zend_Session_Namespace('token');
  7.  
  8.      header ("Expire: Mon, 22 Sep 1997 0:0:00 GMT");
  9.    header ("Last-Modifie: " . gmdate("D, d M Y ::s") . " GMT");
  10.    header ("Cache-Control: no-store, no-cache, must-revalidate");
  11.    header ("Cache-Control: post-check=0, pre-check=0", false);
  12.    header ("Pragm: no-cache");    
  13.    
  14.    mt_srand(time() * 13);
  15.    
  16.    $rand_first = mt_rand(0,8);
  17.    $rand_last = mt_rand(0,8);
  18.    
  19.    $allowed = '123456789';
  20.    $allowed = str_shuffle($allowed);
  21.    
  22.    $first = substr($allowed, -1);
  23.    $second = substr($allowed, 0,1);    
  24.    $pass = $first + $second;
  25.    
  26.    $string = $first . ' + ' . $second;
  27.    
  28.    $image = imagecreate(120, 50);
  29.    
  30.    $black = imagecolorallocate($image,0,0,0);
  31.    $white = imagecolorallocate($image, 255,255,255);
  32.    
  33.    $font =  $app->config['font'];
  34.    
  35.    imagettftext($image, 17, 6, 15, 35, $white, $font, $string);
  36.    
  37.  $session->name = $pass;
  38.    
  39.    header('Content-typ: image/png');
  40.    imagepng($image);
  41.    imagedestroy($image);
  42.    }
  43. ?>


jest to akcja gen. Na stronie logowania, daję w miejscu w którym ma się wyświetlić <img src="/token/gen/" alt=""> i tu chyba nie ma problemu. Problem tkwi w samym generowaniu.
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: 7.10.2025 - 19:53