Advertisement
finalshare

login

Mar 12th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. <php?
  2. if(isset($_POST["dangnhap"])){
  3. $tk = $_POST["user_name_lg"];
  4. $mk = md5($_POST["passlg"]);
  5. $rows = mysqli_query($connect,"
  6. select * from user where user_name = '$tk' and password = '$mk'
  7. ");
  8. $count = mysqli_num_rows($rows);
  9. if($count==1){
  10. $result = mysqli_query($connect,"
  11. select * from user where user_name = '$tk' and password = '$mk'
  12. ");
  13. $row = mysqli_fetch_assoc($result);
  14. $_SESSION['score'] = $row['score_max'];
  15. $_SESSION['name'] = $_POST["user_name_lg"];
  16. $_SESSION['pass']= md5($_POST["passlg"]);
  17. $_SESSION["loged"] = true;
  18. header("location:index.php");
  19. }
  20. else{
  21. header("location:index.php");
  22. setcookie("error", "Đăng nhập không thành công!", time()+1, "/","", 0);
  23. }
  24.  
  25. }
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement