All pastes #731199 Raw Edit

Untitled

public text v1 · immutable
·published 2007-10-09 21:12 UTC
rendered paste body
<?php

# default page
$default = 'index1.php';

# error page
$error = 'erro.php';

# set document root path
$base = $_SERVER['DOCUMENT_ROOT_PATH'];

print("$base");
# list of all site pages + the id they will be called by
$i = array('' => 'index1.php', 'main' => 'main.php', 'servicos' => 'servicos.php', 'contactos' => 'contactos.php', 'pagamentos' => 'pagamentos.php', 'promocoes' => 'promocoes.php', 'area-clientes' => 'area-clientes.php', 'alojamento' => 'alojamento.php');

if(array_key_exists($_GET['i'], $i))
{
foreach($i as $iid => $iname) {
if($_GET['i'] == $iid && file_exists($base.$iname))
{
          /* if somebody's making a request for ?page=xxx and
          the page exists in the $pages array, we display it
          checking first it also exists as a page on the server */
          include $base.$iname;
      }
   } // end foreach
}
else {
          /* if the page isn't listed in $pages, or there's no ?page=xxx request
          we show the default page, again we'll also just make sure it exists as a file
          on the server */
          include $base.$error;
}


?>