<?php
/*
######################     ARTICLE     #####################
############################################################
ARTMAN			$Name: release_version1_0_03112006 $
Revision		$Revision: 1.2 $
Author			$Author: zelteto $
Created 03/01/03        $Date: 2006/10/21 17:44:23 $
Writed by               GraFX (webmaster@grafxsoftware.com)
Scripts Home:           http://www.grafxsoftware.com
############################################################
*/
include_once("../config.inc.php");
include_once(INCLUDE_PATH.'cls_session.php');
$sess = new MYSession();
include_once(INDEX_PATH."cls_fast_template.php");
include_once(INCLUDE_LANGUAGE_PATH.$LANG.".inc.php");
include_once(INCLUDE_LANGUAGE_PATH.$LANG.".admin.inc.php");
include_once(INCLUDE_ADMIN_PATH."authenticate.php");
include_once(INCLUDE_PATH."cls_string.php");
		

$stringutil = new String("nope");
$all_url_vars = array();
$all_url_vars = $stringutil->parse_all();

if(empty($all_url_vars['action']))
{
	// unset session
	$url = $sess->get('session_url_before');
	session_destroy();
	$sess = new MYSession();
	$sess->set('session_url_before',$url);
	$ft = new FastTemplate(ADMIN_TEMPLATE_CONTENT_PATH);
	$ft->define(array("main"=>"template_firstpage.html", "content"=>"login.html"));
	$ft->assign("ADMIN_URL", ADMIN_URL);
	$ft->assign("VERSION", VERSION );
	$ft->assign("MESSAGE", $all_url_vars['message']);
	$ft->multiple_assign_define("LANG_");
	$ft->multiple_assign_define("CONF_");
	$ft->parse("BODY", array("content","main"));
	$ft->showDebugInfo(ERROR_DEBUG);
	$ft->FastPrint();
}
else
{
	if(($all_url_vars['userid'] == USER) && ($all_url_vars['password'] == PASSWORD))
	{
		$sess->set(SESSION_ID,SESSION_ID);
		if ($sess->get('session_url_before'))
			header("Location: ".$sess->get('session_url_before'));
		else
			header("Location: ".ADMIN_URL);
	}
	else
	{
		$ft = new FastTemplate(ADMIN_TEMPLATE_CONTENT_PATH);
		$ft->define(array("main"=>"template_firstpage.html", "content"=>"authentication_failed.html"));
		$ft->assign("ADMIN_URL", ADMIN_URL);
		$ft->assign("VERSION", VERSION );
		$ft->assign("ADDON","<br /><br />");
		$ft->multiple_assign_define("LANG_");
		$ft->multiple_assign_define("CONF_");
		$ft->parse("BODY", array("content","main"));
		$ft->showDebugInfo(ERROR_DEBUG);
		$ft->FastPrint();
	}
}
?>