<?php
session_start();
require_once "./stat.class.php";
$stat = new stat();
if(!isset($_SESSION["sessionId"])){
    $_SESSION["sessionId"]=generateRandomString();
}
function generateRandomString($length = 40) {
    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $charactersLength = strlen($characters);
    $randomString = '';
    for ($i = 0; $i < $length; $i++) {
        $randomString .= $characters[rand(0, $charactersLength - 1)];
    }
    return $randomString;
}
$sessionData["sessionId"] = $_SESSION["sessionId"];
$sessionData['HTTP_USER_AGENT'] = $_SERVER['HTTP_USER_AGENT'];
$sessionData['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR'];
if(isset($_SERVER['REMOTE_HOST'])){
    $sessionData['REMOTE_HOST'] = $_SERVER['REMOTE_HOST'];
} else {
    $sessionData['REMOTE_HOST'] = $_SERVER['REMOTE_ADDR'];
}
$sessionData['QUERY_STRING'] = $_SERVER['QUERY_STRING'];
$sessionData['HTTP_ACCEPT'] = $_SERVER['HTTP_ACCEPT'];
if(isset($_SERVER['HTTP_ACCEPT_CHARSET'])){
    $sessionData['HTTP_ACCEPT_CHARSET'] = $_SERVER['HTTP_ACCEPT_CHARSET'];
} else {
    $sessionData['HTTP_ACCEPT_CHARSET'] = '';
}
$sessionData['HTTP_ACCEPT_ENCODING'] = $_SERVER['HTTP_ACCEPT_ENCODING'];
$sessionData['HTTP_ACCEPT_LANGUAGE'] = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
$sessionData['HTTP_CONNECTION'] = $_SERVER['HTTP_CONNECTION'];
$sessionData['HTTP_HOST'] = $_SERVER['HTTP_HOST'];
$sessionData['REQUEST_URI'] = $_SERVER['REQUEST_URI'];
$sessionData['REQUEST_METHOD'] = $_SERVER['REQUEST_METHOD'];
if(isset($_SERVER['HTTP_REFERER'])){
    $sessionData['HTTP_REFERER'] = $_SERVER['HTTP_REFERER'];
} else {
    $sessionData['HTTP_REFERER'] = '';
}
if(isset($_SERVER['REMOTE_USER'])){
    $sessionData['REMOTE_USER'] = $_SERVER['REMOTE_USER'];
} else {
    $sessionData['REMOTE_USER'] = '';
}
if(isset($_SERVER['REDIRECT_REMOTE_USER'])){
    $sessionData['REDIRECT_REMOTE_USER'] = $_SERVER['REDIRECT_REMOTE_USER'];
} else {
    $sessionData['REDIRECT_REMOTE_USER'] = '';
}
$sId=$stat->insert($sessionData);
?>
<!doctype html>
<html lang="en">
<head>
    <script rel="javascript" type="text/javascript" src="jquery-2.1.1.min.js"></script>
    <script language="JavaScript">
        var sId="<?php echo $sId; ?>";
        var screenSize = (screen.width+'x'+screen.height);
        screenSize = screenSize !== undefined ? screenSize : false;
        var windowSize = $(window).width()+'x'+$(window).height();
        windowSize = windowSize !== undefined ? windowSize : false;
        var nPlugins="";
        for(key in navigator.plugins) {
            var plugin = navigator.plugins[key];
            nPlugins+= plugin.name+'-*-*-';
        }
        var nHardwareConcurrency = navigator.hardwareConcurrency;
        nHardwareConcurrency = nHardwareConcurrency !== undefined ? nHardwareConcurrency : false;
        var nCpuClass = navigator.cpuClass;
        nCpuClass = nCpuClass !== undefined ? nCpuClass : false;

        $.ajax({
            type: "POST",
            url: "statR.php",
            data: { 'sId':sId, 'screenSize':screenSize, 'windowSize':windowSize, 'nPlugins':nPlugins, 'nHardwareConcurrency': nHardwareConcurrency, 'nCpuClass':nCpuClass}
        });
        if( !/iPad|iPhone|iPod|Mac/.test(navigator.platform) ) {
            document.location.href = "https://play.google.com/store/apps/details?id=co.vixt.vixt";
        }else {
            document.location.href = "https://itunes.apple.com/us/app/vixt-lite/id1081664872?ls=1&mt=8";
        }
    </script>
    <meta charset="UTF-8">
    <title>VixT is on App Store | DOWNLOAD IT NOW</title>
    <meta property="og:url"                content="http://vixt.co/app/index.php" />
    <meta property="og:type"               content="article" />
    <meta property="og:title"              content="VixT is on App Store and Google Play| DOWNLOAD IT NOW" />
    <meta property="og:description"        content="Video mashup from text | Get it now until it's FREE | Build your own unique library or use other people's videos to express yourself like never before! The first REAL video sharing app ever." />
    <meta property="og:image"              content="http://vixt.co/assets/thubn.png" />
</head>
<body itemscope itemtype="http://schema.org/WebPage" style="text-align: center">
    <h1>VixT is on App Store and Google Play| DOWNLOAD IT NOW</h1>
    <a href="https://play.google.com/store/apps/details?id=co.vixt.vixt"><img src="thubn.png" alt=""><br/></a>
    <a href="https://itunes.apple.com/us/app/vixt-lite/id1081664872?ls=1&mt=8"><img src="thubn.png" alt=""><br/></a>
    <span>Video mashup from text | The hottest iPhone app of the year! Get it now until it's FREE | Build your own unique library or use other people's videos to express yourself like never before! The first REAL video sharing app ever.</span>
</body>
</html>
