phpython Code
a python interpreter written in php
Status: Pre-Alpha
Brought to you by:
francescobianco
--- a/trunk/phpython.lib.php +++ b/trunk/phpython.lib.php @@ -1,6 +1,31 @@ <?php +require_once(dirname(__FILE__)."/config.php"); +require_once(dirname(__FILE__)."/python/python.lib.php"); -require_once("python/python.lib.php"); +function phpython_index() { + $url = parse_url($_SERVER["REQUEST_URI"]); + $url["script"] = $url["path"]; + $url["script"] = dirname(__FILE__)."/www/".substr($url["script"],strlen(__PHPYTHON_BASE_PATH__)); + $url["script"] = substr($url["script"],-1)=="/" ? $url["script"]."index.py" : $url["script"]; + $url["script"] = is_dir($url["script"]) ? $url["script"]."/index.py" : $url["script"]; + if (file_exists($url["script"])) { + python_exec($url["script"]); + } else { + header('HTTP/1.0 404 Not Found'); + echo "<h1>404 Not Found</h1>"; + echo "The page that you have requested could not be found."; + echo "<hr/>"; + echo $url["script"]; + exit (); + } +} +function phpython_build() { + python_build(); +} + +function phpython_start() { + python_start(); +} \ No newline at end of file