Herzlich willkommen im Archiv vom ABAKUS Online Marketing Forum
Du befindest Dich im Archiv vom ABAKUS Online Marketing Forum. Hier kannst Du Dich für das Forum mit den aktuellen Beiträgen registrieren.
<?php
// Badwordfilter
$badwords = array(
"Wort1", "Wort2", "Wort3", "Wort4", "Wort5", "Wort6", "Wort7", "Wort8", "Wort9", "Wort10",
"Wort11","Wort12", "Wort13", "Wort14", "Wort15", "Wort16", "Wort17", "Wort18", "Wort19",
"Wort20"
);
function badwords($text) {
global $badwords;
foreach ($badwords as $b) {
$r = $b[0].str_repeat("*", strlen($b)-2).$b[strlen($b)-1];
if (function_exists("str_ireplace")) {
$text = str_ireplace($b, $r, $text);
}
else {
$text = str_replace($b, $r, $text);
}
}
return $text;
}
?>
Aufruf der Funktion mit:
<?php
$Kommentar = badwords($Kommentar);
?>
<form name="Form" action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post" onSubmit="return checkform();">
<?php
// Erstellen einer Rechenaufgabe
$Zahl_1 = intval(rand(1, 5));
$Zahl_2 = intval(rand(1, 5));
$mailto = "@";
if ($_POST) {
$Page = $_POST["Page"];
$datum = date("d.m.y, H:i",time());
$User = addslashes($_POST["User"]);
$Mail = addslashes($_POST["eMail"]);
$Comment = addslashes($_POST["Comment"]);
// ... und die Rechenaufgabe FALSCH geloest wurde...
if ($_POST['number'] != md5($_POST['arithmetic'])) {
// ...dann eine Fehlermeldung ausgeben!
echo "<p style=\"text-align: center\"><strong><span class=\"fc4\">Die Rechenaufgabe wurde falsch gelöst!</span></strong></p>";
}
// Ansonsten, wenn die Rechenaufgabe RICHTIG geloest wurde stimmt...
if ($_POST['number'] == md5($_POST['arithmetic'])) {
if ($Page !="" && $User !="" && $Comment !="") {
$file = "comments/".$Page.".txt";
// Kommentar schreiben
$fp = fopen($file,"a+");
fputs($fp,"<p><strong>$User</strong> ($datum):<br />$Comment</p>\n");
fclose($fp);
}
// E-Mail versenden
$betreff = "Neuer Kommentar";
$text = "Datum: $datum - Seite: \"$Page\" - Autor: $User\nE-Mail: $eMail\n\nKommentar: $Comment\r";
@mail($mailto,$betreff,$text,"From: ".$mailto);
}
}
?>
<table style="margin-top: 10px">
<tr>
<td colspan="2"><strong>Kommentar schreiben:</strong><br /><br />
<textarea style="width: 99%" rows="4" cols="21" name="Comment"></textarea>
</td>
</tr>
<tr>
<td style="width: 25%"><input type="text" name="User" size="28"></td>
<td style="width: 75%">Name</td>
</tr>
<tr>
<td style="width: 25%">
<input name="number" type="hidden" id="number" value="<?php echo md5(( $Zahl_1 + $Zahl_2 )); ?>"/>
<input name="arithmetic" type="text" id="arithmetic" size="28" />
</td>
<td style="width: 75%">Spamschutz (Wieviel ist <?php echo $Zahl_1; ?>+<?php echo $Zahl_2; ?>?)</td>
</tr>
<tr>
<td style="width: 25%"><input type="text" name="eMail" size="28"></td>
<td style="width: 75%">E-Mail (Optional, wird nicht veröffentlicht)</td>
</tr>
<tr>
<td style="width: 25%">
<p style="margin-top:22;">
<?php
// Wenn KEIN Cookie gegen Spam gesetzt wurde, dann soll der "Senden"-Button anklickbar sein
if ($_COOKIE["spam_protection"] != "spam_protection") {
?>
<input class="button" type="submit" name="sendfeedback" value="Speichern" />
<?php
}
// Wenn aber ein Cookie gegen Spam gesetzt wurde, dann soll der "Senden"-Button blockiert werden
if ($_COOKIE["spam_protection"] == "spam_protection") {
?>
<input class="button" type="submit" name="sendfeedback" value="Speichern" disabled="true" />
<?php
}
?>
</p>
</td>
<td style="width: 75%" align="right">[Kommentare <a href="" onclick="javascript:switchlayer('Comments'); return false;" title="">ein- oder ausblenden</a>]</td>
</tr>
</table>
<?php
// Dateiname ermitteln
$titel=explode("/","$_SERVER[PHP_SELF]");
$file=explode('.',$titel[count($titel)-1]);
echo " <input type='hidden' name='Page' value='".$file[0]."'>\r";
?>
<div id="Comments" onclick="javascript:switchlayer('Comments'); return false;">
<?php
// Kommentarausgabe
$ausgabe = "comments/".$file[0].".txt";
if(file_exists($ausgabe)) {
htmlentities(readfile($ausgabe));
}
else {
echo "Es sind noch keine Kommentare vorhanden.";
}
?>
</div>
</form>
Code: Alles auswählen
Aufruf der Funktion mit:
<?php
$Kommentar = badwords($Kommentar);
?>
Code: Alles auswählen
<form name="Form" action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post" onSubmit="return checkform();">
<?php
// Badwordfilter
$badwords = array(
"Wort1", "Wort2", "Wort3", "Wort4", "Wort5", "Wort6", "Wort7", "Wort8", "Wort9", "Wort10",
"Wort11","Wort12", "Wort13", "Wort14", "Wort15", "Wort16", "Wort17", "Wort18", "Wort19",
"Wort20"
);
function badwords($text) {
global $badwords;
foreach ($badwords as $b) {
$r = $b[0].str_repeat("*", strlen($b)-2).$b[strlen($b)-1];
if (function_exists("str_ireplace")) {
$text = str_ireplace($b, $r, $text);
}
else {
$text = str_replace($b, $r, $text);
}
}
return $text;
}
// Erstellen einer Rechenaufgabe
$Zahl_1 = intval(rand(1, 5));
$Zahl_2 = intval(rand(1, 5));
$mailto = "@";
if ($_POST) {
$Page = $_POST["Page"];
$datum = date("d.m.y, H:i",time());
$User = addslashes($_POST["User"]);
$Mail = addslashes($_POST["eMail"]);
$Comment = addslashes($_POST["Comment"]);
//Hier auf badwords testen
$Comment = badwords($Comment );
// ... und die Rechenaufgabe FALSCH geloest wurde...
if ($_POST['number'] != md5($_POST['arithmetic'])) {
// ...dann eine Fehlermeldung ausgeben!
echo "<p style=\"text-align: center\"><strong><span class=\"fc4\">Die Rechenaufgabe wurde falsch gelöst!</span></strong></p>";
}
// Ansonsten, wenn die Rechenaufgabe RICHTIG geloest wurde stimmt...
if ($_POST['number'] == md5($_POST['arithmetic'])) {
if ($Page !="" && $User !="" && $Comment !="") {
$file = "comments/".$Page.".txt";
// Kommentar schreiben
$fp = fopen($file,"a+");
fputs($fp,"<p><strong>$User</strong> ($datum):<br />$Comment</p>\n");
fclose($fp);
}
// E-Mail versenden
$betreff = "Neuer Kommentar";
$text = "Datum: $datum - Seite: \"$Page\" - Autor: $User\nE-Mail: $eMail\n\nKommentar: $Comment\r";
@mail($mailto,$betreff,$text,"From: ".$mailto);
}
}
?>
<table style="margin-top: 10px">
<tr>
<td colspan="2"><strong>Kommentar schreiben:</strong><br /><br />
<textarea style="width: 99%" rows="4" cols="21" name="Comment"></textarea>
</td>
</tr>
<tr>
<td style="width: 25%"><input type="text" name="User" size="28"></td>
<td style="width: 75%">Name</td>
</tr>
<tr>
<td style="width: 25%">
<input name="number" type="hidden" id="number" value="<?php echo md5(( $Zahl_1 + $Zahl_2 )); ?>"/>
<input name="arithmetic" type="text" id="arithmetic" size="28" />
</td>
<td style="width: 75%">Spamschutz (Wieviel ist <?php echo $Zahl_1; ?>+<?php echo $Zahl_2; ?>?)</td>
</tr>
<tr>
<td style="width: 25%"><input type="text" name="eMail" size="28"></td>
<td style="width: 75%">E-Mail (Optional, wird nicht veröffentlicht)</td>
</tr>
<tr>
<td style="width: 25%">
<p style="margin-top:22;">
<?php
// Wenn KEIN Cookie gegen Spam gesetzt wurde, dann soll der "Senden"-Button anklickbar sein
if ($_COOKIE["spam_protection"] != "spam_protection") {
?>
<input class="button" type="submit" name="sendfeedback" value="Speichern" />
<?php
}
// Wenn aber ein Cookie gegen Spam gesetzt wurde, dann soll der "Senden"-Button blockiert werden
if ($_COOKIE["spam_protection"] == "spam_protection") {
?>
<input class="button" type="submit" name="sendfeedback" value="Speichern" disabled="true" />
<?php
}
?>
</p>
</td>
<td style="width: 75%" align="right">[Kommentare <a href="" onclick="javascript:switchlayer('Comments'); return false;" title="">ein- oder ausblenden</a>]</td>
</tr>
</table>
<?php
// Dateiname ermitteln
$titel=explode("/","$_SERVER[PHP_SELF]");
$file=explode('.',$titel[count($titel)-1]);
echo " <input type='hidden' name='Page' value='".$file[0]."'>\r";
?>
<div id="Comments" onclick="javascript:switchlayer('Comments'); return false;">
<?php
// Kommentarausgabe
$ausgabe = "comments/".$file[0].".txt";
if(file_exists($ausgabe)) {
htmlentities(readfile($ausgabe));
}
else {
echo "Es sind noch keine Kommentare vorhanden.";
}
?>
</div>
</form>
Code: Alles auswählen
else if (document.Form.Comment.value.length > 2000) {
alert("Dein Kommentar ist zu lang!\rMaximal 2000 Zeichen.")
document.Form.Comment.focus();
return false}
Code: Alles auswählen
$Comment = wordwrap($Comment, 25, "<br />" , true);
Code: Alles auswählen
<?php
// Lange Wörter mit Leerzeichen teilen
function cut_long_words($Kommentar,$len=25){
$neutext = $Kommentar;
do{
$Kommentar = $neutext;
$neutext = preg_replace('~(^|\s)(\S{'.$len.'})(\S)~S', '\1\2 \3', $Kommentar);
} while ($neutext != $Kommentar);
return $neutext;
}
?>
Code: Alles auswählen
$Comment = cut_long_words($Comment );