Page 1 of 1

I'm new for PHP,could someone help me?

Posted: Fri Jul 05, 2002 12:17 pm
by kaily
How to get what the user has post?
I want to know if the user has POST a invalid character(e.g "<","|").
Please tell me what I should do!
Sorry for my english!

Posted: Fri Jul 05, 2002 1:05 pm
by twigletmac
You need to check out the preg_match() function - it'll let you use regular expressions to look for things in the posted data.

Mac

Posted: Sat Jul 06, 2002 8:46 am
by LenHewitt
You can clean user input by using a function such as:

function clean($input, $maxlength)
{
$input = substr($input, 0, $maxlength);
$input = EscapeShellCmd($input);
$input = htmlspecialchars(input);
return ($input);
}

If you wish the meaning of HTML characters to be preserved you should use htmlentities() rather than htmlspecialchars()