Advertisement
Guest User

Untitled

a guest
Sep 17th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. // Form for Login
  2.  
  3. if (!empty($_POST["username"]) && !empty($_POST["password"])) {
  4.  
  5.  
  6.         $password=md5($_POST["password"]);
  7.  
  8.         $user=$mysql->query("SELECT * FROM users WHERE username='" . $mysql->real_escape_string($_POST["username"]) . "' AND password='" . $mysql->real_escape_string($password) . "'");
  9.  
  10.         if (!empty($user)) {
  11.  
  12.             $user=$user->fetch_array(MYSQLI_ASSOC);
  13.  
  14.             setcookie('id', $user["uid"], time() + 60*60*24*30, "/");
  15.  
  16.             setcookie('password', md5($_POST["password"]), time() + 60*60*24*30, "/");
  17.  
  18.         }
  19.  
  20.     }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement