Ver Mensaje Individual
  #6 (permalink)  
Antiguo 13/04/2010, 12:53
Avatar de NaRanJiTo78
NaRanJiTo78
 
Fecha de Ingreso: noviembre-2007
Ubicación: In the BeaCh
Mensajes: 874
Antigüedad: 16 años, 5 meses
Puntos: 10
Respuesta: Error PHP que no comprendo

darkasecas, entonces que tengo que hacer, definir "$form"?

Aqui es donde lo tengo que definir?
Código PHP:
Ver original
  1. function verifyFormToken($form) {
  2.        
  3.         // check if a session is started and a token is transmitted, if not return an error
  4.         if(!isset($_SESSION[$form.'_token'])) {
  5.             return false;
  6.         }
  7.        
  8.         // check if the form is sent with token in it
  9.         if(!isset($_POST['token'])) {
  10.             return false;
  11.         }
  12.        
  13.         // compare the tokens against each other if they are still the same
  14.         if ($_SESSION[$form.'_token'] !== $_POST['token']) {
  15.             return false;
  16.         }
  17.        
  18.         return true;
  19.     }
  20.    
  21.     function generateFormToken($form) {
  22.    
  23.         // generate a token from an unique value, took from microtime, you can also use salt-values, other crypting methods...
  24.         $token = md5(uniqid(microtime(), true));  
  25.        
  26.         // Write the generated token to the session variable to check it against the hidden field when the form is sent
  27.         $_SESSION[$form.'_token'] = $token;
  28.        
  29.         return $token;
  30.     }

Esque ya digo que no entiendo mucho de PHP...

Un saludo, gracias!

Última edición por NaRanJiTo78; 14/04/2010 a las 14:37