Advertisement
Guest User

test_period

a guest
Apr 21st, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  2. "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
  6. <title></title>
  7. <?php
  8. if (!isset($_POST['mac'])){
  9. ?>
  10. <script>
  11. // function getMAC() {
  12. var http = new XMLHttpRequest();
  13. var url = 'http://10.118.41.56/index.php';
  14. var params = 'mac='+gSTB.GetDeviceMacAddress();
  15. http.open('POST', url, true);
  16. http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
  17. http.send(params);
  18. // }
  19. </script>
  20.  
  21. <?php
  22. // } elseif (isset($_POST['mac'])){
  23. } else {
  24. $api_url="http://login:password@10.118.41.221/stalker_portal/api/accounts/";
  25. $mac=$_POST['mac'];
  26. $get_mac=file_get_contents($api_url.$mac);
  27. $response = json_decode($get_mac, true);
  28. $result=array_values($response)[2];
  29. if (strcasecmp($result, 'Account not found') == 0) {
  30. $login = uniqid(); $password = uniqid();
  31. $time=date("Y-m-d H:i:s", strtotime("+3 day"));
  32. $myCurl = curl_init();
  33. curl_setopt_array($myCurl, array(
  34. CURLOPT_URL => $api_url.$mac,
  35. CURLOPT_RETURNTRANSFER => true,
  36. CURLOPT_POST => true,
  37. CURLOPT_POSTFIELDS => http_build_query(array(
  38. 'login' => $login,
  39. 'password' => $password,
  40. 'stb_mac' => $mac ,
  41. 'tariff_plan' => '4',
  42. 'end_date' => $time,
  43. 'status'=> '1'))));
  44. $response = curl_exec($myCurl);
  45. echo $response;
  46. curl_close($myCurl);
  47. } }
  48. ?>
  49. <script>
  50. window.location.replace("http://10.118.41.221/stalker_portal/c/");
  51. </script>
  52. <?php
  53. ?>
  54.  
  55. <!-- <body onload="getMAC()"> -->
  56. <body>
  57. </body>
  58. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement