Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. function admin_checker($username,$password)
  2. {
  3. $username=remove_extra_in_string($username);
  4. $password=remove_extra_in_string($password);
  5. $q='select * from `admin` where `username`="'.$username.'" and `password`="'.$password.'"';
  6. $result=@mysqli_query($q);
  7. $_COOKIE['username'] = $result["username"];
  8. $_COOKIE['password'] = $result["password"];
  9. if(@mysqli_num_rows($result)==1)
  10. return 1;
  11. else
  12. return 0;
  13. }
  14.  
  15. function remove_extra_in_string($string)
  16. {
  17. $extra=array(''','"','`','/','*',';',' ','--');
  18. $string=str_replace($extra,'',$string);
  19. return $string;
  20. }
  21.  
  22. if(admin_checker($_COOKIE['username'],$_COOKIE['password'])==1)
  23. { echo "ok"; } else { echo "not ok"; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement