<?php
error_reporting(0);
session_start();

$emptyPhoneNumber       = false;
$emptyName              = false;
$registrationSuccess    = false;
$registrationFailed     = false;
$registrationFailedMsg  = '';

if( $_POST['action'] == 'register' ) {
    if( $_POST['verifycode'] == $_SESSION['login'] ) {

        // Check if phoneNumber and name is empty or not
        $phoneNumber    =   htmlentities($_POST['phoneNumber']);
        $name           =   htmlentities($_POST['name']);

        if($phoneNumber == '') {
            $emptyPhoneNumber   =   true;
        }
		/*
        if($name == '') {
            $emptyName   =   true;   
        }
		*/

		//if($phoneNumber != '' && $name != '') {
        if($phoneNumber != '') {

            // Call API here
            $registerUrl	= 'http://api.12wincasino.info/API_V2/api/landing_page_register';
			$millis			= round(microtime(true) * 1000);
			$secret			= sha1($millis . 'YhrT4Ca35jvHHf7N');
			$language		= 'en';
			if( empty($_GET['source']) ){
				$source         = 'EWIN Landing Page';
			}elseif( $_GET['source']=='apps' ){
				$source         = 'PLAYSTORE';
			}
            $company        = 'BT';
            $agent          = '210';
            $headerValue    = 'UXMXLmXMUmep7mDN';
			
			if(!empty($_SERVER['HTTP_CLIENT_IP'])){
				//check ip from share internet
				$ip=$_SERVER['HTTP_CLIENT_IP'];
			}elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
				//to check ip is pass from proxy
				$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
			}else{
				$ip=$_SERVER['REMOTE_ADDR'];
			}

            $postFields = array(
                'language'    => $language,
                'secret'      => $secret,
                'millis'      => $millis,
                'phoneNumber' => $phoneNumber,
                'source'      => $source,
                'agent'       => $agent,
                'company'     => $company,
                'ip'      	  => $ip
                );

            $curlInit = curl_init();
            curl_setopt($curlInit, CURLOPT_HTTPHEADER, array('Authorization: '.$headerValue));
            curl_setopt($curlInit, CURLOPT_URL, $registerUrl);
            curl_setopt($curlInit, CURLOPT_RETURNTRANSFER, true);   
            curl_setopt($curlInit, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($curlInit, CURLOPT_POST, true);
            curl_setopt($curlInit, CURLOPT_POSTFIELDS, $postFields);

            $curlResponse = curl_exec($curlInit);
            curl_close ($curlInit); 

            $returnValue = json_decode($curlResponse);

            if($returnValue->status === 'SUCCESS') {
                $registrationSuccess    = true;
            } else {
                $registrationFailed     = true;
                $registrationFailedMsg  = $returnValue->message;
            }
        }

    }

}
	///////////////// get txt file data /////////////////

	$fh = fopen('../agent/agent_info.txt','r');
	if($line = fgets($fh)){
		$info_dump = json_decode($line, true);
	}
	fclose($fh);

	//echo 'test<pre>';print_r($info_dump);exit();
	/*
	[505] => Array
	(
		[Account] => 505
		[Branch] => SA
		[Name] => 505
		[IsApp] => Y
		[Appstore] => 
		[APK] => https://goo.gl/qnYYZ8
		[HP_No] => 01123289528
		[HP_No_Formatted] => 0112 328-9528
		[Wechat] => vivian_wong91
		[Website] => http://sbobetmalaysia.net/
	)
	*/
	$site_agent = '210';
	//$info_dump[$site_agent]['xxx']
	/////////////// end get txt file data ///////////////
?>
<!DOCTYPE html>
<html lang="en">
<style>
.cuci_form {

  margin:0 auto;
  display:block;
  margin-bottom: 16px;
  width: 320px;
  height: 41px;
  padding: 6px 12px;
  font-size: 14px;
  line-height: 1.42857143;
  color: #555;
  background-color: #fff;
  background-image: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
          box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
  -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
       -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
          transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
  text-align: center;
}

.cuci_form_background {
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px;
    margin:0 auto;
    display: inline-block;
    border-radius: 16px;
}

.cuci_h4 {
    color: #E7BB36;
}

.cuci_h2 {
    text-align: center;
    color: #E7BB36;
}

.cuci_center_image {
    margin: auto;
    margin-top: 30px;
    width: 50%;
    border: 3px solid green;
    padding: 10px;
}

.cuci_contact_number {
    margin-top: 36px;
}

</style>

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="EWIN Malaysia Official"/>
    <meta name="author" content="">

    <title>EWIN Malaysia Official</title>

    <!-- Canonical Links -->
    <link rel="canonical" href="http://ewin2u.com/ewin-landing.php" />

    <!-- FavIcon -->
    <link rel="Shortcut Icon" href="images/favicon.jpg" /> 

    <!-- Bootstrap Core CSS -->
    <link href="css/landing/bootstrap.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="css/landing/landing-page.css?version=2" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="css/landing/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

	
	<!-- Google Analytics -->
	<script type="text/javascript">
	  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
	  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
	  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
	  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

	  ga('create', 'UA-83005651-3', 'auto');
	  ga('send', 'pageview');

	</script>
	
</head>

<body>

    <!-- Navigation -->
    <nav class="navbar navbar-default navbar-fixed-top topnav" role="navigation" style="background-color: currentColor;">
        <div class="container topnav">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <!--<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>-->
                <button class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <a href="http://ewin2u.com/download-ewin-malaysia.php">To EWIN Page   <i class="fa fa-chevron-right"></i></a>
                </button>
                <a class="navbar-brand topnav" href="http://ewin2u.com/"><img src="images/logo.png" alt="EWIN Online Casino Malaysia" height="50"/></a>
                <a class="navbar-brand topnav" href="http://ewin2u.com/" style="margin-top: 10px; color: #E7BB36;">EWIN Malaysia Official</a>

            </div>
            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav navbar-right">
                    <li>
                        <a href="http://ewin2u.com/download-ewin-malaysia.php" style="color: #E7BB36;">To EWIN Page   <i class="fa fa-chevron-right"></i></a>
                    </li>
                </ul>
            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container -->
    </nav>


    <!-- Header -->
    <form action="" method="post">
        <input type="hidden" name="action" value="register">
        <input type="hidden" name="verifycode" value="<?php echo $_SESSION['login'] = rand(123212,998789); ?>">
        <a name="about"></a>
        <div class="intro-header">
            <div class="container">

                <div class="row">
                    <div class="col-lg-12">
                        <div class="intro-message">
                            <h1><FONT COLOR="#FF0000">E</FONT><FONT COLOR="#FF4600">W</FONT><FONT COLOR="#FF8C00">I</FONT><FONT COLOR="#FFD200">N</FONT><FONT COLOR="#FFff00"> </FONT><FONT COLOR="#B9ff00">M</FONT><FONT COLOR="#73ff00">a</FONT><FONT COLOR="#2Dff00">l</FONT><FONT COLOR="#00ff00">a</FONT><FONT COLOR="#00ff46">y</FONT><FONT COLOR="#00ff8C">s</FONT><FONT COLOR="#00ffD2">i</FONT><FONT COLOR="#00ffff">a</FONT><FONT COLOR="#00D2ff"> </FONT><FONT COLOR="#008Cff">O</FONT><FONT COLOR="#0046ff">f</FONT><FONT COLOR="#0000ff">f</FONT><FONT COLOR="#2D00ff">i</FONT><FONT COLOR="#7300ff">c</FONT><FONT COLOR="#B900ff">i</FONT><FONT COLOR="#FF00ff">a</FONT><FONT COLOR="#FF00D2">l</FONT></h1>
                            <h3><!--Download OR //-->Register now to enjoy welcome BONUS!</h3>
                            <hr class="intro-divider">
                            <div class="cuci_form_background">
                            <a href="http://api.whatsapp.com/send?phone=<?php echo substr($info_dump[$site_agent]['HP_No'], 0, 1) === '6' ? $info_dump[$site_agent]['HP_No'] : '6'.$info_dump[$site_agent]['HP_No']; ?>" style="color: #E7BB36;"><img src="images/icon-whatsapp.png" alt="WhatsApp" /> <?php echo $info_dump[$site_agent]['HP_No_Formatted']; ?></a>
                            <br>
                            <a href="#" style="color: #E7BB36;"><img src="images/icon-wechat.png" alt="WeChat" /> <?php echo $info_dump[$site_agent]['Wechat']; ?></a>
                            <h4 class="cuci_h4">Register &amp; Start WINNING!</h4>
                            <br>
                            <input class="cuci_form" type="text" name="phoneNumber" placeholder="Phone Number | eg: 0123456789">
                            <?php if($emptyPhoneNumber):?>
                                <?php echo '<p style="color: red;">Please fill in required fields!</p>';?>
                            <?php endif;?>
							<!--
                            <input class="cuci_form" type="text" name="name" placeholder="Name">
							//-->
                            <?php //if($emptyName):?>
                                <?php //echo '<p style="color: red;">Please fill in required fields!</p>';?>
                            <?php //endif;?>
                            <ul class="list-inline intro-social-buttons">
                                <li>
                                    <button type="submit" class="btn btn-default btn-lg" id="registerBtn"><i class="fa fa-book fa-fw"></i><span class="network-name">Register</span></button>
                                </li>
								<!--
                                <p style="margin-top: 8px;"> OR </p>
                                <li>
                                    <a href="<?php if( empty($_GET['source']) ){ ?>http://www.ewin2u.com/ewinscr888.apk<?php }elseif( $_GET['source']=='apps' ){ ?>http://www.ewin2u.com/ewinscr888m.apk<?php } ?>" class="btn btn-default btn-lg"><i class="fa fa-download fa-fw"></i> <span class="network-name">Download NOW!</span></a>
                                </li>
								//-->
                            </ul>
                            <?php if($registrationSuccess):?>
                                <p style="color: #4fa053;">Registration SUCESS! Download EWIN Malaysia APK now!</p>
								<div><a href="<?php if( empty($_GET['source']) ){ ?>http://www.ewin2u.com/ewinscr888.apk<?php }elseif( $_GET['source']=='apps' ){ ?>http://www.ewin2u.com/ewinscr888m.apk<?php } ?>" class="btn btn-default btn-lg"><i class="fa fa-download fa-fw"></i> <span class="network-name">Download NOW!</span></a></div>
                            <?php endif;?>
                            <?php if($registrationFailed):?>
                                <p style="color: red;">ERROR : <?php echo $registrationFailedMsg;?></p>
                            <?php endif;?>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
            <!-- /.container -->

        </div>
    </form>
    <!-- /.intro-header -->

    <!-- Page Content -->

	<a  name="services"></a>
	<?php if(1==0) { ?>
    <div class="content-section-a">
        <div class="container">
            <div class="row">
                <div class="col-lg-5 col-sm-6" style="text-align: center;">
                    <hr class="section-heading-spacer">
                    <div class="clearfix"></div>
                    <img src="images/logo.png" alt="EWIN Online Casino Malaysia" height="120"/>
                    <h2 class="section-heading">Download EWIN Malaysia Android</h2>
                    <p class="lead">EWIN Malaysia Android Download will support all range of Android mobile smartphones. Scan the QR code and download EWIN Malaysia APK now.</p>
                    <br>
                    <a href="http://www.ewin2u.com/ewinscr888.apk" class="lead"> >> Click to download EWIN Malaysia Android APK << </a>
                </div>
                <div class="col-lg-5 col-lg-offset-2 col-sm-6" style="min-height: 200px; text-align: center;">
                    <img class="cuci_center_image" src="https://api.qrserver.com/v1/create-qr-code/?size=180x1800&data=http://www.ewin2u.com/ewinscr888.apk" alt="">
                </div>
            </div>

        </div>
        <!-- /.container -->

    </div>
    <!-- /.content-section-a -->
	<?php } ?>
	
	<a  name="contact"></a>
    <div class="banner" style="background-color: rgba(0, 0, 0, 0.8);">

        <div class="container">

            <div class="row">
                <div class="col-lg-12">
                    <h2 class="cuci_h2">Available Games</h2>
                    <ul class="cuci_h2" style="color: transparent; margin: 0px; padding: 0px;">
                        <li>
                            <a href="#"><img src="/images/landing/logo_game_scr8881.png"></a>
                        </li>
                        <li>
                            <a href="#"><img src="/images/landing/logo_game_luckypalace1.png"></a>
                        </li>
                        <li>
                            <a href="#"><img src="/images/landing/logo_game_3win81.png"></a>
                        </li>
                        <li>
                            <a href="#"><img src="/images/landing/logo_game_rollex1.png"></a>
                        </li>
                        <li>
                            <a href="#"><img src="/images/landing/logo_game_joker1.png"></a>
                        </li>
                        <li>
                            <a href="#"><img src="/images/landing/logo_game_suncity1.png"></a>
                        </li>
                    </ul>
                </div>
            </div>

        </div>
        <!-- /.container -->

    </div>
    <!-- /.banner -->

    <!-- Footer -->
    <footer>
        <div class="container">
            <div class="row">
                <div class="col-lg-12">
                    <p class="copyright text-muted small">Copyright &copy; EWIN Malaysia 2017. All Rights Reserved</p>
                </div>
            </div>
        </div>
    </footer>

    <!-- jQuery -->
    <script src="js/landing/jquery.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="js/landing/bootstrap.min.js"></script>
<!--Start of Tawk.to Script-->
<script type="text/javascript">
var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();
(function(){
var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
s1.async=true;
s1.src='https://embed.tawk.to/5a5c93d8d7591465c706c103/default';
s1.charset='UTF-8';
s1.setAttribute('crossorigin','*');
s0.parentNode.insertBefore(s1,s0);
})();
</script>
<!--End of Tawk.to Script-->
    <!-- Live Chat -->
    <!-- Start of LiveChat (www.livechatinc.com) code -->
    <!-- Start of LiveChat (www.livechatinc.com) code 
    <script type="text/javascript">
    window.__lc = window.__lc || {};
    window.__lc.license = 7009331;
    (function() {
      var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
      lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
    })();
    </script>
    <!-- End of LiveChat code -->
    <!-- End of LiveChat code -->

</body>

</html>
