Data is stored on a text file (chat.txt).
Code: Select all
<?php
$text = htmlspecialchars($_POST["text"], ENT_QUOTES);
$name = htmlspecialchars($_POST["name"], ENT_QUOTES);
$pass = htmlspecialchars($_POST["pass"], ENT_QUOTES);
$file = "chat.txt";
$date = date("Y/m/d");
$post = "$date <b>$name dice:</b> $text <hr noshade>";
if ($text !="" && $name !="" && $pass =="Test") file_put_contents($file, $post, FILE_APPEND | LOCK_EX);
$todo = file_get_contents($file);
echo "<html><font face='Arial' size='2'><h4>Mensajes:</h4>";
echo "$todo";
echo "<p><form method='POST' name='form'><textarea name='text' rows='4' cols='48'></textarea><p><input type='text' value='' name='name' size='24'> <input type='password' value='' name='pass' size='10'> <input type='Submit' value='Enviar'> <input type='reset' value='Borrar'></form></p></font></html>";
?>
http://www.scriptshow.murcia-region.com/test/?Chat