{% else-1 %}

                        
<?
if (!isset($_GET[add])){
//показ сбщ
?>
<form action = /?add method = post>
Ваше имя <font class = more>(20 символов)</font>: <br />
<input type = text name = name value=<?=$_COOKIE[name]?>><br />
Сообщение <font class = more>(500 символов)</font>: <br />
<textarea cols = 20 rows = 3 name = msg><?if (isset($_GET[author])) echo $_GET[author].", "?></textarea><br />
ICQ <font class = more>(12 символов)</font>:<br />
<input type = text name = icq value=<?=$_COOKIE[icq]?>><br />
<input type = submit value = "Сказать">
</form>
</a>
<?
if (is_file("database.db")){
$file = File("database.db");
for ($i = count($file); $i > 0; $i-=3){
echo "<a href = '/?author=".htmlspecialchars($file[$i-3])."'>".htmlspecialchars($file[$i-3])."</a>";
if (trim($file[$i-1]) != "null") echo"(<img src='http://web.icq.com/whitepages/online?icq=".$file[$i-1]."&amp;img=5' style='vertical-align:bottom'>".$file[$i-1].")";

echo":<br />";
echo htmlspecialchars($file[$i-2])."<br />";
}
}
} else {
if (isset($_GET[add])){
if (strlen($_POST[name]) <= 20 && strlen($_POST[msg]) <= 500 && strlen($_POST[icq]) <= 12){
setcookie("name", $_POST[name], time()+360000);
setcookie("icq", $_POST[icq], time()+360000);
if (trim($_POST[icq])==null) $_POST[icq] = "null";
if (is_file("database.db")){
$data = File("database.db");
$file = fopen("database.db", "w+");
} else $file = fopen("database.db", "w");

for ($i = 0; $i<count($data); $i++){
@fwrite($file, $data[$i]);
}

if ($data[0] !== null) fwrite($file, "\n");
fwrite($file, htmlspecialchars($_POST[name])."\n");
fwrite($file, htmlspecialchars($_POST[msg])."\n");
fwrite($file, htmlspecialchars($_POST[icq]));
Header("Location: /");
}
else {
//превышен лимит
echo "Вы превысили лимит символов! <br /><a href = />На главную.</a>";
}
}
}



?>
0 17 0
Без комментариев...