patmazuel — 2013-06-01T11:18:36-04:00 — #1
I'm trying to test that $pm_user does not contain anything other than letters or numbers a-z A-Z 0-9
I put the followiing code but it doesn't ever seem to set $pm_good_login to 0
$pm_good_for_login = 1
$pm_good_for_login = 0 ;
fretburner — 2013-06-01T13:23:46-04:00 — #2
You need to add a + to the end of your regex pattern, like this:
This means 'match the preceding pattern one or more times'.
tpunt — 2013-06-01T13:54:20-04:00 — #3
I'd be inclined to use the ctype_alnum() function instead of regex seen as it isn't really necessary in this instance. Its usage is simple: it returns TRUE if all characters are alphanumerical, or FALSE if they're not.
In order for your pattern to be reliable, you'll need to use the $ anchor at the end of the pattern to ensure that the whole string contains only numbers and letters.
patmazuel — 2013-06-01T14:15:16-04:00 — #4
Much easier , Thanks