<?

require_once '../functions/access.class.php';
$user = new flexibleAccess();
if ( $_GET['logout'] == 1 ) 
	$user->logout('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']);
if ( !$user->is_loaded() )
{
	//Login stuff:
	if ( isset($_POST['uname']) && isset($_POST['pwd'])){
	  if ( !$user->login($_POST['uname'],$_POST['pwd'],$_POST['remember'] )){//Mention that we don't have to use addslashes as the class do the job
	    echo 'Wrong username and/or password';
	  }else{
	    //user is now loaded
	    header('Location: http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']);
	  }
	}

     echo '

<br>
<table align=center border=1>
<td align=center class="header">
LOG IN
<tr>
<td>
<table align=center border=0>
	<form method="post" action="'.$_SERVER['PHP_SELF'].'" />
	 <td valign=top width=140 class=Text12>User Name <td valign=top><input class="login" type="text" name="uname" />
		<tr>	
	 <td valign=top class=Text12>Password <td valign=top><input class="login" type="password" name="pwd" />
		<tr>
	 <td valign=top class=Text12>Remember Me <td valign=top><input type="checkbox" name="remember" value="1" />&nbsp; &nbsp; &nbsp;	 <input class="buttonveryshort" type="submit" value="Log In" />
	</form>
	</td></table></td></table><br><br>';

  
}else{

$userID = $user->get_property('userID');
$area="contact";
}
?>
