<?php 

$utils = "@HTDOCS@/www-util"; 
include "$utils/ipp.php";
include_once "$utils/markdown.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 = "@ROOTWWW@";
 } else {
// $rootdir = "@ROOTWWW@/@ROOTDIR@";
  $rootdir = "@ROOTWWW@";
 }

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

$script = basename($_SERVER[SCRIPT_NAME]);
do_markdown ($script, $rootdir);

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";
// }

