View Single Post
03-26-2009, 10:18 AM
#3
phpfreelancerbe is offline phpfreelancerbe
Status: I'm new around here
Join date: Mar 2009
Location:
Expertise:
Software:
 
Posts: 2
iTrader: 0 / 0%
 

phpfreelancerbe is on a distinguished road

  Old

If a client wants fancy validation i mostly use http://www.livevalidation.com/

Of course all user input is tainted so you still need to filter all input to make your application secure. It is best you use whitelist method for total control. You can check if input is alphanumeric with ctype_alnum(); you can also use regular expressions to filter everything out of a string so you only are left with alphanumeric data.

Example
PHP Code:
<?php 
if(!ctype_alnum($_POST['name'])) { 
    
$name preg_replace('/[^A-Za-z0-9 ]/''',$_POST['name']); 
} else { 
    echo 
"WIN"

?>
Hope this was what you were looking for.