User: Hello
Dimas: zdarova
Juice: Test
Juice: ещё раз Test
a: a
Angel: привет всем
Angel: Передаю привет Александру Колобкову, очень хороший добрый человек. Всего ему самого наилучшего.
Angel: молодец он что такой проект сделал, крутой блин
<?php
if ($_SERVER['REQUEST_URI'] == "/juicephp/filesphp.php?faction") header ("Location: filesphp.php");
session_start(); ?>
<html>
<head>
<meta charset="UTF-8">
<title>Запись в файл</title>
<link rel="stylesheet" type="text/css" href="halo.css?v=2">
<link rel="shortcut icon" href="/juicephp/favicon.ico" type="image/x-icon">
<script src="halo.js"></script>
</head>
<!--[if !IE]>--><body onload="widthcontrol()"><!--<![endif]-->
<!--[if IE]><body onload="scrollRight()"><![endif]-->
<div class="main">
<div class="head"><center>
<a href="/juicephp">PHP Test by Alexander Kolobkov</a>. Потяните ползунок, чтобы увидеть код.<br>
<!--[if !IE]>-->
<input class="blackslider" type="range" min="0" max="100"
id="sizer" oninput="widthcontrol()" value="100">
<!--<![endif]-->
<!--[if IE]>
<div onscroll="widthcontrolie()" id="scrollie" style="height: 3%; width: 100%; overflow-x:scroll">
<hr color="black" width="1000%"></div>
<![endif]-->
</center> <br>
</div>
<div id="content">
<!-- Код воровать отсюда. -->
<?php
$fp = fopen("testfile.txt", "a+");
if ($_POST['name'] and $_POST['mess']) {
if (preg_match("/^[a-zA-Z0-9]+$/", $_POST['name']) and $_POST['mess']) {
$mtr = "<u>".$_POST['name']."</u>: ".str_replace('<', '<', $_POST['mess'])."<br>";
$test = fwrite($fp, $mtr);
$_SESSION['error'] = '0'; }
else $_SESSION['error'] = '1'; echo '<script type="text/javascript">alert("hello!");</script>';};
$frmerr = $_SESSION['error'];
if ($frmerr == 1) echo "Ошибка при заполнении формы.<br><br>"; ;
echo file_get_contents("testfile.txt");
?>
<br>
<form method="post" action="?faction">
<input type="text" name="name" placeholder="Имя" maxlength="15">
<input type="text" name="mess" placeholder="Текст сообщения " maxlength="150">
<input type="submit" name="sendit" value="Отправить" >
</form>
</div>
<!-- Показ исходного кода текущей страницы: -->
<div id="source">
<?php
$thispage = basename($_SERVER['REQUEST_URI']);
echo "<pre>", htmlspecialchars(file_get_contents($thispage)), "</pre>";
?>
</div>
</div>
</body>
</html>