Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. <?php
  2. try {
  3.  
  4. $base = new PDO("mysql:host=localhost;dbname=pruebas;charset=utf8","root","root");
  5.  
  6. $base->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
  7. $sql = "select * from usuarios_pass where usuario = :login and password = :password";
  8. $resultado = $base->prepare($sql);
  9. $login = htmlentities(addslashes($_POST['login']));
  10. $password = htmlentities(addslashes($_POST['password']));
  11.  
  12. $resultado->bindValue(":login",$login);
  13. $resultado->bindValue(":password",$password);
  14. $resultado->execute();
  15.  
  16. if ($resultado->rowCount() !=0){
  17. //echo "usuario registrado";
  18. }else{
  19. header ('location:login.php');
  20. }
  21. } catch (Exception $e) {
  22. die ("Error al conectar" . $e->getMessage());
  23. }
  24.  
  25.  
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement