Jump to content

[SOLVED] Password


monkeybidz

Recommended Posts

The user also gets an error when numeric is used before alpha like 123mmmm

<?php
if(!$password){
	return "004";
}
if(strlen($password) < 6){
	return "011";
}
?>

 

 

why dont you turn the strlen password into something like this

 

if(strlen($password) < 6

 

echo "Sorry, you must have 6 or more characters";

 

else

 

form data here

Link to comment
Share on other sites

Try This:

 

FUNCTION:

<?php
function valid_password($pass1)
{
  //validate password
  if(ereg("^[a-zA-Z0-9]+$",$pass1) && strlen($pass1) >= 5 && strlen($pass1) <= 20)
  return true;
  else
  return false;
}
?>

 

FOR SCRIPT:

<?php
if(!valid_password($_POST['pass1'])) {
$error = $tblstart . 'You Did Not Enter A Password Or Your Password Is Invalid' . $tblend;
}
?>

 

This should work, A little more complicated than your code but for verfication the more the merrier!

Link to comment
Share on other sites

Do you have the full function for the code available so we can see any other underlining problems?

 

If you wanna just avoid the issue and put a little disclaimer, yours should do, but in sakes of learning the problem and avoiding it from happening again, i think we should look for a conclusion.

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.