<?php
//加载
require_once ("../manager_include.inc");

// 参数取得
$login = ParamUtil::getRequestString("login");
$password = ParamUtil::getRequestString("password");

ErrorLogger::doOutput("Koala...ajax_login.php....Start.", 0);

ErrorLogger::doOutput("Koala...ajax_login.php....login=" . $login, 0);
ErrorLogger::doOutput("Koala...ajax_login.php....password=" . $password, 0);


$login = ParamUtil::getRequestString("login");
$password = ParamUtil::getRequestString("password");

$login_ok = false;

if (!empty($login) && !empty($password)) {
	$_account = AccountHandler::getAccountByLoginPassword($login, $password);
	if ($_account != null) {
		$_SESSION["account"] = $_account;
		$login_ok = true;
	}
}

ErrorLogger::doOutput("Koala...ajax_login.php....End.", 0);

if ($login_ok) {
	responseOK("登陆成功！");
	
} else {
	responseNG("登陆失败！");
}

function responseNG($message) {
	$result = array("status"=>"NG", "message"=>$message);
	print json_encode($result);
	exit;
}
function responseOK($message) {
	$result = array("status"=>"OK", "message"=>$message);
	print json_encode($result);
	exit;
}

?>

