Advertisement
Guest User

Untitled

a guest
Jun 30th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. <?php
  2.  
  3. require('conexion.php');
  4.  
  5. session_start();
  6.  
  7. if(isset($_SESSION["Id_usuario"])){
  8. header("Location: armacompu.php");
  9. }
  10.  
  11. if(!empty($_POST))
  12. {
  13. $usuario = mysqli_real_escape_string($mysqli,$_POST['User']);
  14. $password = mysqli_real_escape_string($mysqli,$_POST['Password']);
  15. $error = '';
  16.  
  17. $sql = "SELECT * FROM usuario WHERE User = '$usuario' AND Password = '$password'";
  18. $result=$mysqli->query($sql);
  19. $rows = $result->num_rows;
  20.  
  21. if($rows > 0) {
  22. $row = $result->fetch_assoc();
  23. $_SESSION['Id_usuario'] = $row['Id_de_acceso'];
  24. $_SESSION['tipo_de_acceso'] = $row['Id_tipo_de_acceso'];
  25.  
  26. header("location: armacompu usuario.php");
  27. } else {
  28. $error = "Datos incorrectos";
  29. }
  30. }
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement