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
https://forums.phpfreaks.com/topic/81445-solved-password/#findComment-413472
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
https://forums.phpfreaks.com/topic/81445-solved-password/#findComment-413549
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
https://forums.phpfreaks.com/topic/81445-solved-password/#findComment-413581
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.