marcelklip
Terugkerende gebruiker
- Lid geworden
- 2 jan 2005
- Berichten
- 1.010
Hallo
ik krijg sinds kort spam in men gastenboek
Hoe kan ik zorgen dat het ophoud
ik heb een simpele gastenboek alle berichten worden opgeslagen in een txt bestand
dit is de script
dit is het schrijf stukje
ik krijg sinds kort spam in men gastenboek
Hoe kan ik zorgen dat het ophoud
ik heb een simpele gastenboek alle berichten worden opgeslagen in een txt bestand
dit is de script
PHP:
<?php
echo '<b>Gastenboek</b><br><br><a href="schrijf.php">Schrijf in gastenboek</a><br><br>';
$aBestand = file('gastenboek.txt');
if($aBestand) {
$aBestand = array_reverse($aBestand);
foreach($aBestand as $sBericht) {
$aBericht = explode('|',$sBericht);
echo '<b>Bericht door: <a href="mailto:'.$aBericht[1].'">'.$aBericht[0].'</a></b>';
echo '<br>'.$aBericht[4].'<br><br><hr><br>';
}
} else {
echo 'Er zijn nog geen berichten.';
}
?>
dit is het schrijf stukje
PHP:
<?php
$datum = date("d-m-Y / H:i");
$a=$_GET['a'];
if($a=='s'){
$naam=$_POST['naam'];
$email=$_POST['email'];
$bericht=$_POST['bericht'];
$bestand = fopen("gastenboek.txt", "a");
$bericht = str_replace("\n","<br>",$bericht);
//smileys
$bericht = str_replace(":a","<img src='happy.gif'>",$bericht);
$bericht = str_replace(":c","<img src='knipoog.gif'>",$bericht);
$bericht = str_replace(":d","<img src='blij.gif'>",$bericht);
$bericht = str_replace(":e","<img src='blij2.gif'>",$bericht);
$bericht = str_replace(":f","<img src='boos.gif'>",$bericht);
$bericht = str_replace(":g","<img src='verbaast.gif'>",$bericht);
$bericht = str_replace(":h","<img src='tong.gif'>",$bericht);
$bericht = str_replace("??","<img src='vraagteken.gif'>",$bericht);
$bericht = str_replace(":A","<img src='happy.gif'>",$bericht);
$bericht = str_replace(":C","<img src='knipoog.gif'>",$bericht);
$bericht = str_replace(":D","<img src='blij.gif'>",$bericht);
$bericht = str_replace(":E","<img src='blij2.gif'>",$bericht);
$bericht = str_replace(":F","<img src='boos.gif'>",$bericht);
$bericht = str_replace(":G","<img src='verbaast.gif'>",$bericht);
$bericht = str_replace(":H","<img src='tong.gif'>",$bericht);
$bericht = str_replace("??","<img src='vraagteken.gif'>",$bericht);
//einde smilies
$bericht = str_replace("|","",$bericht);
$naam = str_replace("|","",$naam);
$email = str_replace("|","",$email);
fwrite($bestand, "$naam|$email|$datum|$REMOTE_ADDR|$bericht\n");
fclose($bestand);
echo"Bedankt voor u bericht <br><br><a href=gastenboek.php>Ga terug naar het gastenboek</a>";
} else {
echo"<form method=post action=schrijf.php?a=s>";
echo"Naam:<br><input type=text name=naam><br>";
echo"Email:<br><input type=text name=email><br>";
$value=$_GET['bericht'];
$smile=$_GET['smile'];
$value=$value.$smile;
?>
PHP:
<?
echo"Bericht:<br><textarea cols=25 rows=10 name=bericht id=bericht>$value</textarea><br>";
echo"<input type=submit value='Plaats bericht'>";
echo"</form>";
}
?>