Guest User

Untitled

a guest
Jan 7th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. <?php
  2. session_start();
  3. if($_SESSION['logueado'] != "SI"){
  4. header('location: login.php');
  5. exit();
  6. }
  7. $user = $_SESSION['usuario'];
  8.  
  9. //si ya esta logueado me conecto a la base de datos
  10. include 'conn.php';
  11.  
  12. <?php
  13. session_start();
  14.  
  15. include 'conn.php';
  16.  
  17. if(isset($_POST['login'])){
  18. if(!empty($_POST['pass'])){
  19. $stmt = $conn->prepare("SELECT * FROM usuarios WHERE pass=:pass");
  20. $stmt->execute(array(':pass'=>$_POST['pass']));
  21. $fila = $stmt->fetch();
  22. if($fila > 0){
  23. $_SESSION['logueado'] = "SI";
  24. $_SESSION['usuario'] = $fila['nombre'];
  25. header('location: index.php');
  26. } else {
  27. echo '<div class="error"><img class="image" src="icons/exclamation.png"> Contrase&ntilde;a incorrecta. Consulte con el administrador si no la recuerda.</div>';
  28. }
  29. }
  30. }
Add Comment
Please, Sign In to add comment