Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $error = array();
- $error['login'] = array();
- if (empty($_POST['user']))
- {
- $error['login']['mf_user'] = 'Username missing';
- }
- if (empty($_POST['pass']))
- {
- $error['login']['mf_pass'] = 'Password missing';
- }
- if (empty($error['login']))
- {
- $user = $_POST['user'];
- $pass = $_POST['pass'];
- if (!preg_match('/^[a-zA-Z0-9]/', $user))
- {
- $error['login']['chr_user'] = 'Username can only contain A-Z and 0-9';
- }
- if (!preg_match('/^[a-zA-Z0-9]/', $pass))
- {
- $error['login']['chr_pass'] = 'Password can only contain A-Z and 0-9';
- }
- if ((strlen($user) < 6) || (strlen($user) > 16))
- {
- $error['login']['user_length'] = 'Username is shorter than 6 or longer than 16 characters.';
- }
- if ((strlen($pass) < 6) || (strlen($pass) > 16))
- {
- $error['login']['pass_length'] = 'Password is shorter than 6 or longer than 16 characters.';
- }
- if (empty($error['login']))
- {
- }
- }
Add Comment
Please, Sign In to add comment