diff options
author | Valentin Popov <dev@valentineus.link> | 2016-09-21 05:40:03 +0300 |
---|---|---|
committer | Valentin Popov <dev@valentineus.link> | 2016-09-21 05:40:03 +0300 |
commit | b9628f189b0ca2f7c411bd79566da37c73cc8e8f (patch) | |
tree | 01122bdea534d9cad15a63a271f87f742092b31f /test/components/engine.php | |
parent | 288980ceb35d5ace51284cfdf176e9acb5f7bb39 (diff) | |
download | iii-module-b9628f189b0ca2f7c411bd79566da37c73cc8e8f.tar.xz iii-module-b9628f189b0ca2f7c411bd79566da37c73cc8e8f.zip |
Demo in beta mode.
Diffstat (limited to 'test/components/engine.php')
-rw-r--r-- | test/components/engine.php | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/test/components/engine.php b/test/components/engine.php deleted file mode 100644 index bc89d8e..0000000 --- a/test/components/engine.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php
-function ShowRecord($id) {
- for ($i=0; $i < $id; $i++) {
- $cookie = json_decode($_COOKIE['TALK'.$i], true);
- echo("<tr>");
- echo("<td>".$cookie['type']."</td>");
- echo("<td>".$cookie['textarea']."</td>");
- echo("<td>".date("H:i:s", $cookie['time'])."</td>");
- echo("</tr>");
- }
- return 0;
-}
-
- if (isset($_COOKIE['BOT_TOKEN'])) {
- $BOT_TOKEN = $_COOKIE['BOT_TOKEN'];
- }
-
- if (isset($_POST['BOT_TOKEN'])) {
- unset($_COOKIE); // Clear the session
- SetCookie("BOT_TOKEN", htmlspecialchars($_POST['BOT_TOKEN']));
- $BOT_TOKEN = htmlspecialchars($_POST['BOT_TOKEN']);
- }
-
- if (isset($BOT_TOKEN)) {
- define('BOT_TOKEN', $BOT_TOKEN);
- $bot = new Bot(BOT_TOKEN);
- if (isset($_COOKIE['BOT_SESSION'])) {
- $session = $bot->session($_COOKIE['BOT_SESSION']);
- } else {
- $session = $bot->session();
- SetCookie("BOT_SESSION", $session);
- }
- if (!isset($session)) { ?>
- <div class="container">
- <div class="alert alert-danger" role="alert">Session is not initialized, check the settings!</div>
- </div>
- <?php }
- }
-
- if (isset($_POST['textarea'])) {
- $textarea = htmlspecialchars($_POST['textarea']);
- if (isset($_COOKIE['CURRENT_ID'])) {
- $current_id = (int)$_COOKIE['CURRENT_ID'];
- SetCookie('CURRENT_ID', $current_id+1);
- } else {
- $current_id = 0;
- SetCookie('CURRENT_ID', $current_id);
- }
-
- $cookie = array(
- 'type' => 'user',
- 'textarea' => $textarea,
- 'time' => time()
- );
- SetCookie("TALK".$current_id, json_encode($cookie));
-
- $current_id = $current_id+1;
- SetCookie('CURRENT_ID', $current_id+1);
- $cookie = array(
- 'type' => 'bot',
- 'textarea' => $bot->say($textarea),
- 'time' => time()
- );
- SetCookie("TALK".$current_id, json_encode($cookie));
- }
-?>
|