Advertisement
Guest User

Untitled

a guest
Jan 11th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <?php
  2. require 'connect.php';
  3. $sql = "SELECT * FROM usuarios WHERE mail='". $l_username ."'";
  4. $result = $conn->query($sql);
  5. $dato = mysqli_fetch_assoc($result);
  6.  
  7.  
  8. if(isset($_POST["button"])){
  9. $btn=$_POST["button"];
  10. if($btn=="Entrar"){
  11. $l_username = $conn->real_escape_string($_POST["usr"]);
  12. $l_password = $conn->real_escape_string($_POST["pwd"]);
  13.  
  14. if($l_username == $dato["mail"]) {
  15. if($l_password == $dato["contrasena"]) {
  16. echo '<script type="text/javascript">alert("Logged In");</script>';
  17. if($dato["tipo"] == "administrador") {
  18. $_SESSION["tipo"] = "administrador";
  19. } elseif ($dato["tipo"] == "moderador") {
  20. $_SESSION["tipo"] = "moderador";
  21. } else {
  22. $_SESSION["tipo"] = "usuario";
  23. }
  24. echo '<script>window.location = "../index.php";</script>';
  25. } else {
  26. echo '<script type="text/javascript">alert("Bad password");</script>';
  27. }
  28. } else {
  29. echo 'user: '. $l_username .' pass: '. $l_password .' - Dato Mail:'. $dato["mail"] .' Dato pw:'. $dato["contrasena"] .' Dato tipo: ' . $dato["tipo"] .'';
  30. echo '<script type="text/javascript">alert("Bad username");</script>';
  31. }
  32. }
  33. }
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement