<?php use Acme\Core\Token; require 'app/init.php'; $token = Token::generate(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="public/css/app.css"> </head> <body> <script id="messageTemplate" type="text/template"> <li class="message"> <div class="info"> <a href="#">{{ name }}</a> <span>{{ time }}</span> </div> <a href="#" class="avatar"> <img src="public/img/{{ img }}.png" width="35"> </a> <p>{{ message }}</p> </li> </script> <ul class="message-box">
<?php use Acme\Core\Token; require './../app/init.php'; if (isPost() && isset($_POST['csrf_token']) && Token::check($_POST['csrf_token'])) { unset($_POST['csrf_token']); $data = $_POST; $data['created_at'] = getCreatedTime(); if ($message->save($data)) { echo json_encode($data); } } else { die('not access.'); }