12-20-2007, 10:33 PM
|
#17 (permalink)
|
|
The Wanderer
Join Date: Dec 2007
Posts: 14
Thanks: 0
|
Quote:
Originally Posted by Aaron
Okay, I think I might have had this answered several times... But... How exactly would I compare that stuff? The ereg/eregi function is really confusing O.o.
So sanitize everything with eregi? so like...
Code:
if(!eregi(A-Z0-9,$name)) {
echo "Usernames can only be alphanumeric, please correct this.";
}
Also, the domain checker was mostly tutorial code. How exactly did you do that?
|
Regex patterns take awhile to get used to, but are EXTREMELY valuable. do a search for 'regex tutorial' and do some research on them. And I highly recommend Regex Buddy.
The pattern I typically use for a person's last name is
PHP Code:
$strPattern = '/^[A-Z0-9\'\-]+$/i';
which allows for alpha characters A-Z, numbers 0-9, a hyphen, and an apostrophe and is case-insensitive. This doesnt check for length, just that what I'm checking matches the pattern I've defined.
I've gotta run right now. I'll come back tomorrow to explain the XSS stuff.
|
|
|
|