<?php

$site = $_SERVER["SERVER_NAME"];
$site_url = "http://".$_SERVER["SERVER_NAME"]."/";
$domain = ucfirst(str_replace("www.", "", $_SERVER["SERVER_NAME"]));

$msg = !empty($_GET["msg"]) ? $_GET["msg"] : "Internal error";

$apology = array(
    "en" => "We are sorry!",
    "it" => "Spiacenti!"
);

if (isset($_SERVER["REDIRECT_STATUS"]) && ($_SERVER["REDIRECT_STATUS"] == "404")) {
    $desc = array(
        "en" => "The requested URL was not found on this server.",
        "it" => "La URL cercata non &egrave; stata trovata su questo server."
    );

    $help = array(
        "en" => '<a href="'.$site_url.'">Visit the <strong>'.$domain.'</strong> home page</a>.',
        "it" => '<a href="'.$site_url.'">Visita la pagina iniziale di <strong>'.$domain.'</strong></a>.'
    );
}
else {
    $desc = array(
        "en" => "The server encountered an error.",
        "it" => "Si &egrave; verificato un errore."
    );

    $help = array(
        "en" => '<a href="'.$site_url.'">Visit the <strong>'.$domain.'</strong> home page</a> or <a href="javascript:history.back();">Come back</a>.',
        "it" => '<a href="'.$site_url.'">Visita la pagina iniziale di <strong>'.$domain.'</strong></a> oppure <a href="javascript:history.back();">Torna indietro</a>.'
    );
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title><?php echo $msg ?></title>
  <style type="text/css" media="all">@import url("http://files.caprionline.it/common/errordocs/style.css");</style>
</head>
<body>

<div id="wrap">
  <h1><?php echo $msg ?></h1>

  <div id="langs">
    <?php foreach ($apology as $lang => $dummy) { ?>
      <div class="lang">
        <h2><?php echo $apology[$lang] ?></h2>
        <p><?php echo $desc[$lang] ?></p>
        <p><?php echo $help[$lang] ?></p>
      </div>
    <?php } ?>
  </div>

  <div id="footer">
    <a href="http://www.ithip.com" target="_blank">
      <img src="http://files.caprionline.it/common/errordocs/logo_ithip.png" width="80" height="24" alt="ithip network" />
    </a>
  </div>
</div>

</body>
</html>