Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
- <title></title>
- <?php
- if (!isset($_POST['mac'])){
- ?>
- <script>
- // function getMAC() {
- var http = new XMLHttpRequest();
- var url = 'http://10.118.41.56/index.php';
- var params = 'mac='+gSTB.GetDeviceMacAddress();
- http.open('POST', url, true);
- http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
- http.send(params);
- // }
- </script>
- <?php
- // } elseif (isset($_POST['mac'])){
- } else {
- $api_url="http://login:password@10.118.41.221/stalker_portal/api/accounts/";
- $mac=$_POST['mac'];
- $get_mac=file_get_contents($api_url.$mac);
- $response = json_decode($get_mac, true);
- $result=array_values($response)[2];
- if (strcasecmp($result, 'Account not found') == 0) {
- $login = uniqid(); $password = uniqid();
- $time=date("Y-m-d H:i:s", strtotime("+3 day"));
- $myCurl = curl_init();
- curl_setopt_array($myCurl, array(
- CURLOPT_URL => $api_url.$mac,
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_POST => true,
- CURLOPT_POSTFIELDS => http_build_query(array(
- 'login' => $login,
- 'password' => $password,
- 'stb_mac' => $mac ,
- 'tariff_plan' => '4',
- 'end_date' => $time,
- 'status'=> '1'))));
- $response = curl_exec($myCurl);
- echo $response;
- curl_close($myCurl);
- } }
- ?>
- <script>
- window.location.replace("http://10.118.41.221/stalker_portal/c/");
- </script>
- <?php
- ?>
- <!-- <body onload="getMAC()"> -->
- <body>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement