PHP Parse error: syntax error, unexpected '}' in C:\opens\OpenServer\domains\localhost\reg.php on line 29

Я не понимаю в чем ошибка и тут должно было быть все верно, но когда я перехожу на reg.php пишет Parse error: syntax error, unexpected '}' in C:\opens\OpenServer\domains\localhost\reg.php on line 29 Вот код

<!DOCTYPE html>
<html>
<head>
    <title>чат</title>
</head>
<body>
<?php
    $user = htmlspecialchars($_POST["login"]);
    echo $user;
    if(file_exists('users/' . $user . '.txt')){
        echo ", вы вошли в свой аккаунт";
    } else {
        echo ", вы зарегистрировались!";
        file_put_contents('users/' . $user . '.txt', 'ку');
    }
?>
<h1>ЧАТ:</h1>
<p>Сообщение</p>
<input name="msg">
<button id="sendm" name="send">Send</button>
<?php
echo "<p id=\"chats\">".file_get_contents('chat.txt')."</p>";?>
<?php
    if(isset($_POST['send']))
    {
        $mess = htmlspecialchars($_POST["msg"]);
        $chatms = file_get_contents('chat.txt');
        $chatms = '<br>' .$user.": ".$mess
    }
?>
<script type="text/javascript">
    sendm.onclick = function(){
        document.getElementById("chats").innerHTML = <?php echo file_get_contents('chat.txt'); ?>;
    };
</script>
</body>
</html>

Ответы (0 шт):