Jump to content

validating username and password


frijole

Recommended Posts

I am trying to validate usernames and passwords for a registration. I only want to allow letters and numbers. here is what I have, does this make sense?

 

foreach($_POST as $field => $value)
       {
       if (!empty($value)
       {
	       if (eregi("name", $field) and !eregi ("login", $field))
	       {
		       if (eregi("^[A-Za-z' -]{1,50}$",$value))
		       {
			       $errors[] = "$value is not a valid name.";
		       }
	       }

       }
       }

Link to comment
https://forums.phpfreaks.com/topic/90418-validating-username-and-password/
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.