<?php
define( '_UEXEC', 1 ); 
/************************************************************************
	UebiMiau is a GPL'ed software developed by 
	
	 - Aldoir Ventura - aldoir@users.sourceforge.net
	 - http://uebimiau.sourceforge.net
	
	Fell free to contact, send donations or anything to me :-)
	São Paulo - Brasil
	
	**********************************************
	Version 3.2.0 Upgrades and templates developed by
	 
	 - Todd Henderson - Lead Developer
	 - http://tdah.us
	 - Email: todd@tdah.us
	 
	 - Dave Rodgers - Project Consultant
	 - http://www.manvel.net 
	 - Email: Davenmanvel@inbox.com
	
	Feel free to contact us, send donations or anything to me as well...
	
	Special thanks to the developers at telaen.org, codeworxtech.com, tinymce.moxiecode.com
	without help this project wouldn't be possible 

	**********************************************
	- File:			admin/login.php
	- Developer: 	Todd Henderson / Mods by Laurent (AdNovea)
	- Date:			
	- version:		
	- Description:  Administration user login page

*************************************************************************/


	require_once('common.php');
	
	$error = '0';
	
	if (isset($_POST['submitBtn'])) {
		// Get user input
		$username = isset($_POST['username']) ? $_POST['username'] : '';
		$password = isset($_POST['password']) ? $_POST['password'] : '';
			
		// Try to login the user
		$error = loginUser($username,$password);
	}
	
	$html = DOC_TYPE."
	<html>
	<head>
		<meta http-equiv=\"Content-Type\" content=\"text/html; charset=$default_char_set\">
		<title>$admin_copyright</title>
		<link rel=\"stylesheet\" href=\"../themes/$selected_theme/css/admin.css\" type=\"text/css\">
	</head>
	
	<body>
		<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\" name=\"loginform\">
		<input type=\"hidden\" name=\"lid\" value=\"$lid\">
		<input type=\"hidden\" name=\"tid\" value=\"$tid\">
		<center>
		<div id=\"main\">";
    
	if ($error != '') {
	
		$html .= "<div class=\"caption\">$admin_title</div>
			<div id=\"icon\">&nbsp;</div>
			<div id=\"result1\" style=\"width: 286px; height: 75px\">
				<table width=\"100%\" class=\"login_table\">
				<tr><td>$admin_username</td><td> <input class=\"text\" name=\"username\" type=\"text\" ></td></tr>
				<tr><td>$admin_password</td><td> <input class=\"text\" name=\"password\" type=\"password\"></td></tr>
				<tr><td colspan=\"2\" align=\"center\"><input class=\"button\" type=\"submit\" name=\"submitBtn\" value=\"$admin_bt_login\"></td></tr>
				</table>  
			</div>";
	}
		
	if (isset($_POST['submitBtn'])) {
	
		$html .= "
			<div class=\"caption\">$admin_login_result</div>
			<div id=\"icon2\">&nbsp;</div>
			<div id=\"result\" style=\"width: 286px; height: 90px\">
			<table width=\"100%\" class=\"login_table\">
			<tr><td><br>";
			
		if ($error == '') 
			redirect("index.php?lid=$lid&tid=$tid");
		else 
			$html .= $error;
		
		$html .= "
			<br><br><br></td></tr>
			</table>
		</div>";
	}
	
	$html .=  "
		<div id=\"source\">$admin_copyright</div>
		</div>
		</center>
		</form>
	</body>
	</html>";
	
	echo $html;

?>
