Example #1
0
            case '/startPoll':
                if (isset($_GET['id']) && isset($_GET['size']) && isset($this->status['admin'])) {
                    $this->startPoll($_GET['id'], (int) $_GET['size']);
                }
                break;
            case '/votePoll':
                if (isset($_GET['answer'])) {
                    $this->votePoll((int) $_GET['answer']);
                }
                break;
            case '/endPoll':
                if (isset($this->status['admin'])) {
                    $this->endPoll();
                }
                break;
            case '/infoPoll':
                $response = $this->infoPoll();
                break;
        }
        if ($response === null) {
            $response = $this->status;
        }
        $_SESSION[$this->key] = $this->status;
        return $response;
    }
}
$config = @(include __DIR__ . '/config.php');
$interactive = new Interactive($config);
$response = $interactive->run();
header('Content-type: application/json');
echo json_encode($response);