Advertisement
Guest User

Untitled

a guest
Oct 15th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. include "Config/config.php";
  2. session_start();
  3.  
  4.  
  5. if(isset($_POST['submit'])){
  6. $username = (isset($_POST['username']))? $_POST['username'] : die("Please input a username!");
  7. $password = (isset($_POST['password']))? md5($_POST['password']):die("Please input a password");
  8. $stmt = $conn->prepare("SELECT username,id,role FROM users WHERE username = :username AND password = :password LIMIT 1");
  9. $stmt->bindParam(":username", $username);
  10. $stmt->bindParam(":password", $password);
  11. $stmt->execute();
  12. $row = $stmt->fetch();
  13.  
  14. $_SESSION['username'] = $user;
  15. $_SESSION['id'] = $id;
  16. $_SESSION['role'] = $role;
  17.  
  18. header('location: dashboard.php');
  19. exit;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement