* Handles incoming API requests. */ /** * Dynamic loading of classes. * @param string $classname */ function __autoload($classname) { if (file_exists('inc/' . $classname . '.php')) { include 'inc/' . $classname . '.php'; } elseif (file_exists('inc/Requests/' . $classname . '.php')) { include 'inc/Requests/' . $classname . '.php'; } } require_once 'inc/Realms.php'; Realms::init(); // initilize Realms. // Sent our footprint. header('X-Powered-By: Realms ' . Realms::VERSION . ' http://github.com/mitchfizz05/Realms'); // Find the client session if applicable. $session = new Session(); if (isset($_COOKIE['sid'], $_COOKIE['user'], $_COOKIE['version'])) { // Everything passed in. file_put_contents('user.txt', $_COOKIE['user'] . '_' . $_COOKIE['sid']); } // Handle request. $requestpath = '/' . $_GET['path']; $request = new HTTPRequest($requestpath, apache_request_headers()); // create http request object $resp = Realms::$requestRegistry->handle($request); if ($resp === null) {