<?php

/******************************************************************************
 *
 *	PROJECT: Flynax Classifieds Software
 *	VERSION: 4.0
 *	LISENSE: http://www.flynax.com/license-agreement.html
 *	PRODUCT: General Classifieds
 *	
 *	FILE: LOGIN.INC.PHP
 *
 *	This script is a commercial software and any kind of using it must be 
 *	coordinate with Flynax Owners Team and be agree to Flynax License Agreement
 *
 *	This block may not be removed from this file or any other files with out 
 *	permission of Flynax respective owners.
 *
 *	Copyrights Flynax Classifieds Software | 2012
 *	http://www.flynax.com/
 *
 ******************************************************************************/

if ( !defined('IS_LOGIN') )
{
	if ( isset($_POST['action']) && $_POST['action'] == 'login')
	{
		$username = $_POST['username'];
		$password = $_POST['password'];
		
		if ( true === $res = $rlAccount -> login( $username, $password ) )
		{
			$rlHook -> load('loginSuccess');
			$reefless -> referer();
		}
		else 
		{
			if ( $rlAccount -> messageType == 'error' )
			{
				$rlSmarty -> assign_by_ref( 'errors', $res );
			}
			else
			{
				$rlSmarty -> assign_by_ref( 'pAlert', $res[0] );
			}
		}
	}
	
	if (isset($_GET['logout']))
	{
		$rlHook -> load('logOut');
		$rlSmarty -> assign( 'pNotice', $lang['notice_logged_out'] );
	}
}
else
{
	if ( isset($_GET['action']) && $_GET['action'] == 'logout')
	{
		$rlAccount -> logOut();
	}
}