Thread: some help
View Single Post
Old 08-06-2008, 10:26 AM   #2 (permalink)
sketchMedia
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 836
Thanks: 31
sketchMedia is on a distinguished road
Default

For a simple alpha-numeric check you can use:
PHP Code:
if(preg_match('/[^a-z0-9\s]/i'$szInput))//can also be '/[^a-z\d\s]/i'
{
    die(
'illegal chars found');

That script should also ignore white space and is case insensitive, just remove '\s' and the 'i' at the end if you want to remove these features ('\s' being White space and 'I' being case sensitivity)


This post may be of help to you: 8 Practical PHP Regular Expressions
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)

Last edited by sketchMedia : 08-06-2008 at 05:22 PM.
sketchMedia is offline  
Reply With Quote