Funkcja czyszcząca dane z formularzy - czy jest wystarczająca ?

0
    function clear($text) {
	if(get_magic_quotes_gpc()) {
            $text = stripslashes($text);
	}
	$text = trim($text);
	$text = mysql_real_escape_string($text); 
	$text = htmlspecialchars($text);
	return $text;
    }  

Czy to wystarcza do czyszczenia pól przed SQL Injection ?
Czy uruchomić magic_quotes_gpc na serwerze ?

0

Ja stosuje coś takiego do czyszczenia.

function clear_text($text)
	{
		$search = array("&", "\"", "'", "\\", '\"', "\'", "<", ">", "`");
		$replace = array("&amp;", "&quot;", "&#39;", "&#92;", "&quot;", "&#39;", "&lt;", "&gt;", "&lsquo");
		return str_replace($search, $replace, trim($text));
	}

1 użytkowników online, w tym zalogowanych: 0, gości: 1