dn122

login.php

Jun 12th, 2013
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 KB | None | 0 0
  1. <?
  2.  
  3.     include 'init.php';
  4.    
  5.     //CONSULTA DO UTILIZADOR    
  6.     $consulta="Select * from utilizadores where email='" . $_POST['email'] . "' and password='" . $_POST['password'] . "'";    
  7.     $resultado=mysql_query($consulta);  
  8.    
  9.     if (mysql_num_rows($resultado)>0) //SE O EMAIL E A PASSWORD COINCIDIREM    
  10.     {      
  11.         //COLOCA NA VARIAVEL LINHA OS DADOS DA CONSULTA        
  12.         $linha=mysql_fetch_array($resultado);
  13.         //COLOCA O EMAIL EM SESSAO
  14.         $_SESSION['email']=$linha['email'];
  15.         //REDIRECCIONA A PAGINA PARA A PAGINA SECRETA      
  16.         header("location: admin.php");     
  17.     }  
  18.     else //CASO NAO COINCIDAM  
  19.     {  
  20.         //REDIRECCIONA PARA A PAGINA INICIAL REPORTANDO O ERRO
  21.         header("location: index.php?erro=1");  
  22.     }        
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment