'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; } ?>