Guest User

Untitled

a guest
May 23rd, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <?php
  2.  
  3. $error = array();
  4. $error['login'] = array();
  5.  
  6. if (empty($_POST['user']))
  7. {
  8. $error['login']['mf_user'] = 'Username missing';
  9. }
  10.  
  11. if (empty($_POST['pass']))
  12. {
  13. $error['login']['mf_pass'] = 'Password missing';
  14. }
  15.  
  16. if (empty($error['login']))
  17. {
  18. $user = $_POST['user'];
  19. $pass = $_POST['pass'];
  20.  
  21. if (!preg_match('/^[a-zA-Z0-9]/', $user))
  22. {
  23. $error['login']['chr_user'] = 'Username can only contain A-Z and 0-9';
  24. }
  25.  
  26. if (!preg_match('/^[a-zA-Z0-9]/', $pass))
  27. {
  28. $error['login']['chr_pass'] = 'Password can only contain A-Z and 0-9';
  29. }
  30.  
  31. if ((strlen($user) < 6) || (strlen($user) > 16))
  32. {
  33. $error['login']['user_length'] = 'Username is shorter than 6 or longer than 16 characters.';
  34. }
  35.  
  36. if ((strlen($pass) < 6) || (strlen($pass) > 16))
  37. {
  38. $error['login']['pass_length'] = 'Password is shorter than 6 or longer than 16 characters.';
  39. }
  40.  
  41. if (empty($error['login']))
  42. {
  43.  
  44. }
  45. }
Add Comment
Please, Sign In to add comment