<?php
	// include '../../api/LinkSql/Api_Sql_5.php';
  include '../../api/Model/Sdk_Browser_parameters.php';
  $Language = Get_Language();
  $Game = $_GET['Game'];
  $Code = $_GET['Code'];
	include 'Asstes/Php/Echo_Con.php';
	WhatCon($Game, $Language);
?>
<!doctype html>
<html lang="<?php echo $Lang?>">
	<head>
		<meta charset="utf-8">
		<title><?php echo $Title?></title>

		<meta property="al:ios:url" content="<?php echo $Al_Ios_Url?>" />
		<meta property="al:ios:app_store_id" content="<?php echo $Al_Ios_App_Store_Id?>" />
		<meta property="al:ios:app_name" content='<?php echo $Al_Ios_App_Name?>' />

		<meta property="al:android:url" content="<?php echo $Al_Android_Url?>" />
		<meta property="al:android:app_name" content='<?php echo $Al_Android_App_Name?>' />
		<meta property="al:android:package" content="<?php echo $Al_Android_Package?>" />

		<meta property="fb:app_id" content="<?php echo $Fb_App_Id?>"/>
		<meta property="og:title" content="<?php echo $Og_Title?>"/>
		<meta property="og:type" content="<?php echo $Og_Type?>"/>
		<meta property="og:image:type" content="<?php echo $Og_Image_Type?>"/>
		<meta property="og:image:width" content="<?php echo $Og_Image_Width?>"/>
		<meta property="og:image:height" content="<?php echo $Og_Image_Height?>"/>
		<meta property="og:image" content="<?php echo $Og_Image?>"/>
		<meta property="og:url" content="<?php echo $Og_Url.'?Game='.$Game.'&Code='.$Code;?>"/>
		<meta property="og:description" content="<?php echo $Og_Description.$Code;?>"/>
	</head>

	<body>
	</body>
	<script>
//获取Url参数
function GetUrlKey(name) {
  var reg = new RegExp('(^|&)'+ name +'=([^&]*)(&|$)');
  var r = window.location.search.substr(1).match(reg);
  if(r!=null)return  unescape(r[2]); return null;
}
//识别用户设备（Android || Ios）
function WhatDevice() {
  var u = navigator.userAgent;
  var ua = navigator.userAgent.toLowerCase();
  var IsAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1;
  var IsIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
  if (IsAndroid) {
    return 'Android';
  } else if (IsIOS) {
    return 'Ios';
  } else {
    return '0';
  }
}
//识别用户设备语言
function WhatLanguage() {
  $Luanguage = (navigator.language || navigator.browserLanguage).toLowerCase();
  if ($Luanguage == 'zh-cn') {
    $Luanguage = 'CN';
  } else if ($Luanguage == 'en-us') {
    $Luanguage = 'US';
  } else if ($Luanguage == 'zh-hk') {
    $Luanguage = 'HK';
  } else {
    $Luanguage = 'EN';
  }
  return $Luanguage;
}
		$Device = WhatDevice();
		$Language = WhatLanguage();
		$Game = GetUrlKey('Game');
    
        /*
		$.ajax({
			type: "POST",
			url: 'Asstes/Php/Multiple_Statistics.php',
			dataType: 'json',
			timeout: 15000,
			data: {
				Rid: '2.1',
				Behavior: 'Open(Windows)',
				Device: $Device,
				Language: $Language,
				Game: $Game
			},
			success: function (data) {
				console.log(1);
			}
		});
        */
		if (($Device == 'Ios') && ($Game == 'COZ2')) {
			window.location.href = 'https://itunes.apple.com/us/app/clash-of-zombies2-hero-royale/id1168563046';
		} else if (($Device == 'Android') && ($Game == 'COZ2')) {
			window.location.href = 'https://play.google.com/store/apps/details?id=com.bettergame.clashhero';
		} else if (($Device == 'Ios') && ($Game == 'COZ1')) {
			window.location.href = 'https://itunes.apple.com/hk/app/x-war-clash-of-zombies/id608847384';
		} else if (($Device == 'Android') && ($Game == 'COZ1')) {
			window.location.href = 'https://play.google.com/store/apps/details?id=com.forulo.pkcheshy';
		} else if (($Device == 'Ios') && ($Game == 'DL')) {
			window.location.href = 'https://itunes.apple.com/us/app/heroes-legend-idle-rpg/id1323924595';
		} else if (($Device == 'Android') && ($Game == 'DL')) {
			window.location.href = 'https://play.google.com/store/apps/details?id=com.caesars.lastlegend';
		}
	</script>
</html>
