Lile
Sehr gut erklärtes Tutorial, ausführlich und dennoch dünn und knapp gehalten, bei mir hat alles bestens funktioniert! Super Sache ;) 6*
am 26.12.2009 um 20:00 Uhr
|





<?//HAUPTFILTER FUNKTION
function msql($string, $art = "string") {
if($art == "string") { //Wenn nur string erlaubt (standart)
$string = mysql_filter($string); //Mysql parameter entfernen
$string = strip_tags($string); //HTML rausfiltern
$string = htmlentities($string, ENT_QUOTES); // Apostrophe in html
umwandeln
$string = wordwrap($string, 65, "<br/>", true);
}elseif($art = "html") { // Wenn html erlaubt
$string = mysql_filter($string); //Mysql parameter entfernen
$string = filter_html($text); //unerlaubte html tags filtern
$string = htmlentities($string, ENT_QUOTES); // Apostrophe in html
umwandeln
}
return $string;
}
?>
<?
//Mysql Parameter werden herausgefiltert
function mysql_filter($text) {
$text = str_replace("OR", "", $text);
$text = str_replace("or", "", $text);
$text = str_replace("AND", "", $text);
$text = str_replace("and", "", $text);
$text = str_replace("WHERE", "", $text);
$text = str_replace("where", "", $text);
$text = str_replace("LIKE", "", $text);
$text = str_replace("like", "", $text);
return $text;
}
?>
<?
function filter_html($text) { // Text umwandeln
//Php tags entfernen
$text = str_replace("<?", "", $text);
$text = str_replace("?>", "", $text);
$text = str_replace("<?php", "", $text);
$text = str_replace("php?>", "", $text);
//Bestimmte HTML tags entfernen
$text = str_replace("<script", "", $text);
$text = str_replace("</script>", "", $text);
$text = str_replace("<title>", "", $text);
$text = str_replace("</title>", "", $text);
$text = str_replace("<style", "", $text);
$text = str_replace("</style>", "", $text);
$text = str_replace("<frameset", "", $text);
$text = str_replace("<frame", "", $text);
$text = str_replace("</frameset>", "", $text);
$text = str_replace("</frame>", "", $text);
$text = str_replace("<iframe", "", $text);
$text = str_replace("</iframe>", "", $text);
return $text;
}
?>
<?
//HAUPTFILTER FUNKTION
function msql($string, $art = "string") {
if($art == "string") { //Wenn nur string erlaubt (standart)
$string = mysql_filter($string); //Mysql parameter entfernen
$string = strip_tags($string); //HTML rausfiltern
$string = htmlentities($string, ENT_QUOTES); // Apostrophe in html
umwandeln ->
}elseif($art = "html") { // Wenn html erlaubt
$string = mysql_filter($string); //Mysql parameter entfernen
$string = filter_html($text); //unerlaubte html tags filtern
$string = htmlentities($string, ENT_QUOTES); // Apostrophe in html
umwandeln ->
}
return $string;
}
//Mysql Parameter werden herausgefiltert
function mysql_filter($text) {
$text = str_replace("OR", "", $text);
$text = str_replace("or", "", $text);
$text = str_replace("AND", "", $text);
$text = str_replace("and", "", $text);
$text = str_replace("WHERE", "", $text);
$text = str_replace("where", "", $text);
$text = str_replace("LIKE", "", $text);
$text = str_replace("like", "", $text);
return $text;
}
function filter_html($text) { // Text umwandeln
//Php tags entfernen
$text = str_replace("<?", "", $text);
$text = str_replace("?>", "", $text);
$text = str_replace("<?php", "", $text);
$text = str_replace("php?>", "", $text);
//Bestimmte HTML tags entfernen
$text = str_replace("<script", "", $text);
$text = str_replace("</script>", "", $text);
$text = str_replace("<title>", "", $text);
$text = str_replace("</title>", "", $text);
$text = str_replace("<style", "", $text);
$text = str_replace("</style>", "", $text);
$text = str_replace("<frameset", "", $text);
$text = str_replace("<frame", "", $text);
$text = str_replace("</frameset>", "", $text);
$text = str_replace("</frame>", "", $text);
$text = str_replace("<iframe", "", $text);
$text = str_replace("</iframe>", "", $text);
$text = wordwrap($text, 65, "<br/>", true);
return $text;
}
?>
<?
$insert = mysql_query("INSERT INTO formulartabelle (name, email)
VALUES ('".msql($_REQUEST["name"])."', '".msql($_REQUEST["email"])."')
");
?>
<?
$insert = mysql_query("INSERT INTO formulartabelle (name, email)
VALUES ('".msql($_REQUEST["name"], html)."',
'".msql($_REQUEST["email"], html)."') ");
?>
<b>SmaX</b>
.
SmaX
Immer des gleiche: Wenn einem das Script nicht gefällt, dann soll man nicht nur 3 Punkte geben sondern auch was dazuschreiben! Derjenige is echt so feige.. warscheinlich Angst haben das er dann nen Kommentar zurückbekommt. Ich finde des so mieß, ich mach des schließlich bei anderen Tutorials auch nicht!