Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1. <?php
  2.  
  3. if (!empty($_POST['user']) and !empty($_POST['pass'])) {
  4.     $db = new Conexion();
  5.     $data = $db->real_escape_string($_POST['user']);
  6.     $pass = Encrypt($_POST['pass']);
  7.     $sql = $db->query("SELECT id FROM users WHERE (user='$data' OR email='$data') AND pass='$pass' LIMIT 1;");
  8.  
  9.     if ($db->rows($sql) > 0) {
  10.         echo 1;
  11.     } else {
  12.         echo '<div class="alert alert-dismissible alert-danger">
  13.          <button type="button" class="close" data-dismiss="alert">x</button>
  14.          <strong>ERROR: </strong>Las credenciales son incorrectas
  15.          </div>';
  16.     }
  17.     $db->close();
  18. } else {
  19.     echo '<div class="alert alert-dismissible alert-danger">
  20.          <button type="button" class="close" data-dismiss="alert">x</button>
  21.          <strong>ERROR: </strong>Todos los datos deben estar llenos
  22.          </div>';
  23. }
  24.  
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement