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!
I'm new for PHP,could someone help me?
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
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
Mac
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()
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()