Non-alphanumeric characters in input fields!
Let's say $mystring came from something like this:
file1.
Input text field inside a form named mystring. Used form method: POST.
file2.$mystring=$_POST['mystring'];
function rvs ($argument)
{
return ereg_replace("[^a-zA-Z0-9]", "", $argument);
}
$result= rvs ($mystring);
$a_1 = strlen($mystring);
$a_2 = strlen($result);
if($a_1 != $a_2)
{
echo "Error: Your input used non-alphanumeric characters!";
exit;
}
Look at this example for a better description of rvs() function:
function rvs ($argument)
{
return ereg_replace("[^a-zA-Z0-9]", "", $argument);
}
$example="Daniel - 20 years old - result 20%";
$result = rvs ($example);
echo $result;
This will print:Daniel20yearsoldresult20
Please post comments with a better way to do this ;).