Page MenuHomeDevCentral

Nasqueron Tools — Router script to use built-in PHP server
ActivePublic

Authored by dereckson on Nov 23 2014, 11:15.
<?php
/**
* Nasqueron Tools
*
* Router script to use built-in PHP server
*
* @package NasqueronTools
* @author Sébastien Santoro aka Dereckson <dereckson@espace-win.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @filesource
*
*/
$requestedFile = substr($_SERVER["REQUEST_URI"], 1);
if (array_key_exists('QUERY_STRING', $_SERVER)) {
$len = strlen($_SERVER['QUERY_STRING']) + 1;
$requestedFile = substr($requestedFile, 0, $len * -1);
}
if (file_exists($requestedFile) && !is_dir($requestedFile)) {
return false;
}
if (file_exists("$requestedFile.php")) {
$requestedFile .= '.php';
}
$_SERVER['PATH_INFO'] = '/' . $requestedFile;
require 'index.php';
exit;

Event Timeline

dereckson changed the title of this paste from untitled to Nasqueron Tools — Router script to use built-in PHP server.
dereckson updated the paste's language from autodetect to autodetect.
dereckson changed the visibility from "All Users" to "Public (No Login Required)".Nov 23 2014, 11:15
dereckson added a project: Nasqueron Tools.
dereckson updated the paste's language from autodetect to php.Nov 29 2014, 15:50