<?php
include "vars.php";

header("Cache-Control: private, no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 
header("Pragma: no-cache");
if ($p3pcompact != "") {
	header("P3P: CP=\"$p3pcompact\"");
}

$user = $HTTP_POST_VARS["username"];
$pass = $HTTP_POST_VARS["password"];
$msg ="Per entrare nel BackOffice devi inserire username e password:";

if ($user != $adminuser || $pass != $adminpass) {
	if ($user != "" || $pass != "") {
		$msg = "Username e/o password non corretti. Riprova:";
	}
?>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title></title>
<base target="_self">
<link rel="stylesheet" href="backoffice.css" type="text/css">
</head>

<body topmargin="0" leftmargin="4" marginwidth="4" marginheight="0" class="pagina">
<p><b>Nel BackOffice &egrave; possibile:</b></p>

<li>Consultare e gestire gli ordini, modificarne lo stato di avanzamento e segnalarlo 
  al cliente.<br>
</li>
  
<li>Consultare l'elenco dei clienti registrati, modificarne i profili, attribuire 
  i listini, verificare quali e quanti ordini sono stati effettuati da ogni cliente.</li>
  
<li>Aggiornare o importare da un file esterno la giacenza degli articoli, identificati 
  in base al codice.</li>
  
<li>Gestire la mailing list ed inviare una newsletter a tutti gli iscritti.</li>
<form name="login" method="post" action="bologin.php">

  <table width="250" border="2" cellspacing="0" cellpadding="0" bordercolor="#333399">
    <tr>
      <td>
<table width="100%" border="0" cellspacing="0" cellpadding="10" class="form">
          <tr align="center"> 
            <td colspan="2"> 
              <p><?=$msg?></p>
            </td>
          </tr>
          <tr> 
            <td align="right"><b>Username:</b></td>
            <td width="50%"> 
              <input type="text" name="username" class="pulsante">
            </td>
          </tr>
          <tr> 
            <td align="right"><b>Password:</b></td>
            <td width="50%" align="left"> 
              <input type="password" name="password" class="pulsante">
            </td>
          </tr>
          <tr align="center"> 
            <td colspan="2"> 
              <input type="submit" name="Submit" value="Invia" class="pulsante">
            </td>
          </tr>
        </table>
      </td>
  </tr>
</table>
  </form>
<form name="help"><input type="hidden" name="pagina" value="backoffice.htm"></form>
</body>

</html>
<?php
} else {
	$myIP = $HTTP_SERVER_VARS["REMOTE_ADDR"];
	$firma = urlencode(md5($adminuser . $adminpass));
	echo "
<HTML>
<HEAD>
<SCRIPT LANGUAGE = \"JavaScript\">
<!--
    function Redirect() {
		document.cookie = \"eDenter_bo_logged=$myIP\" + \"; path=/;\";
		document.cookie = \"eDenter_bo_sign=$firma\" + \"; path=/;\";
    	self.location = \"main.php\";
    }
//-->
</SCRIPT>
</HEAD>
<BODY onload=\"Redirect()\"></BODY></HTML>
";
}

?>