<?php 

$utils = "/export/ipp002.0/www/localhost/utils";

include "$utils/ipp.php";

// if we come in directly, the top-level directory should be /dvodist
// if we come in from the ippops1 proxy, we need to set the root to /
$ifaProxy = "128.171.227.208";

// is the request coming from our proxY?
// $fromProxy = $_SERVER['HTTP_X_FORWARDED_FOR'] && ($_SERVER['REMOTE_ADDR'] == $ifaProxy);
// if ($fromProxy) ... 
$rootdir = "";

menu("$utils/ipp.menu.dat", 'DVO Distribution Server', $rootdir, "$rootdir/ipp.css", '', '');

$script = basename($_SERVER[SCRIPT_NAME]);

if ($script == "index.php") {
  verbatim ("index.info.txt");
  dirlist ("index.txt");
 }

if ($script == "docs.php") {
  verbatim ("docs.txt");
 }

if ($script == "help.php") {
  verbatim ("help.txt");
 }

menu_end();
?>

// generic proxy detection
// if ( $_SERVER['HTTP_X_FORWARDED_FOR']
//      || $_SERVER['HTTP_X_FORWARDED']
//      || $_SERVER['HTTP_FORWARDED_FOR']
//      || $_SERVER['HTTP_CLIENT_IP']
//      || $_SERVER['HTTP_VIA']
//      || in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554))
//      || @fsockopen($_SERVER['REMOTE_ADDR'], 80, $errno, $errstr, 30))
//   {
//     exit('Proxy detected');
//   }

// list server info:
// $varlist = array ('SCRIPT_NAME', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'HTTP_VIA', 'REMOTE_ADDR');
// 
// foreach ($varlist as $name) {
//   echo "$name : $_SERVER[$name]<br>\n";
// }
// 
// echo "get list<br>\n";
// foreach ($_GET as $key => $value) {
//   echo "$key : $value<br>\n";
// }

