From f2e82d33b1caace4554a4daa28276599eddfe1bb Mon Sep 17 00:00:00 2001 From: Jeroen van Wolffelaar Date: Thu, 2 Feb 2006 11:26:47 +0000 Subject: [PATCH] Introduce php wrapper for those hosts that don't have perl enabled --- cgi-bin/index.php | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 cgi-bin/index.php diff --git a/cgi-bin/index.php b/cgi-bin/index.php new file mode 100644 index 0000000..e5ad56b --- /dev/null +++ b/cgi-bin/index.php @@ -0,0 +1,43 @@ + array('pipe', 'r'), + 1 => array('pipe', 'w'), + 2 => array('pipe', 'w') + ), $pipes); + foreach ($_GET as $k => $v) { + fwrite($pipes[0], urlencode($k)."=".urlencode($v)."\n"); + } + fclose($pipes[0]); + fpassthru($pipes[1]); + $stderr = fread($pipes[2], 4096); + $exit = proc_close($proc); + if ($exit) { + echo "

Error happened, code $exit

\n"; + } + echo "
".htmlspecialchars($stderr);
+	echo "
"; +} +$pi = substr($_SERVER["PATH_INFO"], 1); +if ($pi == '') { + readfile("index.html"); + exit; +} elseif ($pi == 'search') { + go("search_packages.pl"); +} elseif (substr($pi, 0, 8) == 'package/') { + $_GET['searchon'] = 'names'; + $_GET['keywords'] = substr($pi, 8); + $_GET['suite'] = 'all'; + $_GET['exact'] = 1; + go("search_packages.pl"); +} elseif (substr($pi, 0, 4) == 'src:') { + header("Location: http://merkel.debian.org/~jeroen/pdo/source/".urlencode(substr($pi,4))); +} elseif (!eregi('[^a-z0-9+.-]', $pi)) { + header("Location: http://merkel.debian.org/~jeroen/pdo/package/".urlencode($pi)); + exit; +} else { + echo "404 not found"; +} -- 2.39.2