<?php
    include_once  '../config.php';
    error_reporting(0);
	$feed=isset($_GET['feed'])?$_GET['feed']:'gift';	
	$caption=isset($_GET['caption'])?$_GET['caption']:'Please enter the invitation code to get a big gift！';
	$name = 'CODE:'.$_GET['code'] ?? 15859392;
	$conent = $rootPath . '/img/feed/'.$feed.'.jpg';
	$code = $_GET['code'] ?? 15859392;
	$url = $rootPath . '/m/gift.php?feed='.$feed.'&caption='.$caption.'&name='.$name.'&type=2&code='.$code;

    $paramList = $_GET;
    $paramStr = '?';
    foreach ($paramList as $n => $val) {
        $paramStr .= $n.'='.$val.'&';
    }
    $paramStr = rtrim($paramStr, '&');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=0.66"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">  
<meta name="Keywords" content="super Texas Hold'em, poker,Omaha Poker,Baccarat,slot,casino,solitire,card, Texas Hold'Em Poker" />
<meta name="description" content="join and enjoy Super Texas Hold'em poker game.Play Texas Hold'em,Omaha Poker and Baccarat in one app." />
<meta property="og:type" content="game" />
<meta property="fb:app_id"      content="<?php echo $fbId;?>" />
<meta property="og:image"       content="<?php echo $conent;?>" />
<meta property="og:url"         content="<?php echo $url;?>" />
<meta property="og:title"       content="<?php echo $caption;?>" />
<meta property="og:description" content="<?php echo $name;?>" />
<meta property="al:ios:url"          content="<?php echo $appleOpenUrl;?>" />
<meta property="al:ios:app_store_id" content="<?php echo $appId;?>" />
<meta property="al:ios:app_name"     content="<?php echo $appName;?>" />
   <title><?php echo $appName;?></title>
    <style>
    /*@charset "UTF-8";*/
    /* CSS Document */
    .menu {
        margin:0 auto;
        border:1pt solid #999999;
        border-radius:5px;
        -webkit-border-radius: 5px;
        -moz-border-radius: 5px;
    }
    .menu a {
        text-decoration:none; 
        height:100%; 
        display:block;
        border-radius:5px;
        -webkit-border-radius: 5px;
        -moz-border-radius: 5px; color:#333;
    }
    .menu a:visited {
        text-decoration:none; 
        color:#000000;
    }
    .menu a:active {
        text-decoration:none;
    }
    .link-web{
        width:210px;
        height:40px;
        margin:0 auto;
        border-radius:4px;
        -webkit-border-radius: 4px;
        -moz-border-radius: 4px;
        /*text-shadow:0 2px 0 #FFF;*/
        font-family: "", "";
        font-size:18px;
    }
    .link-web a{ 
        text-decoration:none; 
        width:210px; 
        height:40px; 
        display:block;
        border-radius:4px;
        -webkit-border-radius: 4px;
        -moz-border-radius: 4px; 
        background-color: #F5F5F5;
        border:1px dashed #cccccc;
        color:#333;
    }
    .link-web a:visited{
        text-decoration:none; 
        color:#333;
    }
    .link-web a:active{ 
        text-decoration:none; 
        color:#333;
    }
    .font-arial{
        font-family: "微软雅黑", "", Arial, "Arial Black";
    }
    .font-italic{
        font-style:italic;
    }
    .font-blod{
        font-weight:bold;
    }
    .font-app{
        text-align:left;
        font-size:25px;
        color: #666666;
    }
    .font-app-display{
        text-align:left;
        font-size:20px;
        color:#999999;
        text-shadow:0 2px 0 #FFF;
    }
    .font02{ 
        font-size:18px; color:#999999;
        text-align:left;
    }
    .dp_copy{ 
        margin-top:40px;
        text-align:left;
        color:#919090; 
        font-size:22px; 
    }
    </style>
    <script>
    // function GetQueryString(name)
    // {
    //      var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    //      var r = window.location.search.substr(1).match(reg);
    //      if(r!=null)return  unescape(r[2]); return null;
    // }
    // var imgName = GetQueryString('feed');
    //console.log(imgName);
    //var meta = document.getElementsByTagName('meta');
    //console.log(meta[18].getAttribute('content'));
    //meta[19].setAttribute('content', '<?php echo $rootPath;?>/img/feed/'+imgName);
    //console.log(meta[18].getAttribute('content'));
    // Android
    var URL = "<?php echo $googleOpenUrl.$paramStr;?>";
    var MARKET = "market://details?id=<?php echo $packageName;?>";

    // IOS
    var IOS = "<?php echo $appleOpenUrl.$paramStr;?>";
    var ITUNES = "<?php echo $appleUrl;?>";//appstore

    // PC
    var PCURL  = "<?php echo $fbWebUrl;?>";

    function onLoad() {
        if (navigator.userAgent.match(/Android/)) {
            var iframe = document.createElement("iframe");
            iframe.style.visibility = 'hidden';
            iframe.style.border = "none";
            iframe.style.width = "1px";
            iframe.style.height = "1px";
            iframe.src = URL;
            iframe.onload = function () { window.location = MARKET; };
            document.body.appendChild(iframe);
//            window.location.href = '<?php echo $googleAppDownloadUrl;?>';
            window.location.href = '<?php echo $googleUrl;?>';
        } else if (navigator.userAgent.match(/(iPhone|iPad|iPod)/i)) {
            // IOS
            setTimeout(function() {
                    window.location = ITUNES;
            }, 500);
            window.location = IOS;
        } else {
             window.location.href = PCURL;
        }
    }
    </script>
