Hi Leute,
Also ich habe mich mal da an eine Shoutbox gewagt. Der Script ist nicht von mir, aber er ist eigentlich finde ich ganz gut weil er kein mysql benötigt.
Also der Script lautet wie folgt:
<? if(!isset($site)) { ?>
<title>[ message.box | leave.a.message ]</title>
</head>
<body background="img/faded-Background.jpg" text="#fff">
<center>
<table width="100" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table border="0" width="100%" cellspacing="5" cellpadding="0">
<form action="msgbox.php?site=thankyou" method="post">
<tr>
<td width="20%"><p align="right">Name:</p></td>
<td width="80%"><p align="left"><input type="text" name="name" size="20" maxlength="255" onblur="this.style.backgroundColor='#FFFFFF'" onfocus="this.style.backgroundColor='#FFFF99'"></p></td>
</tr>
<tr>
<td width="20%"><p align="right">Email:</p></td>
<td width="80%"><p align="left"><input type="Text" name="email" size="20" maxlength="255" onblur="this.style.backgroundColor='#FFFFFF'" onfocus="this.style.backgroundColor='#FFFF99'"></p></td>
</tr>
<tr>
<td width="20%"><p align="right">Comment:</p></td>
<td width="80%"><p align="left"><input type="text" name="comment" size="20" maxlength="255" onblur="this.style.backgroundColor='#FFFFFF'" onfocus="this.style.backgroundColor='#FFFF99'"></p></td>
</tr>
<tr>
<td width="20%"></td>
<td width="80%"><p align="left"><input type="submit" name="abschicken" value="shout" class="button"></p></td>
</tr>
</form>
</table>
</td>
</tr>
<tr>
<td>
<table border="0" width="100%" cellspacing="5" cellpadding="0">
<tr>
<td>
<?php
$filename="message.txt";
if (file_exists($filename)) {
$fp = fopen($filename,"r");
for ($i=0;$i<20;$i++) {
while(!feof($fp)) {
$zeile=fgets($fp,32000);
list($name,$datum,$email,$comment)=explode("|",$zeile);
$comment = preg_replace("/([A-Za-z0-9.-\]{2,})(@)([A-Za-z0-9.-\]{3,})(.)([A-Za-z]{2,3})\b/","<a href="mailto:\0">\0</a>",$comment);
$comment = preg_replace("/(http://)([A-Za-z0-9.-\/]{3,})(.)([A-Za-z]{2,3})([A-Za-z0-9.-\/]{0,})\b/","<a href="\0" target="_blank">\0</a>",$comment);
if (!$email) {
echo $name." wrote @ ".$datum."<br>".$comment."<br><br>";
} else {
echo "<a href="mailto:".$email."">".$name."</a> wrote @ ".$datum."<br>".$comment."<br><br>";
}
}
}
fclose($fp);
} else {
echo "<p align="center" style="margin-top: 20"><b>no entries yet</b></p>";
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</center>
<? } ?>
<? if(isset($site)) { ?>
<? if($site == "thankyou") { ?>
<meta http-equiv="refresh" content="5;URL=msgbox.php">
<title>[ message.box | thank.you ]</title>
</head>
<body bgcolor="#FFCC33" text="#000000">
<center>
<table width="175" border="0" cellspacing="2" cellpadding="0">
<tr>
<td>
<?php
$filename="message.txt";
if(isset($abschicken)) {
$fpn=@fopen($filename.".tmp","w");
if($fpn<=0) {
?>
Fehler
<?php
}
$comment = str_replace("|","",$comment);
$comment = htmlspecialchars($comment);
$comment = ereg_replace("c:/con/con", "[unallowed string]", $comment);
$email = str_replace("|","",$email);
$email = htmlspecialchars($email);
$email = ereg_replace("c:/con/con", "[unallowed string]", $email);
$name = str_replace("|","",$name);
$name = htmlspecialchars($name);
$name = ereg_replace("c:/con/con", "[unallowed string]", $name);
$datum=date("j.n.y, H:i");
$comment=htmlspecialchars($comment);
$datum=date("j.n.y, H:i");
if(file_exists($filename)) {
$eintrag= "$name|$datum|$email|$comment\n";
} else {
$eintrag= "$name|$datum|$email|$comment";
}
fputs($fpn,$eintrag);
if(!file_exists($filename)) {
$fp=fopen($filename,"w");
fclose($fp);
}
unset($fp);
$fp=@fopen($filename,"r");
if($fp<=0) {
?>
Fehler
<?php
}
while(!feof($fp)) {
$zeile=fgets($fp,32000);
fputs($fpn,$zeile);
}
fclose($fp);
fclose($fpn);
unlink($filename);
rename($filename.".tmp",$filename);
echo "<p align="center" style="margin-top: 20"><b>thanks for your entrie</b></p>";
echo "<p align="center">you will be redirected back ...</p>";
}
?>
</td>
</tr>
</table>
</center>
<? } ?>
<? } ?>
Jetzt meine Frage:
Am Ende steht ja sobald ich einen Eintrag mache und dieser vollständig ist kommt "thanks for your entrie you will be redirected back..." aber wo steht dieser link der einen auf diese Seite wieder verlinkt?
Und ist es möglich es überhaupt schon zu verhindern, dass er eine neue Seite aufmacht für diese NAchricht? Ich habe das in eine andere Seite integriert, aber immer wenn ich einen neuen Eintrag mache zeigt es eben diesen Text auf einem leer dokument an und springt dann zu der eigenständigen Php datei..
Viele liebe Grüße von mir und danke für eure hilfe..