Forum Moderators: coopster

Message Too Old, No Replies

checking for special characters in a login /register script

         

supermanjnk

2:19 pm on Feb 9, 2005 (gmt 0)

10+ Year Member



I have a script to register in order to access a certain part of my site, however I have no clue how to go about stopping people from using!@#$%^&*() ect. in their usernames (passwords are alright) Also i'm not quite sure how to set a minimum limit to the number of characters they have to enter in a field.

dmmh

3:24 pm on Feb 9, 2005 (gmt 0)

10+ Year Member



edited...I totally misunderstood your question..brb :)

RonPK

4:46 pm on Feb 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if (!preg_match("/^[a-z0-9]{5,10}$/i", $_POST['username']))  
echo 'some nice error message';

This should only allow strings with ordinary letters and digits, length between 5 and 10 characters.