Advertisement
Guest User

tratarLogin.php

a guest
Dec 7th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. <?php
  2.  
  3. include("../libs/connect.php");
  4.  
  5. $name = $_POST['name'];
  6. $password = $_POST['password'];
  7.  
  8. $tb = $con->prepare("select id, name, password from admin where name=:name and password=:password");
  9. $tb->bindParam(":name", $name, PDO::PARAM_STR);
  10. $tb->bindParam(":password", $password, PDO::PARAM_STR);
  11. $tb->execute();
  12. $l = $tb->fetch(PDO::FETCH_ASSOC);
  13. if (!empty($l)) {
  14. $_SESSION["usuario"] = $name;
  15. header("Location: admin.php" . $l["usuario"]);
  16. } else {
  17. echo "Nome de Ususário ou Senha Incorretos !";
  18. }
  19. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement