Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Function for cleaning input
- function clean_input($str)
- {
- return is_array($str) ? array_map('clean_input', $str) :
- str_replace("\", "\\", htmlspecialchars((get_magic_quotes_gpc() ? stripslashes($str) : $str), ENT_QUOTES));
- }
- function clean_input1($i)
- {
- if (!get_magic_quotes_gpc())
- {
- $i = addslashes($i);
- }
- $i = rtrim($i);
- $look = array('&', '#', '<', '>', '"', ''', '(', ')');
- $safe = array('&', '#', '<', '>', '"', ''', '(', ')');
- $i = str_replace($look, $safe, $i);
- return $i;
- }
- // Function for cleaning any input, submitted by any form etc.
- function clean($i)
- {
- if(!get_magic_quotes_gpc()) $i = addslashes($i);
- $i = rtrim($i);
- $look = array('&', '#', '<', '>', '"', '\'', '(', ')');
- $safe = array('&amp;', '&#35', '&lt;', '&gt;', '&quot;', '&#39', '&#40;', '&#41;');
- $i = str_replace($look, $safe, $i);
- return $i;
- }
Add Comment
Please, Sign In to add comment