Kelvineger

TrataLogar

Jul 15th, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1. //Trata Logar
  2.  
  3. <?php
  4. require_once 'usuario.php';
  5.  
  6. $tipo   = $_POST['TipoLogin'];
  7. $login  = $_POST['nome_usuario'];
  8. $senha  = addslashes($_POST['senha']);
  9. $login  = addslashes($_POST['nome_usuario']);
  10.  
  11. if ($tipo == 1) {
  12.  
  13.     $usuario = new Usuario();
  14.  
  15.     if (!$usuario->logar($login, $senha)):
  16.         echo "<script>alert('Usuario Incorreto');</script>";
  17.         echo "<script>location.href = \"Logar.php\";</script>;";
  18.  
  19.     else:
  20.         echo "<script>alert('Logado com Sucesso');</script> ";
  21.         echo "<script>location.href = \"../PainelControleUsuario/index_usuario.php\";</script>;";
  22.     endif;
  23. }else if ($tipo == 2) {
  24.     $adm = new Adm();
  25.  
  26.     if (!$adm->logar($login, $senha)):
  27.         echo "<script>alert('Usuario Incorreto');</script>";
  28.         echo "<script>location.href = \"Logar.php\";</script>;";
  29.  
  30.     else:
  31.         echo "<script>alert('Logado com Sucesso');</script> ";
  32.         echo "<script>location.href = \"../PainelControleAdm/index_adm.php\";</script>;";
  33.     endif;
  34. }
  35. ?>
Add Comment
Please, Sign In to add comment