<?php

function load_pages($path) {
	$path = str_replace('..', '.', $path);

	$path .= "/index.html";

	$baseDirectory = '/home/glg/www.glgprograms.it/';

	$fullPath = $baseDirectory . $path;
	if (file_exists($fullPath)) {
		readFile($fullPath);
	} else {
		readfile("home.html");
	}
}

if (!empty($_GET['p'])) {
	load_pages($_GET['p']);
}
else if (!empty($_GET['pag'])) {
	load_pages('pag/' . $_GET['pag']);
}
else if (!empty($_GET['newsID'])) {
	load_pages('newsID/' . $_GET['newsID']);
}
else {
	readfile("landing.html");
}
?>
