<?php
session_start();
header("Content-type: text/html;charset=utf-8");

$leguorigjson = $_REQUEST['leguorigjson'];
$legusign = $_REQUEST['legusign'];
$legutime = $_REQUEST['legutime'];

if(!$leguorigjson || !$legusign || !$legutime){
	exit("参数缺失 自动登录失败");
}

if($legutime*1 + 300 < time()){
	//exit("已过有效期 请重新登录");
}

if( md5($leguorigjson.$legutime.'BJCCG28qFCzRNtRDcrW8TfqhjyzbXWt5') != $legusign ){
	exit("签名错误 自动登录失败");
}

define('ROOT', dirname(__FILE__).DIRECTORY_SEPARATOR);
$user = json_decode($leguorigjson,true);
$_SESSION['leguworkUser'] = $user;

header("Location:./?app=autologin");