Saturday, May 8, 2010

Strong or Secure Password Using PHP Code








User Registration

UserName:

Password:






$username=$_REQUEST['username'];
$password=$_REQUEST['userPassword'];
//$retype=$_REQUEST['retypePassword'];

if($_REQUEST['submit']=="login")
{
if($password)
{
if(preg_match("/^.*(?=.{8,})(?=.*[a-z]+)(?=.*[^A-Za-z0-9])(?=.*[0-9\.\-\@\#\$\&]).*$/",$password))

{
echo "
Successfuly checked your password
";

}
else
{
echo "
Please Enter"."
"."Atleast 8 character"."
"."Alpha numeric value"."
"."1 Special character
";
}
}

else
{
echo "
Password field can not be empty
";
}
}

?>