<?php

/**
 * @package eggblog
 * @author eggblog.net, tenfourzero@users.sourceforge.net
 * @version $Id: global.php,v 4.0.0RC1 2007/12/03 10:26:12 tenfourzero Exp $
 * @copyright Copyright (c) 2005, http://www.eggblog.net
 * @license http://www.gnu.org/licenses/gpl.html GNU Lesser General Public License
 */

/**
 * require lib files
 */
require_once "_lib/global.php";

if(empty($_SERVER["HTTP_REFERER"])) $_SERVER["HTTP_REFERER"]="index.php";
foreach($_POST as $key=>$value) $_POST[$key]=htmlentities($value,ENT_QUOTES);
if(isset($_POST["email"]) && isset($_POST["password"])) {
	if(eb_login($_POST['email'],$_POST['password'],0)) header("Location: ".$_SERVER["HTTP_REFERER"]);
	else {
		if(strpos($_SERVER["HTTP_REFERER"],"?")) $_SERVER["HTTP_REFERER"].="&login=fail";
		else $_SERVER["HTTP_REFERER"].="?login=fail";
		header("Location: ".$_SERVER["HTTP_REFERER"]);
	}
}
else header("Location: ".$_SERVER["HTTP_REFERER"]);
?>