Quote:
Syntax error, unexpected '}'
A little beautification show the problem
<?php
if (isset($_POST['send']))
{
if (isset($_SESSION['username'])) $fp = fopen('messages.txt', 'a', 1);
$message = htmlspecialchars($_POST['message-text']);
}
elseif (empty($message))
{
header('Location: stop_talking.html')
}
else
{
fwrite($fp, "$_SESSION[username]: $message " . PHP_EOL);
echo "<script>if ( window.history.replaceState ) {
window.history.replaceState( null, null, window.location.href );
}
document.location.reload()</script>";
}
}
?>
Online PHP Beautifier - PHP Formatter - BeautifyTools.com[
^]