<?php
	session_start();
	$auid = isset($_POST['auid']) ? $_POST['auid'] : $_SESSION['auid'];
	$pwd = isset($_POST['pwd']) ? $_POST['pwd'] : $_SESSION['pwd'];

	if(!isset($auid)) {
		loginform();
		exit;
	}
	if( $auid != $adlogin || $pwd != $adpassword ){
		unset($_SESSION['auid']);
		unset($_SESSION['pwd']);
		loginform();
		exit;
	}else if( $auid == $adlogin && $pwd == $adpassword ){
		$_SESSION['auid'] = $auid;
		$_SESSION['pwd'] = $pwd;
	}
?>
<?
	function loginform(){
		global $sitename;
		include("admin/header.php");
?>
		<CENTER>
		<BR>
		<FONT FACE=verdana color=#FFFFFF size=5><B><?=$sitename?> Login</B></FONT>
		<BR>
		<TABLE cellspacing=0>
		<FORM method=post>
		<TR><TD>Username:
			<TD><INPUT type=text name=auid size=16>
		<TR><TD>Password:
			<TD><INPUT type=password name=pwd size=16>
		<TR><TD colspan=2><INPUT type=submit value="Log In >>"></TD>
		</FORM>
		</TABLE>
		<BR>
<?
		include("admin/footer.php");
	}
?>