<?php
session_start();
ob_start();
include("./inc/pw.php");
include("./inc/jscript.php");
include("./inc/routine.php");
if ($_POST["ac"]=="log") { /// do after login form is submitted
if ($USERS[$_POST["username"]]==$_POST["password"]) { /// check if submitted
// username and password exist in $USERS array
$_SESSION["logged"]=$_POST["username"];
} else {
echo'<br /><br /><table width="400" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td colspan="2" align="center"><h1>INCORRECT INFORMATION - PLEASE TRY AGAIN!</h1></td>
</tr>
</table>';
};
};
if (array_key_exists($_SESSION["logged"],$USERS)) { //// check if user is logged or not
echo "You are logged in.";
header("Location: indexlog.php"); //// if user is logged show a message
} else { //// if not logged show login form
echo'<br /><br /><table width="400" border="0" align="center" cellpadding="5" cellspacing="0">
<form action="index.php" method="post"><input type="hidden" name="ac" value="log">
<tr>
<td colspan="2" align="center"><a href="http://www.flashfiles.biz" target="_blank"><img src="img/splash.jpg" alt="Template Administration" width="400" height="100" border="0" longdesc="http://www.flashfiles.biz" /></a></td>
</tr>
<tr>
<td><span class="menu">Username:</span></td>
<td align="center"><input type="text" name="username" /></td>
</tr>
<tr>
<td><span class="menu">Password:</span></td>
<td align="center"><input type="password" name="password" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Login" /></td>
</tr>
</form>
</table>';
};
?>