</head>
<!-- <body style="margin:0; padding:0; background:#EFEFEF;text-align:center" onload="onLoad()"> -->
<body style="margin:0; padding:0; background:#EFEFEF;text-align:center" onload="onLoad()">
    <div id="page-android" style="width:400px; height:800px; margin:0 auto; display:;">
        <div style="padding:40px 0 10px 0">
            <img src="<?php echo $rootPath;?>/img/icon144.jpg" alt="superpoker" />
        </div>
        <div class="font-arial" style="font-size:20px; line-height:34px; height:45px; text-shadow:0 2px 0 #FFF; color:#999999; text-shadow: white 2px 2px; font-weight: bold; letter-spacing:2px;">Super Poker-Best Free Texas Holdem poker</div>
        <p class="dp_copy">Texas Hold’em is  popular game in the world,fun and exciting, millions of people are play online, happy all the time</p>
        <br/>
		<div class="font-arial" style=" width:400px; font-size:20px; line-height:30px; height:50px; color:#999999; letter-spacing:2px; text-align:left; margin: 0 auto;">Select the applicable version in your machine:</div>
        <br/>
		
		<div  style="width:400px; height:100px;">
            <a href="<?php echo $appleUrl;?>" target="superpoker">
                <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" height="100px">
                    <tr>
                        <td width="100" align="center" valign="middle" >
                            <img src="<?php echo $rootPath;?>/img/ios.jpg" alt="" border="0"  />
                        </td>
                 
                       
                    </tr>
                </table>
            </a>
        </div>
        <div style="height:60px;"></div>
        <div style="width:400px; height:100px;">
            <?php if($flag === 'offline'){ ?>
                <a href="<?php echo $googleAppDownloadUrl;?>">
            <?php }else{ ?>
                 <a href="market://details?id=<?php echo $packageName;?>">
            <?php }?>

                <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" height="100px">
                    <tr>
                        <td width="100" align="center" valign="middle">
                            <img src="<?php echo $rootPath;?>/img/android.jpg" alt="" border="0" />
                        </td>

                    </tr>
                </table>
            </a>
        </div>
        <br/>
        <br/>
        <br/>
        <a id="copy" style="height:20px; font-size:22px;font-family: 微软雅黑; text-shadow:0 2px 0 #FFF; text-align:center; margin:0px" href="<?php echo $fbFansUrl;?>">Fan page</a>
         <br/>
        <br/>
		 <br/>
		<div id="copy" style="height:18px; color:#999999; font-size:15px;font-family: 微软雅黑; text-shadow:0 2px 0 #FFF; text-align:center; margin:0px">Copyright © 2017 SuperAnt Technology Co., Ltd..All Rights Reserved.</div>
    </div>
</body>
</html>
