yeshuadesign

ajax/controller.php

Oct 23rd, 2016
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. <?php
  2. //sleep(2);
  3. ob_start();
  4. session_start();
  5. require('../funcoes/classes/conexao.php');
  6. require('../funcoes/login/login.php');
  7. //require('../config.php');
  8.  
  9.  
  10.  
  11.  
  12. $acao = filter_input(INPUT_POST, 'acao', FILTER_SANITIZE_STRING);
  13.  
  14. switch ($acao) :
  15. case 'login' :
  16. //faz a interação
  17. $login = filter_input(INPUT_POST, 'login', FILTER_SANITIZE_STRING);
  18. $senha = filter_input(INPUT_POST, 'senha', FILTER_SANITIZE_STRING);
  19. if(login($login, $senha)){
  20. //CRIA A SEÇÃO
  21. $_SESSION['administrador'] = pegaLogin($login);
  22.  
  23. }else{
  24. $dados = pegaLogin($login);
  25. if (!$dados) {
  26. echo 'noif';
  27. }elseif($dados->administrador_senha != md5(strrev($senha))) {
  28. echo 'diffpass';
  29. }elseif($dados->administrador_nivel > 2) {
  30. echo 'non';
  31. }
  32. }
  33. break;
  34.  
  35. default:
  36. echo 'erro';
  37. break;
  38. endswitch;
  39. ob_end_flush();
Advertisement
Add Comment
Please, Sign In to add comment