<?php
session_start();
$key_code = $_SESSION['RoshutsuYuuka_key'];
$check_flg = false;
if(!empty($key_code)){
	$check_flg = true; 
}
if(!strpos('true',$_SERVER['REQUEST_URI'])){
	$_SESSION['ReleseLimit'] = date("Y-m-d",strtotime("+7 day"));
}
if(array_key_exists('ReleseLimit',$_SESSION)){
	if($_SESSION['ReleseLimit']>=date("Y-m-d",strtotime("day"))){
		if(strpos('?true',$_SERVER['REQUEST_URI'])){
			$URI = $_SERVER['REQUEST_URI'];
			$URI = str_replace('&?true','',$URI);
			if($_SERVER['HTTP_HOST']!="localhost"){
				header( 'Location: https://'.$_SERVER['HTTP_HOST'].$URI);
			}else{
				header( 'Location: http://'.$_SERVER['HTTP_HOST'].$URI.'&?Pass');
			}
		}
	}
}
?>
<!doctype html>
<html lnag="ja">
	<head>
		<meta charset="UTF-8" />
		<title>ブラウザ版</title>
		<meta name="viewport" content="width=device-width">
		<link rel="stylesheet" type="text/css" href="./css/degine.css?0003">
	</head>
	<body id="body" class="body_degine">
	<script>
	function check(){
		if(!window.opener || window.opener.closed){ // メインウィンドウの存在をチェック
			document.location.href = "https://littleambition.qc-soft.com/"; // 存在する場合はページを切りかえる
		}
	}
	check();
	</script>
	<?php
	if($check_flg){
		//ゲームスタート
		echo'
			<script src="./game.js?202409292330"></script>
			<script>
				xmlDataForHtml.replace("%tilte%",document.title);
				document.write(xmlDataForHtml);
			</script>
			?>
		';
	}else{
		http_response_code( 301 );
		header( "Location: https://littleambition.qc-soft.com/");
		exit ;
	}
	?>
	</body>
</html>