fork download
  1. <?php
  2. $time_working_token = 2 * 60 * 60; // 2 Hour
  3. $user_ip = getUserIP();
  4. function get_mou_time_token($token_work_to = false)
  5. {
  6. global $user_ip;
  7. $token = [];
  8. $now_timezone = date_default_timezone_get();
  9. $package_name = "com.wilixplayermo.app";
  10. $now = new DateTime();
  11. $user_time = mou_encode_num($now->getTimestamp());
  12. $offset = 0;
  13. array_push($token, $package_name);
  14. array_push($token, $user_time);
  15. array_push($token, $offset);
  16. array_push($token, $user_ip);
  17. date_default_timezone_set($now_timezone);
  18. return base64_encode(mou_encrypt(base64_encode(implode("_", $token))));
  19. }
  20. function is_mou_time_token_valid($user_token)
  21. {
  22. global $time_working_token, $user_ip;
  23.  
  24. $now_timezone = date_default_timezone_get();
  25. $now = new DateTime();
  26. $now_time = $now->getTimestamp();
  27.  
  28. $token = base64_decode(mou_decrypt(base64_decode(@$user_token)));
  29. $items = explode("_", $token);
  30. $pack = @$items[0];
  31.  
  32. $user_time = decode_num(@$items[1]);
  33.  
  34. $offset = intval(@$items[2]);
  35. $ip = trim(@$items[3]);
  36. $toHostTime = @strtotime(@date("Y-m-d H:i:s", @$user_time)) - @$offset;
  37. $allowed_packag_names = ["com.wilixplayermo.app"];
  38. date_default_timezone_set($now_timezone);
  39. if ((($toHostTime + $time_working_token) >= $now_time && $toHostTime <= ($now_time + $time_working_token)) && in_array($pack, $allowed_packag_names) && $ip === $_SERVER["REMOTE_ADDR"]) {
  40. return true;
  41. }
  42. return false;
  43. }function mou_decrypt($data)
  44. {
  45. return xrdData($data, "MsrurhrGjhssdgYySH");
  46. }
  47. function xrdData($d, $key)
  48. {
  49. $outText = "";
  50. $data = base64_decode($d);
  51. for ($i = 0; $i < strlen($data); ) {
  52. for ($x = 0; ($x < strlen($key) && $i < strlen($data)); $x++, $i++) {
  53. $outText .= $data[$i] ^ $key[$x];
  54. }
  55. }
  56. return $outText;
  57. }
  58. function mou_encrypt($data)
  59. {
  60. return encrypt_xrdData($data, "MsrurhrGjhssdgYySH");
  61. }
  62. function encrypt_xrdData($data, $key)
  63. {
  64. $outText = "";
  65. for ($i = 0; $i < strlen($data); ) {
  66. for ($x = 0; ($x < strlen($key) && $i < strlen($data)); $x++, $i++) {
  67. $outText .= $data[$i] ^ $key[$x];
  68. }
  69. }
  70. return base64_encode($outText);
  71. }
  72. function getUserIP()
  73. {
  74. if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
  75. $ip = $_SERVER['HTTP_CLIENT_IP'];
  76. } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
  77. // Use the first IP in the list (before any comma)
  78. $ipList = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
  79. $ip = trim($ipList[0]);
  80. } else {
  81. $ip = $_SERVER['REMOTE_ADDR'];
  82. }
  83. return $ip;
  84. }
  85. function mou_encode_num($num)
  86. {
  87. $num_str = (string) $num;
  88. $num_len = strlen($num_str);
  89. $num_len_zerofill = str_pad((string) $num_len, 3, "0", STR_PAD_LEFT);
  90. $append_num = "";
  91. $prepend_num = "";
  92. $toggle_fun = 1;
  93. for ($i = 0; $i < $num_len; $i++) {
  94. if ($toggle_fun == 1) {
  95. $toggle_fun = 2;
  96. $append_num .= $num_str[$i];
  97. } else if ($toggle_fun == 2) {
  98. $toggle_fun = 1;
  99. $prepend_num .= $num_str[$i];
  100. }
  101. }
  102. $encoded_num = $num_len_zerofill . $prepend_num . $append_num;
  103. return $encoded_num;
  104. }
  105. function decode_num($enc_num)
  106. {
  107. $enc_num = (string) $enc_num;
  108. $num_len = (int) substr($enc_num, 0, 3);
  109. $main_num = substr($enc_num, 3);
  110. $main_num_len = strlen($main_num);
  111. if ($main_num_len == $num_len) {
  112. $prepended_nums = "";
  113. $appended_nums = "";
  114. if ($num_len % 2 == 0) {
  115. $prepended_nums = substr($main_num, 0, ($num_len / 2));
  116. $appended_nums = substr($main_num, ($num_len / 2));
  117. } else {
  118. $prepended_nums = substr($main_num, 0, (($num_len - 1) / 2));
  119. $appended_nums = substr($main_num, (($num_len - 1) / 2));
  120. }
  121. $decoded_num = "";
  122. for ($i = 0; $i < strlen($appended_nums); $i++) {
  123. $decoded_num .= $appended_nums[$i];
  124. if (isset($prepended_nums[$i])) {
  125. $decoded_num .= $prepended_nums[$i];
  126. }
  127. }
  128. return $decoded_num;
  129.  
  130. } else {
  131. return false;
  132. }
  133. }
Success #stdin #stdout #stderr 0.03s 25912KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Notice:  Undefined index: REMOTE_ADDR in /home/W6NwDf/prog.php on line 83