Ejemplo n.º 1
0
        if (strlen($this->params[0]) == 0) {
            array_shift($this->params);
        }
        array_shift($this->params);
        $method = array_shift($this->params);
        $method = preg_replace('/[^a-z_]/i', '', $method);
        $handler = "handle" . ucfirst($method);
        if (method_exists($this, $handler)) {
            $this->{$handler}();
        } else {
            $this->error("Unknown method {$method}");
        }
    }
}
$api = new RestAPI();
$api->dispatch();
if (!empty($CONF['redis_host'])) {
    if (empty($redis_handler)) {
        $redis_handler = new RedisServer($CONF['redis_host'], $CONF['redis_port']);
    }
    $redis_handler->Select($CONF['redis_db'] + 2);
    $bits = array();
    $bits[] = $_GET['key'];
    $bits[] = getRemoteIP();
    if (strlen($_SERVER['HTTP_REFERER']) > 2) {
        $ref = @parse_url($_SERVER['HTTP_REFERER']);
        $bits[] = $ref['host'];
    } else {
        $bits[] = '';
    }
    if (strlen($_SERVER['HTTP_USER_AGENT']) > 2) {