Jump to content

Display a login error - username less than 6 characters. How?


cturner

Recommended Posts

I am trying to display an error only if the user has entered a username that is less than 6 characters. It hasn't worked for me. When I test the whole code and enter a username of 6 characters or more, it displays an error. It should only display login error when the username is less than 6 characters. So can someone please tell me how I can do this? Thanks in advance.

 

Here is my code:

if (strlen($_POST['username']) < 6) {
$arrErrors['username'] = 'Login error.';
}

Link to comment
Share on other sites

Looks good, i use this and it works.  Maybe verify the name in the form matches the name in the variable.

 

if (trim (strlen($uname)) >= 6)  {
			if (checkUnique ("users", "uname", $uname) == FALSE) {
				$errorList[] = 'Username Taken, please try another Username';
				}
		}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.