Санитизирајте улазе из базе података - ЦСС-трикови

Anonim

1) Функција за уклањање злонамерних битова

 .*?@si', // Strip out javascript '@<(\/\!)*?(^)*?>@si', // Strip out HTML tags '@)*?>.*?@siU', // Strip style tags properly '@@' // Strip multi-line comments ); $output = preg_replace($search, '', $input); return $output; ) ?>

2) Санитизациона функција

Користи горњу функцију, као и додаје косе црте како се не би зезнуле функције базе података.

$val) ( $output($var) = sanitize($val); ) ) else ( if (get_magic_quotes_gpc()) ( $input = stripslashes($input); ) $input = cleanInput($input); $output = mysql_real_escape_string($input); ) return $output; ) ?>

Употреба