<?php
/**
* @version $Id: index.php,v 1.4 2004/01/10 12:38:43 freedev Exp $
* @author Vincenzo D'Amore <hide@address.com>
* @package wa_base
*/
/**
*
* Login page
*
*/
require_once("./wacommon.inc.php");
require_once("./includes/databases.inc.php");
require_once("./includes/initenv.inc.php");
$sMessage = WA_MSG_LOGIN;
$sRedirect = "";
if (isset($_COOKIE["User"]))
$txtUserCookie = $_COOKIE["User"];
else
$txtUserCookie = "";
$checkDb = new WARecordset();
$checkDb->SetupFromGlobalCnn() or die(WA_REDIRECT_INSTALL_PAGE);
$bLoggedIn = False;
if ((isset($_POST["textUser"])) && (isset($_POST["textPassword"])))
{
// now + (1ora * 24 * 4 gg)
setcookie("User", $_POST["textUser"], time()+(3600 * 24 * 4));
$txtUserCookie = $_POST["textUser"];
if ($bLoggedIn = Login($_POST["textUser"], $_POST["textPassword"]))
{
$sMessage = WA_MSG_LOGIN_WELCOME.' <B>'.$_SESSION["gsUser_Name"]." ".$_SESSION["gsUser_Surname"]."</B>";
$sMessage .= "<BR>".WA_MSG_LOGIN_ACCEPTED;
$sRedirect = AddSessionInUrl("menu.php");
}
else
{
$sMessage = "<B>".WA_MSG_LOGIN_NOTAUTHORIZED."</B>";
}
}
// $sRedirect = "";
PrintHTMLHeader("phparchive Login", $sRedirect);
?>
<body class="BodyStandard">
<?php include "header.php"; ?>
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td>
<form name="formLogin" method="post" action="index.php" class="Form" onsubmit="return setSubmitFired();">
<table border="0" cellpadding="2" cellspacing="2" class="FormTableE" align="center">
<tr>
<td colspan="2">
<div class="Bold">
<?php
echo "<BR>";
echo $sMessage;
echo "<BR><BR>";
?>
</div>
</td>
</tr>
<?php
if (!$bLoggedIn)
{
?>
<tr>
<td>
<div class="FieldStd"><?php echo WA_LBL_USERNAME; ?></div>
</td>
<td>
<input class='Inputs' type="text" name="textUser" size="20" maxlength="20" value=<?php echo "'".$txtUserCookie."'"; ?> >
</td>
</tr>
<tr>
<td class="FieldStd"><?php echo WA_LBL_PASSWORD; ?></td>
<td>
<input class='Inputs' type="password" name="textPassword" size="20" maxlength="20">
</td>
</tr>
<tr>
<td> </td>
<td>
<input class="Buttons" type="submit" name="cmdEnter" value="Enter">
</td>
</tr>
<?php
}
?>
</table>
</form>
</td>
</tr>
</table>
<?php
include "footer.php";
?>
</body>
</html>