timestamp = $timestamp; $old_messages = json_decode(file_get_contents('dynmap_webchat.json'), true); if(!empty($old_messages)) { foreach($old_messages as $message) { if(($timestamp - $config['updaterate'] - 10000) < $message['timestamp']) $new_messages[] = $message; } } $new_messages[] = $data; file_put_contents('dynmap_webchat.json', json_encode($new_messages)); $_SESSION['lastchat'] = time()+$msginterval; } elseif($_SERVER['REQUEST_METHOD'] == 'POST' && $_SESSION['lastchat'] > time()) { header('HTTP/1.1 403 Forbidden'); } ?>