Advertisement
Guest User

login hex

a guest
Oct 18th, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. function login() {
  2. $username = $_POST['username'];
  3. $password = bcrypt($_POST['password']);
  4.  
  5. if(isset($_POST['submit'])) {
  6. if(!empty($username) && !empty($password)) {
  7. $query = mysqli_query("SELECT username, password FROM users WHERE username = '$username' AND password = '$password'");
  8.  
  9. if(mysqli_num_rows($query) > 0) {
  10. $_SESSION['user'] = true;
  11. $_SESSION['user'] = $query['id'];
  12. }
  13. }
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement