Re: String validation
| From: | Robin Vickery | Date: | Thu, 26 Oct 2000 10:22:36 +0000 |
| Subject: | Re: String validation | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-22101@lists.php.net to get a copy of this message | ||
>>>>> "DK" == "Dallas Kropka" <dallask@firstworld.net>
>>>>> writes:
> I have a script (http://64.78.177.254/steelangel/subscribe.html
> test it = if you'd like) I want to verify that the username and
> password are in this format:
> 20 chars long contain valid characters A-Z a-z 0-9 and _ No spaces
> anywhere and no dashes.
function valid_input( $input ) {
$minlength = 20;
return strlen($input) >= $minlength && !ereg('[^[:alnum:]_]', $input);
}
print valid_input($password) ? "aye" : "nay";
--
Robin Vickery...............................................
Planet-Three, 3A West Point, Warple Way, London, W3 0RG, UK
Email: robin@planet-three.net Phone: +44 (0)870 729 5444