<?php
$time_working_token = 2 * 60 * 60; // 2 Hour
$user_ip = getUserIP();
function get_mou_time_token($token_work_to = false)
{
global $user_ip;
$token = [];
$package_name = "com.wilixplayermo.app";
$now = new DateTime();
$user_time = mou_encode_num($now->getTimestamp());
$offset = 0;
}
function is_mou_time_token_valid($user_token)
{
global $time_working_token, $user_ip;
$now = new DateTime();
$now_time = $now->getTimestamp();
$pack = @$items[0];
$user_time = decode_num(@$items[1]);
$toHostTime = @strtotime(@date("Y-m-d H:i:s", @$user_time)) - @$offset; $allowed_packag_names = ["com.wilixplayermo.app"];
if ((($toHostTime + $time_working_token) >= $now_time && $toHostTime <= ($now_time + $time_working_token)) && in_array($pack, $allowed_packag_names) && $ip === $_SERVER["REMOTE_ADDR"]) { return true;
}
return false;
}function mou_decrypt($data)
{
return xrdData($data, "MsrurhrGjhssdgYySH");
}
function xrdData($d, $key)
{
$outText = "";
for ($i = 0; $i < strlen($data); ) { for ($x = 0; ($x < strlen($key) && $i < strlen($data)); $x++, $i++) { $outText .= $data[$i] ^ $key[$x];
}
}
return $outText;
}
function mou_encrypt($data)
{
return encrypt_xrdData($data, "MsrurhrGjhssdgYySH");
}
function encrypt_xrdData($data, $key)
{
$outText = "";
for ($i = 0; $i < strlen($data); ) { for ($x = 0; ($x < strlen($key) && $i < strlen($data)); $x++, $i++) { $outText .= $data[$i] ^ $key[$x];
}
}
}
function getUserIP()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { // Use the first IP in the list (before any comma)
$ipList = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); } else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
function mou_encode_num($num)
{
$num_str = (string) $num;
$num_len_zerofill = str_pad((string
) $num_len, 3, "0", STR_PAD_LEFT
); $append_num = "";
$prepend_num = "";
$toggle_fun = 1;
for ($i = 0; $i < $num_len; $i++) {
if ($toggle_fun == 1) {
$toggle_fun = 2;
$append_num .= $num_str[$i];
} else if ($toggle_fun == 2) {
$toggle_fun = 1;
$prepend_num .= $num_str[$i];
}
}
$encoded_num = $num_len_zerofill . $prepend_num . $append_num;
return $encoded_num;
}
function decode_num($enc_num)
{
$enc_num = (string) $enc_num;
$num_len = (int
) substr($enc_num, 0, 3); $main_num = substr($enc_num, 3); $main_num_len = strlen($main_num); if ($main_num_len == $num_len) {
$prepended_nums = "";
$appended_nums = "";
if ($num_len % 2 == 0) {
$prepended_nums = substr($main_num, 0, ($num_len / 2)); $appended_nums = substr($main_num, ($num_len / 2)); } else {
$prepended_nums = substr($main_num, 0, (($num_len - 1) / 2)); $appended_nums = substr($main_num, (($num_len - 1) / 2)); }
$decoded_num = "";
for ($i = 0; $i < strlen($appended_nums); $i++) { $decoded_num .= $appended_nums[$i];
if (isset($prepended_nums[$i])) { $decoded_num .= $prepended_nums[$i];
}
}
return $decoded_num;
} else {
return false;
}
}
PD9waHAKJHRpbWVfd29ya2luZ190b2tlbiA9IDIgKiA2MCAqIDYwOyAvLyAyIEhvdXIKJHVzZXJfaXAgPSBnZXRVc2VySVAoKTsKZnVuY3Rpb24gZ2V0X21vdV90aW1lX3Rva2VuKCR0b2tlbl93b3JrX3RvID0gZmFsc2UpCnsKICAgIGdsb2JhbCAkdXNlcl9pcDsKICAgICR0b2tlbiA9IFtdOwogICAgJG5vd190aW1lem9uZSA9IGRhdGVfZGVmYXVsdF90aW1lem9uZV9nZXQoKTsKICAgIGRhdGVfZGVmYXVsdF90aW1lem9uZV9zZXQoJ1VUQycpOwogICAgJHBhY2thZ2VfbmFtZSA9ICJjb20ud2lsaXhwbGF5ZXJtby5hcHAiOwogICAgJG5vdyA9IG5ldyBEYXRlVGltZSgpOwogICAgJHVzZXJfdGltZSA9IG1vdV9lbmNvZGVfbnVtKCRub3ctPmdldFRpbWVzdGFtcCgpKTsKICAgICRvZmZzZXQgPSAwOwogICAgYXJyYXlfcHVzaCgkdG9r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IiOwogICAgJHRvZ2dsZV9mdW4gPSAxOwogICAgZm9yICgkaSA9IDA7ICRpIDwgJG51bV9sZW47ICRpKyspIHsKICAgICAgICBpZiAoJHRvZ2dsZV9mdW4gPT0gMSkgewogICAgICAgICAgICAkdG9nZ2xlX2Z1biA9IDI7CiAgICAgICAgICAgICRhcHBlbmRfbnVtIC49ICRudW1fc3RyWyRpXTsKICAgICAgICB9IGVsc2UgaWYgKCR0b2dnbGVfZnVuID09IDIpIHsKICAgICAgICAgICAgJHRvZ2dsZV9mdW4gPSAxOwogICAgICAgICAgICAkcHJlcGVuZF9udW0gLj0gJG51bV9zdHJbJGldOwogICAgICAgIH0KICAgIH0KICAgICRlbmNvZGVkX251bSA9ICRudW1fbGVuX3plcm9maWxsIC4gJHByZXBlbmRfbnVtIC4gJGFwcGVuZF9udW07CiAgICByZXR1cm4gJGVuY29kZWRfbnVtOwp9CmZ1bmN0aW9uIGRlY29kZV9udW0oJGVuY19udW0pCnsKICAgICRlbmNfbnVtID0gKHN0cmluZykgJGVuY19udW07CiAgICAkbnVtX2xlbiA9IChpbnQpIHN1YnN0cigkZW5jX251bSwgMCwgMyk7CiAgICAkbWFpbl9udW0gPSBzdWJzdHIoJGVuY19udW0sIDMpOwogICAgJG1haW5fbnVtX2xlbiA9IHN0cmxlbigkbWFpbl9udW0pOwogICAgaWYgKCRtYWluX251bV9sZW4gPT0gJG51bV9sZW4pIHsKICAgICAgICAkcHJlcGVuZGVkX251bXMgPSAiIjsKICAgICAgICAkYXBwZW5kZWRfbnVtcyA9ICIiOwogICAgICAgIGlmICgkbnVtX2xlbiAlIDIgPT0gMCkgewogICAgICAgICAgICAkcHJlcGVuZGVkX251bXMgPSBzdWJzdHIoJG1haW5fbnVtLCAwLCAoJG51bV9sZW4gLyAyKSk7CiAgICAgICAgICAgICRhcHBlbmRlZF9udW1zID0gc3Vic3RyKCRtYWluX251bSwgKCRudW1fbGVuIC8gMikpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICRwcmVwZW5kZWRfbnVtcyA9IHN1YnN0cigkbWFpbl9udW0sIDAsICgoJG51bV9sZW4gLSAxKSAvIDIpKTsKICAgICAgICAgICAgJGFwcGVuZGVkX251bXMgPSBzdWJzdHIoJG1haW5fbnVtLCAoKCRudW1fbGVuIC0gMSkgLyAyKSk7CiAgICAgICAgfQogICAgICAgICRkZWNvZGVkX251bSA9ICIiOwogICAgICAgIGZvciAoJGkgPSAwOyAkaSA8IHN0cmxlbigkYXBwZW5kZWRfbnVtcyk7ICRpKyspIHsKICAgICAgICAgICAgJGRlY29kZWRfbnVtIC49ICRhcHBlbmRlZF9udW1zWyRpXTsKICAgICAgICAgICAgaWYgKGlzc2V0KCRwcmVwZW5kZWRfbnVtc1skaV0pKSB7CiAgICAgICAgICAgICAgICAkZGVjb2RlZF9udW0gLj0gJHByZXBlbmRlZF9udW1zWyRpXTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gJGRlY29kZWRfbnVtOwoKICAgIH0gZWxzZSB7CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfQp9