Advertisement
thiago_db

logar.php

Dec 5th, 2017
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.88 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include('configuracao.php');
  4. ini_set('error_reporting', E_ALL);
  5. ini_set('display_errors', 1);
  6.  
  7.  
  8. if(@$_POST['logar'] == 'Logar'){
  9.  $sqlLogin = "SELECT * from usuario where login = '".$_POST['login']."' and senha = '".$_POST['senha']."'";
  10.  $queryLogin = mysql_query($sqlLogin);
  11.  
  12. if($queryLogin  === FALSE) {
  13. yourErrorHandler(mysqli_error($mysqli));
  14. }
  15.  
  16.  $resultado = mysql_fetch_array($queryLogin);
  17.  
  18.  if($resultado['login'] == $_POST['login'] && $resultado['senha'] == $_POST['senha']){
  19.    
  20.    $_SESSION['autoriza'] = $resultado['tipo_de_usuario'];
  21.    $_SESSION['nome'] = $resultado['nome'];
  22.    $_SESSION['usuario'] = $_POST['login'];
  23.    $_SESSION['id'] =  $resultado['id'];
  24.    $_SESSION['logado'] = "logado";
  25.  
  26.  
  27.    echo "<script>window.location.replace('sec/index.php');</script>";
  28.    
  29.  
  30.  
  31.     //header("Location: perfil.php");
  32.   }
  33. }
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement