<html>
<head>
<title>Messagebox für faule Leute</title>
<script type="text/javascript" language="javascript">
function smile(Zeichen)
{
document.form.message.value =
document.form.message.value + Zeichen;
}
</script>
<meta http-equiv="expires" content="0">
<style type="text/css">
<!--
A:link {text-decoration:none; border-bottom: 1px dotted; color: #000000;}
A:visited {text-decoration:none; border-bottom: 1px dotted; color:#000000;}
A:hover {color:#ffcc00; text-decoration: underline;}
a:visited:hover {text-decoration:none; border-bottom: 1px solid; color: #ffcc00;}
input{font: 8px Verdana color: #000000; border: 1px solid #000000;}
.button{border:1px solid #000000;color:#000000;background:#DDDDDD;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:9px;}
.textfeld{border:1px solid #000000; color:#000000;background:#DDDDDD;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:9px;}
body {background-color:#0081B7;font-family:verdana;font-size:9pt;color="#000000";}
-->
</style>
</head>
<body>
<?
$person = str_replace ("\n"," ", $person);
$person = str_replace ("<", " ", $person);
$person = str_replace (">", " ", $person);
$person = stripslashes ($person);
?>
<form action="msg.php" method="post" name="form">
name<br><input type="text" name="person" class=textfeld size="20" maxlength="30" value="<? echo $person; ?>"><br>
msg<br><input type="text" name="message" class=textfeld size="20" maxlength="120"><br><br>
<a href="javascript:void()" onclick="smile(':)')">*grins*</a>
<a href="javascript:void()" onclick="smile(':D')">*lach*</a>
<a href="javascript:void()" onclick="smile('www.w33k.de')">*visit*</a><br><br>
<input type="submit" value="send/refresh" class=button>
</form>
<?
$chat_file_ok = "msg.txt";
$chat_lenght = 7;
$max_single_msg_lenght = 512;
$max_file_size = $chat_lenght * $max_single_msg_lenght;
$file_size= filesize($chat_file_ok);
if ($file_size > $max_file_size) {
$lines = file($chat_file_ok);
$a = count($lines);
$u = $a - $chat_lenght;
for($i = $a; $i >= $u ;$i--){
$msg_old = $lines[$i] . $msg_old;
}
$deleted = unlink($chat_file_ok);
$fp = fopen($chat_file_ok, "a+");
$fw = fwrite($fp, $msg_old);
fclose($fp);
}
//######SMILIES#####
$msg = str_replace (":)","<img src=\"smile.gif\" border=\"0\">", $message);
$msg = str_replace (":D","<img src=\"lach.gif\" border=\"0\">", $message);
$msg = str_replace ("www.w33k.de","<img src=\"learn.gif\" border=\"0\">", $message);
//######SMILIES#####
$msg = str_replace ("\n"," ", $message);
$msg = str_replace ("\n"," ", $message);
$msg = str_replace ("<", " ", $msg);
$msg = str_replace (">", " ", $msg);
$msg = stripslashes ($msg);
if ($msg != ""){
$fp = fopen($chat_file_ok, "a+");
$fw = fwrite($fp, "\n<b>$person :</b> $msg<br>");
fclose($fp);
}
$lines = file($chat_file_ok);
$a = count($lines);
$u = $a - $chat_lenght;
for($i = $a; $i >= $u ;$i--){
echo $lines[$i] . "<br>";
}
?>
</body>
</html>