Welcome Guest, Not a member yet? Register   Sign In
PHP Security?
#2

[eluser]mzuser[/eluser]
An example of the function I use to clean inputs before validation.

Code:
function clean_recursive($value)
    {
       if (is_array($value)) {
          foreach($value as $k=>$v) {
             $value[$k] = clean_recursive($v);
          }
       } else {
          if(get_magic_quotes_gpc() == 1){
             $value = addslashes($value);
          }
    
          $value = trim(htmlentities($value,ENT_QUOTES,"utf-8")); //convert input into friendly characters to stop XSS
              $value = strip_tags($value);
              $value = mysql_real_escape_string($value);
          
       }
       return $value;
    }


Messages In This Thread
PHP Security? - by El Forum - 06-22-2010, 10:18 AM
PHP Security? - by El Forum - 06-22-2010, 10:26 AM
PHP Security? - by El Forum - 06-22-2010, 10:50 AM
PHP Security? - by El Forum - 06-22-2010, 10:58 AM
PHP Security? - by El Forum - 06-22-2010, 12:22 PM
PHP Security? - by El Forum - 06-22-2010, 01:06 PM
PHP Security? - by El Forum - 06-22-2010, 01:17 PM
PHP Security? - by El Forum - 06-22-2010, 01:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB