Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php goto W4t9J; NwDZK: if (isset($_GET["lang"])) { header("Location: " . $_SERVER["HT..

Decoded Output download

<?php  
 goto W4t9J; NwDZK: if (isset($_GET["lang"])) { header("Location: " . $_SERVER["HTTP_REFERER"]); } goto z6fEF; P6aUK: $generalSiteSettings = StaticFunctions::dbQuery("SELECT * FROM settings WHERE id = 1", array(), false)[0]; goto LzEdR; jMamC: StaticFunctions::AjaxCheck(); goto Ia0EE; nxzYD: foreach ($epinsData as $val) { $date = $val["used_Date"]; $checks = date("Y-m-d", strtotime($date)); $today = date("Y-m-d"); if (date("Y-m", strtotime($date, "-1 months")) == date("Y-m", strtotime("-1 months"))) { $totalPrizes_Lastmonth = intval($totalPrizes_Lastmonth) + intval($val["worth"]); } } goto Cz225; LzEdR: $epinsData = StaticFunctions::dbQuery("SELECT * FROM epin_codes WHERE status = 1", array(), false); goto dIaRl; z6fEF: if (StaticFunctions::isUserLogin() == "true") { if (StaticFunctions::getUserCredentials()["state"] == 3) { StaticFunctions::LogOut(); StaticFunctions::go("banned"); } } goto zxHbb; dIaRl: $totalPrizes_Lastmonth = 0; goto nxzYD; Ia0EE: if ($_POST["type"] == "createEpin_multi") { $prefix = $_POST["topluPrefix"]; $length = $_POST["topluLength"]; $topluWorth = $_POST["topluWorth"]; $keys = StaticFunctions::getEpins_create(intval($length), $prefix); $keysForeach = explode(";", $keys); $insertHtml = ''; $lengthSay = 1; foreach ($keysForeach as $val) { $insertHtml .= $val . "&#10;"; if (!empty($val)) { $insert_id = StaticFunctions::dbQuery("INSERT INTO epin_codes (code,worth) VALUES (:code,:worth)", false, array("code" => $val, "worth" => $topluWorth)); } if ($lengthSay == count($keysForeach)) { echo $insertHtml; } $lengthSay++; } } else { if ($_POST["type"] == "createEpin_custom") { $customEpin_code = $_POST["customEpin_code"]; $customEpin_worth = $_POST["customEpin_worth"]; $insert_id = StaticFunctions::dbQuery("INSERT INTO epin_codes (code,worth) VALUES (:code,:worth)", false, array("code" => $customEpin_code, "worth" => $customEpin_worth)); echo $customEpin_code; } } goto pP1gH; ML2Uh: if (isset($_GET["lang"])) { if ($_GET["lang"] == "tr" || $_GET["lang"] == "TR") { setcookie("selected_lang", "tr", strtotime("+1 year")); $url = "https://" . $_SERVER["SERVER_NAME"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); header("Location: " . $_SERVER["HTTP_REFERER"]); } else { if ($_GET["lang"] == "en" || $_GET["lang"] == "EN") { setcookie("selected_lang", "en", strtotime("+1 year")); $url = "https://" . $_SERVER["SERVER_NAME"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); header("Location: " . $_SERVER["HTTP_REFERER"]); } else { setcookie("selected_lang", "tr", strtotime("+1 year")); $url = "https://" . $_SERVER["SERVER_NAME"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); header("Location: " . $_SERVER["HTTP_REFERER"]); } } } goto sq0Uq; sq0Uq: if ($_COOKIE["selected_lang"] == "tr") { $lang = StaticFunctions::dbQuery("SELECT * FROM tr_lang WHERE id = 1", array(), false)[0]; $static_lang = "tr"; } else { if ($_COOKIE["selected_lang"] == "en") { $lang = StaticFunctions::dbQuery("SELECT * FROM tr_lang WHERE id = 2", array(), false)[0]; $static_lang = "en"; } else { if ($generalSiteSettings["default_lang"] == "tr") { $lang = StaticFunctions::dbQuery("SELECT * FROM tr_lang WHERE id = 1", array(), false)[0]; $static_lang = "tr"; } else { $lang = StaticFunctions::dbQuery("SELECT * FROM tr_lang WHERE id = 2", array(), false)[0]; $static_lang = "en"; } } } goto NwDZK; zxHbb: if (empty(json_decode(StaticFunctions::getUserCredentials()["userdata"])->img)) { $userImg = "assets/img/avatar.png"; } else { $userImg = "cdn/avatars/" . json_decode(StaticFunctions::getUserCredentials()["userdata"])->img; } goto jMamC; dtl8m: date_default_timezone_set("Europe/Istanbul"); goto P6aUK; W4t9J: ob_start(); goto dtl8m; Cz225: $url = "https://" . $_SERVER["SERVER_NAME"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); goto ML2Uh; pP1gH: class StaticFunctions { public static function dbConnect() { date_default_timezone_set("Europe/Istanbul"); if (!defined("dbhost")) { define("dbhost", "localhost"); } if (!defined("dbuser")) { define("dbuser", "urielqpv_user"); } if (!defined("dbpass")) { define("dbpass", "{i@QC0{^+e7l"); } if (!defined("dbname")) { define("dbname", "urielqpv_db"); } try { $connect = new PDO("mysql:host=" . dbhost . "; dbname=" . dbname, dbuser, dbpass); $connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $connect->query("SET NAMES 'UTF8'"); $connect->query("SET character_set_connection = 'UTF8'"); $connect->query("SET character_set_client = 'UTF8'"); $connect->query("SET character_set_results = 'UTF8'"); return $connect; } catch (PDOException $e) { return $e->getMessage(); } } public static function go($get) { $URL = "/" . $get; echo "<script type='text/javascript'>document.location.href='{$URL}';</script>"; echo "<META HTTP-EQUIV="refresh" content="5;URL=" . $URL . "">"; die("Redirecting..."); } public static function go_home() { $URL = "/"; echo "<script type='text/javascript'>document.location.href='{$URL}';</script>"; echo "<META HTTP-EQUIV="refresh" content="0;URL=" . $URL . "">"; die("Redirecting..."); } public static function reload() { $URL = $_SERVER["REQUEST_URI"]; echo "<script type='text/javascript'>document.location.href='{$URL}';</script>"; echo "<META HTTP-EQUIV="refresh" content="0;URL=" . $URL . "">"; die("Redirecting..."); } public static function new_session() { if (session_status() == PHP_SESSION_NONE) { session_start(); } } public static function JsonOutput($data, $ex = '') { if (is_array($data)) { $DataArray = array("HttpStatus" => 200, "Content-type" => "Application/Json", "RequestTime" => date("d-m-Y H:i:s") . " " . date_default_timezone_get(), "TimeUnix" => time()); return json_encode(array_merge($DataArray, $data), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); } else { return json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); } } public static function shorter($text, $chars_limit) { if (strlen($text) > $chars_limit) { $new_text = substr($text, 0, $chars_limit); $new_text = trim($new_text); return $new_text . ".."; } else { return $text; } } public static function CaseConvert($keyword, $transform = "lowercase") { $low = array("a", "b", "c", "", "d", "e", "f", "g", "", "h", "", "i", "j", "k", "l", "m", "n", "o", "", "p", "r", "s", "", "t", "u", "", "v", "y", "z", "q", "w", "x"); $upp = array("A", "B", "C", "", "D", "E", "F", "G", "", "H", "I", "", "J", "K", "L", "M", "N", "O", "", "P", "R", "S", "", "T", "U", "", "V", "Y", "Z", "Q", "W", "X"); if ($transform == "uppercase" or $transform == "u") { $keyword = str_replace($low, $upp, $keyword); $keyword = function_exists("mb_strtoupper") ? mb_strtoupper($keyword) : $keyword; } elseif ($transform == "lowercase" or $transform == "l") { $keyword = str_replace($upp, $low, $keyword); $keyword = function_exists("mb_strtolower") ? mb_strtolower($keyword) : $keyword; } return $keyword; } public static function RemoveBunchOfSlashes($url) { $url = "/" . $url; $explode = explode("://", $url); while (strpos($explode[1], "//")) { $explode[1] = str_replace("//", "/", $explode[1]); } return implode("://", $explode); } public static function clear($mVar) { if (is_array($mVar)) { foreach ($mVar as $gVal => $gVar) { if (!is_array($gVar)) { $mVar[$gVal] = htmlspecialchars(strip_tags(urldecode(addslashes(stripslashes(stripslashes(trim(htmlspecialchars_decode($gVar)))))))); } else { $mVar[$gVal] = self::clear($gVar); } } } else { $mVar = htmlspecialchars(strip_tags(urldecode(addslashes(stripslashes(stripslashes(trim(htmlspecialchars_decode($mVar)))))))); } return $mVar; } public static function AjaxCheck() { if (!isset($_SERVER["HTTP_X_REQUESTED_WITH"]) || strtolower($_SERVER["HTTP_X_REQUESTED_WITH"]) != "xmlhttprequest") { return false; } if (!isset($_SERVER["HTTP_REFERER"])) { return false; } return true; } public static function replace_turkish_chars($text) { $tr = array("", "", "", "", "", "", "", "", "", "", "", ""); $kod = array("&Ccedil;", "&ccedil;", "&#286;", "&#287;", "&#305;", "&#304;", "&Ouml;", "&ouml;", "&#350;", "&#351;", "&Uuml;", "&uuml;"); $veri = str_replace($tr, $kod, $text); return $veri; } public static function replace_tr($text) { $text = trim($text); $search = array("", "", "", "", "", "", "", "", "", "", "", "", " "); $replace = array("c", "c", "g", "g", "i", "i", "o", "o", "s", "s", "u", "u", "-"); $new_text = str_replace($search, $replace, $text); return $new_text; } public static function LogOut() { self::new_session(); unset($_SESSION["username"]); unset($_SESSION["userid"]); unset($_SESSION["email"]); session_destroy(); return null; } public static function indexreturn() { $actual_link = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] === "on" ? "https" : "http") . "://{$_SERVER["HTTP_HOST"]}{$_SERVER["REQUEST_URI"]}"; if (strpos($actual_link, "index.php")) { self::go_home(); } } public static function say($key) { return stripslashes($key); } public static function generateRandomString($length = 4) { $characters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $randomString; } public static function createEpin($prefix) { $prefixes = explode("-", $prefix); $prefix1 = self::CaseConvert(self::generateRandomString(), "uppercase"); $prefix2 = self::CaseConvert(self::generateRandomString(), "uppercase"); $prefix3 = self::CaseConvert(self::generateRandomString(), "uppercase"); $newCode = $prefixes[0] . "-" . $prefix1 . "-" . $prefix2 . "-" . $prefix3; return self::replace_tr($newCode); } public static function getEpins_create($length, $prefix) { $list = ''; for ($i = 1; $i <= $length; $i++) { $list .= self::createEpin($prefix) . ";"; if ($i == $length) { return $list; } } } public static function random($get) { $token = bin2hex(openssl_random_pseudo_bytes($get)); return $token; } public static function createPassword_reset($email) { $connect = StaticFunctions::dbConnect(); $unique_hash = StaticFunctions::random_with_time(255); $request_uri = "?k=" . $unique_hash . "&e=" . $email; $user_register = $connect->prepare("INSERT INTO password_requests (request_hash,request_email,request_status) VALUES (:request_hash,:request_email,:request_status)"); $user_register->execute(array(":request_hash" => $unique_hash, ":request_email" => $email, ":request_status" => 0)); return $request_uri; } public static function random_with_time($get) { $token = bin2hex(openssl_random_pseudo_bytes($get)); $unix_time = time(); $token2 = substr($token, 0, 45); $token3 = str_replace($token2, '', $token); $token = $token2 . $unix_time . $token3; return md5($token); } public static function post($query) { if (isset($_POST[$query]) && StaticFunctions::clear($_POST[$query]) != '') { return StaticFunctions::clear($_POST[$query]); } else { return ''; } } public static function getBrowser($agent = null) { $u_agent = $agent != null ? $agent : $_SERVER["HTTP_USER_AGENT"]; $bname = "Unknown"; $platform = "Unknown"; $version = ''; if (preg_match("/linux/i", $u_agent)) { $platform = "Linux"; } elseif (preg_match("/macintosh|mac os x/i", $u_agent)) { $platform = "Mac"; } elseif (preg_match("/windows|win32/i", $u_agent)) { $platform = "Windows"; } if (preg_match("/MSIE/i", $u_agent) && !preg_match("/Opera/i", $u_agent)) { $bname = "Internet Explorer"; $ub = "MSIE"; } elseif (preg_match("/Firefox/i", $u_agent)) { $bname = "Mozilla Firefox"; $ub = "Firefox"; } elseif (preg_match("/Chrome/i", $u_agent)) { $bname = "Chrome"; $ub = "Chrome"; } elseif (preg_match("/Safari/i", $u_agent)) { $bname = "Apple Safari"; $ub = "Safari"; } elseif (preg_match("/Opera/i", $u_agent)) { $bname = "Opera"; $ub = "Opera"; } elseif (preg_match("/Netscape/i", $u_agent)) { $bname = "Netscape"; $ub = "Netscape"; } $known = array("Version", $ub, "other"); $pattern = "#(?<browser>" . join("|", $known) . ")[/ ]+(?<version>[0-9.|a-zA-Z.]*)#"; if (!preg_match_all($pattern, $u_agent, $matches)) { } $i = count($matches["browser"]); if ($i != 1) { if (strripos($u_agent, "Version") < strripos($u_agent, $ub)) { $version = $matches["version"][0]; } else { $version = $matches["version"][1]; } } else { $version = $matches["version"][0]; } if ($version == null || $version == '') { $version = "?"; } return array("name" => $bname, "version" => $version, "platform" => $platform); } public static function get_ip() { $ipaddress = ''; if (getenv("HTTP_CLIENT_IP")) { $ipaddress = getenv("HTTP_CLIENT_IP"); } elseif (getenv("HTTP_X_FORWARDED_FOR")) { $ipaddress = getenv("HTTP_X_FORWARDED_FOR"); } elseif (getenv("HTTP_X_FORWARDED")) { $ipaddress = getenv("HTTP_X_FORWARDED"); } elseif (getenv("HTTP_FORWARDED_FOR")) { $ipaddress = getenv("HTTP_FORWARDED_FOR"); } elseif (getenv("HTTP_FORWARDED")) { $ipaddress = getenv("HTTP_FORWARDED"); } elseif (getenv("REMOTE_ADDR")) { $ipaddress = getenv("REMOTE_ADDR"); } else { $ipaddress = "UNKNOWN"; } return $ipaddress; } public static function JwtKey() { return "E955345AuLUvp%&365@%xPIOJKp7ycc_=WMJrxbzCPZZQ@E950903c_=WMJrxbzCPZZQ"; } public static function validate_url($url) { $path = parse_url($url, PHP_URL_PATH); $encoded_path = array_map("urlencode", explode("/", $path)); $url = str_replace($path, implode("/", $encoded_path), $url); return filter_var($url, FILTER_VALIDATE_URL) ? true : false; } public static function selectDb($table, $tableRow) { $connect = StaticFunctions::dbConnect(); if (!empty($table)) { if (!$tableRow) { $stmt = $connect->prepare("SELECT * FROM " . $table); $stmt->execute(); $data = $stmt->fetchAll(); return $data; } else { } } } public static function str_starts_with($haystack, $needle) { return strpos($haystack, $needle) === 0; } public static function setOnline() { StaticFunctions::new_session(); $connect = StaticFunctions::dbConnect(); $upq = $connect->prepare("UPDATE users SET lastactivity=?,status=? WHERE id = ?"); $upq->execute(array(time(), "online", $_SESSION["userid"])); } public static function totalHrs_tick() { StaticFunctions::new_session(); $connect = StaticFunctions::dbConnect(); $upq = $connect->prepare("UPDATE users SET totaltime_unix=? WHERE id = ?"); $upq->execute(array(date("Y-m-d h:i:s"), $_SESSION["userid"])); } public static function totalHrs_calculate() { StaticFunctions::new_session(); $connect = StaticFunctions::dbConnect(); $selfData = StaticFunctions::dbQuery("SELECT * FROM users WHERE id = ?", array($_SESSION["userid"]), false)[0]; $loginDate = date("d-m-Y h:i:s", strtotime($selfData["totaltime_unix"])); $currentDate = date("d-m-Y h:i:s"); $minDiff = round((strtotime($currentDate) - strtotime($loginDate)) / 60, 1); $upq = $connect->prepare("UPDATE users SET totaltime=? WHERE id = ?"); $timeUnix = intval($selfData["totaltime"]) + intval($minDiff); $upq->execute(array($timeUnix, $_SESSION["userid"])); } public static function setOffline() { StaticFunctions::new_session(); $connect = StaticFunctions::dbConnect(); $upq = $connect->prepare("UPDATE users SET status=? WHERE id = ?"); $upq->execute(array("offline", $_SESSION["userid"])); } public static function fetchOnlineUsers() { $connect = StaticFunctions::dbConnect(); $select_query = $connect->prepare("SELECT * FROM users"); $select_query->execute(); $query_result = $select_query->fetchAll(); $time_check = time() - 180; foreach ($query_result as $key) { if ($key["lastactivity"] > $time_check) { $upq = $connect->prepare("UPDATE users SET status=? WHERE id = ?"); $upq->execute(array("online", $key["id"])); } else { $upq = $connect->prepare("UPDATE users SET status=? WHERE id = ?"); $upq->execute(array("offline", $key["id"])); } } } public static function getUserCredentials() { StaticFunctions::new_session(); $connect = StaticFunctions::dbConnect(); $select_query = $connect->prepare("SELECT * FROM users WHERE id = ?"); $select_query->execute(array($_SESSION["userid"])); $query_result = $select_query->fetch(); return $query_result; } public static function dbQuery($statement, $target, $content) { $connect = StaticFunctions::dbConnect(); if (StaticFunctions::str_starts_with($statement, "SELECT")) { $select_query = $connect->prepare($statement); $select_query->execute($target); $query_result = $select_query->fetchAll(PDO::FETCH_ASSOC); if (count($query_result) > 0) { return $query_result; } else { return false; } } elseif (StaticFunctions::str_starts_with($statement, "UPDATE")) { $update_query = $connect->prepare($statement); $query_result = $update_query->execute($content); return $query_result; } elseif (StaticFunctions::str_starts_with($statement, "INSERT")) { $insert_query = $connect->prepare($statement); $query_result = $insert_query->execute($content); if ($query_result) { return $connect->lastInsertId(); } else { return false; } } elseif (StaticFunctions::str_starts_with($statement, "DELETE")) { $delete_query = $connect->prepare($statement); $delete_query->execute($target); $count = $delete_query->rowCount(); if ($delete_query) { return $count; } else { return false; } } else { return false; } } public static function isUserLogin() { StaticFunctions::new_session(); $durum = empty($_SESSION["userid"]) ? "false" : "true"; return $durum; } public static function isUserLogin_Execute() { StaticFunctions::new_session(); $durum = empty($_SESSION["userid"]) ? self::go("login") : "true"; } public static function isUserAdmin_Execute() { StaticFunctions::new_session(); $userState = StaticFunctions::getUserCredentials()["state"]; if ($userState != 2) { StaticFunctions::go_home(); } } public static function encryptPassword($data) { $secret = "35onoi2=-7#%g03kl"; $encrypt_method = "AES-256-CBC"; $secret_key = "11*_33"; $secret_iv = "22-=**_"; $key = hash("sha256", $secret_key); $iv = substr(hash("sha256", $secret_iv), 0, 16); $encrypted_Data = openssl_encrypt($data, $encrypt_method, $key, false, $iv); return $encrypted_Data; } } ?>

Did this file decode correctly?

Original Code

<?php 
 goto W4t9J; NwDZK: if (isset($_GET["lang"])) { header("Location: " . $_SERVER["HTTP_REFERER"]); } goto z6fEF; P6aUK: $generalSiteSettings = StaticFunctions::dbQuery("SELECT * FROM settings WHERE id = 1", array(), false)[0]; goto LzEdR; jMamC: StaticFunctions::AjaxCheck(); goto Ia0EE; nxzYD: foreach ($epinsData as $val) { $date = $val["used_Date"]; $checks = date("Y-m-d", strtotime($date)); $today = date("Y-m-d"); if (date("Y-m", strtotime($date, "-1 months")) == date("Y-m", strtotime("-1 months"))) { $totalPrizes_Lastmonth = intval($totalPrizes_Lastmonth) + intval($val["worth"]); } } goto Cz225; LzEdR: $epinsData = StaticFunctions::dbQuery("SELECT * FROM epin_codes WHERE status = 1", array(), false); goto dIaRl; z6fEF: if (StaticFunctions::isUserLogin() == "true") { if (StaticFunctions::getUserCredentials()["state"] == 3) { StaticFunctions::LogOut(); StaticFunctions::go("banned"); } } goto zxHbb; dIaRl: $totalPrizes_Lastmonth = 0; goto nxzYD; Ia0EE: if ($_POST["type"] == "createEpin_multi") { $prefix = $_POST["topluPrefix"]; $length = $_POST["topluLength"]; $topluWorth = $_POST["topluWorth"]; $keys = StaticFunctions::getEpins_create(intval($length), $prefix); $keysForeach = explode(";", $keys); $insertHtml = ''; $lengthSay = 1; foreach ($keysForeach as $val) { $insertHtml .= $val . "&#10;"; if (!empty($val)) { $insert_id = StaticFunctions::dbQuery("INSERT INTO epin_codes (code,worth) VALUES (:code,:worth)", false, array("code" => $val, "worth" => $topluWorth)); } if ($lengthSay == count($keysForeach)) { echo $insertHtml; } $lengthSay++; } } else { if ($_POST["type"] == "createEpin_custom") { $customEpin_code = $_POST["customEpin_code"]; $customEpin_worth = $_POST["customEpin_worth"]; $insert_id = StaticFunctions::dbQuery("INSERT INTO epin_codes (code,worth) VALUES (:code,:worth)", false, array("code" => $customEpin_code, "worth" => $customEpin_worth)); echo $customEpin_code; } } goto pP1gH; ML2Uh: if (isset($_GET["lang"])) { if ($_GET["lang"] == "tr" || $_GET["lang"] == "TR") { setcookie("selected_lang", "tr", strtotime("+1 year")); $url = "https://" . $_SERVER["SERVER_NAME"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); header("Location: " . $_SERVER["HTTP_REFERER"]); } else { if ($_GET["lang"] == "en" || $_GET["lang"] == "EN") { setcookie("selected_lang", "en", strtotime("+1 year")); $url = "https://" . $_SERVER["SERVER_NAME"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); header("Location: " . $_SERVER["HTTP_REFERER"]); } else { setcookie("selected_lang", "tr", strtotime("+1 year")); $url = "https://" . $_SERVER["SERVER_NAME"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); header("Location: " . $_SERVER["HTTP_REFERER"]); } } } goto sq0Uq; sq0Uq: if ($_COOKIE["selected_lang"] == "tr") { $lang = StaticFunctions::dbQuery("SELECT * FROM tr_lang WHERE id = 1", array(), false)[0]; $static_lang = "tr"; } else { if ($_COOKIE["selected_lang"] == "en") { $lang = StaticFunctions::dbQuery("SELECT * FROM tr_lang WHERE id = 2", array(), false)[0]; $static_lang = "en"; } else { if ($generalSiteSettings["default_lang"] == "tr") { $lang = StaticFunctions::dbQuery("SELECT * FROM tr_lang WHERE id = 1", array(), false)[0]; $static_lang = "tr"; } else { $lang = StaticFunctions::dbQuery("SELECT * FROM tr_lang WHERE id = 2", array(), false)[0]; $static_lang = "en"; } } } goto NwDZK; zxHbb: if (empty(json_decode(StaticFunctions::getUserCredentials()["userdata"])->img)) { $userImg = "assets/img/avatar.png"; } else { $userImg = "cdn/avatars/" . json_decode(StaticFunctions::getUserCredentials()["userdata"])->img; } goto jMamC; dtl8m: date_default_timezone_set("Europe/Istanbul"); goto P6aUK; W4t9J: ob_start(); goto dtl8m; Cz225: $url = "https://" . $_SERVER["SERVER_NAME"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); goto ML2Uh; pP1gH: class StaticFunctions { public static function dbConnect() { date_default_timezone_set("Europe/Istanbul"); if (!defined("dbhost")) { define("dbhost", "localhost"); } if (!defined("dbuser")) { define("dbuser", "urielqpv_user"); } if (!defined("dbpass")) { define("dbpass", "{i@QC0{^+e7l"); } if (!defined("dbname")) { define("dbname", "urielqpv_db"); } try { $connect = new PDO("mysql:host=" . dbhost . "; dbname=" . dbname, dbuser, dbpass); $connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $connect->query("SET NAMES 'UTF8'"); $connect->query("SET character_set_connection = 'UTF8'"); $connect->query("SET character_set_client = 'UTF8'"); $connect->query("SET character_set_results = 'UTF8'"); return $connect; } catch (PDOException $e) { return $e->getMessage(); } } public static function go($get) { $URL = "/" . $get; echo "<script type='text/javascript'>document.location.href='{$URL}';</script>"; echo "<META HTTP-EQUIV="refresh" content="5;URL=" . $URL . "">"; die("Redirecting..."); } public static function go_home() { $URL = "/"; echo "<script type='text/javascript'>document.location.href='{$URL}';</script>"; echo "<META HTTP-EQUIV="refresh" content="0;URL=" . $URL . "">"; die("Redirecting..."); } public static function reload() { $URL = $_SERVER["REQUEST_URI"]; echo "<script type='text/javascript'>document.location.href='{$URL}';</script>"; echo "<META HTTP-EQUIV="refresh" content="0;URL=" . $URL . "">"; die("Redirecting..."); } public static function new_session() { if (session_status() == PHP_SESSION_NONE) { session_start(); } } public static function JsonOutput($data, $ex = '') { if (is_array($data)) { $DataArray = array("HttpStatus" => 200, "Content-type" => "Application/Json", "RequestTime" => date("d-m-Y H:i:s") . " " . date_default_timezone_get(), "TimeUnix" => time()); return json_encode(array_merge($DataArray, $data), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); } else { return json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); } } public static function shorter($text, $chars_limit) { if (strlen($text) > $chars_limit) { $new_text = substr($text, 0, $chars_limit); $new_text = trim($new_text); return $new_text . ".."; } else { return $text; } } public static function CaseConvert($keyword, $transform = "lowercase") { $low = array("a", "b", "c", "", "d", "e", "f", "g", "", "h", "", "i", "j", "k", "l", "m", "n", "o", "", "p", "r", "s", "", "t", "u", "", "v", "y", "z", "q", "w", "x"); $upp = array("A", "B", "C", "", "D", "E", "F", "G", "", "H", "I", "", "J", "K", "L", "M", "N", "O", "", "P", "R", "S", "", "T", "U", "", "V", "Y", "Z", "Q", "W", "X"); if ($transform == "uppercase" or $transform == "u") { $keyword = str_replace($low, $upp, $keyword); $keyword = function_exists("mb_strtoupper") ? mb_strtoupper($keyword) : $keyword; } elseif ($transform == "lowercase" or $transform == "l") { $keyword = str_replace($upp, $low, $keyword); $keyword = function_exists("mb_strtolower") ? mb_strtolower($keyword) : $keyword; } return $keyword; } public static function RemoveBunchOfSlashes($url) { $url = "/" . $url; $explode = explode("://", $url); while (strpos($explode[1], "//")) { $explode[1] = str_replace("//", "/", $explode[1]); } return implode("://", $explode); } public static function clear($mVar) { if (is_array($mVar)) { foreach ($mVar as $gVal => $gVar) { if (!is_array($gVar)) { $mVar[$gVal] = htmlspecialchars(strip_tags(urldecode(addslashes(stripslashes(stripslashes(trim(htmlspecialchars_decode($gVar)))))))); } else { $mVar[$gVal] = self::clear($gVar); } } } else { $mVar = htmlspecialchars(strip_tags(urldecode(addslashes(stripslashes(stripslashes(trim(htmlspecialchars_decode($mVar)))))))); } return $mVar; } public static function AjaxCheck() { if (!isset($_SERVER["HTTP_X_REQUESTED_WITH"]) || strtolower($_SERVER["HTTP_X_REQUESTED_WITH"]) != "xmlhttprequest") { return false; } if (!isset($_SERVER["HTTP_REFERER"])) { return false; } return true; } public static function replace_turkish_chars($text) { $tr = array("", "", "", "", "", "", "", "", "", "", "", ""); $kod = array("&Ccedil;", "&ccedil;", "&#286;", "&#287;", "&#305;", "&#304;", "&Ouml;", "&ouml;", "&#350;", "&#351;", "&Uuml;", "&uuml;"); $veri = str_replace($tr, $kod, $text); return $veri; } public static function replace_tr($text) { $text = trim($text); $search = array("", "", "", "", "", "", "", "", "", "", "", "", " "); $replace = array("c", "c", "g", "g", "i", "i", "o", "o", "s", "s", "u", "u", "-"); $new_text = str_replace($search, $replace, $text); return $new_text; } public static function LogOut() { self::new_session(); unset($_SESSION["username"]); unset($_SESSION["userid"]); unset($_SESSION["email"]); session_destroy(); return null; } public static function indexreturn() { $actual_link = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] === "on" ? "https" : "http") . "://{$_SERVER["HTTP_HOST"]}{$_SERVER["REQUEST_URI"]}"; if (strpos($actual_link, "index.php")) { self::go_home(); } } public static function say($key) { return stripslashes($key); } public static function generateRandomString($length = 4) { $characters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $randomString; } public static function createEpin($prefix) { $prefixes = explode("-", $prefix); $prefix1 = self::CaseConvert(self::generateRandomString(), "uppercase"); $prefix2 = self::CaseConvert(self::generateRandomString(), "uppercase"); $prefix3 = self::CaseConvert(self::generateRandomString(), "uppercase"); $newCode = $prefixes[0] . "-" . $prefix1 . "-" . $prefix2 . "-" . $prefix3; return self::replace_tr($newCode); } public static function getEpins_create($length, $prefix) { $list = ''; for ($i = 1; $i <= $length; $i++) { $list .= self::createEpin($prefix) . ";"; if ($i == $length) { return $list; } } } public static function random($get) { $token = bin2hex(openssl_random_pseudo_bytes($get)); return $token; } public static function createPassword_reset($email) { $connect = StaticFunctions::dbConnect(); $unique_hash = StaticFunctions::random_with_time(255); $request_uri = "?k=" . $unique_hash . "&e=" . $email; $user_register = $connect->prepare("INSERT INTO password_requests (request_hash,request_email,request_status) VALUES (:request_hash,:request_email,:request_status)"); $user_register->execute(array(":request_hash" => $unique_hash, ":request_email" => $email, ":request_status" => 0)); return $request_uri; } public static function random_with_time($get) { $token = bin2hex(openssl_random_pseudo_bytes($get)); $unix_time = time(); $token2 = substr($token, 0, 45); $token3 = str_replace($token2, '', $token); $token = $token2 . $unix_time . $token3; return md5($token); } public static function post($query) { if (isset($_POST[$query]) && StaticFunctions::clear($_POST[$query]) != '') { return StaticFunctions::clear($_POST[$query]); } else { return ''; } } public static function getBrowser($agent = null) { $u_agent = $agent != null ? $agent : $_SERVER["HTTP_USER_AGENT"]; $bname = "Unknown"; $platform = "Unknown"; $version = ''; if (preg_match("/linux/i", $u_agent)) { $platform = "Linux"; } elseif (preg_match("/macintosh|mac os x/i", $u_agent)) { $platform = "Mac"; } elseif (preg_match("/windows|win32/i", $u_agent)) { $platform = "Windows"; } if (preg_match("/MSIE/i", $u_agent) && !preg_match("/Opera/i", $u_agent)) { $bname = "Internet Explorer"; $ub = "MSIE"; } elseif (preg_match("/Firefox/i", $u_agent)) { $bname = "Mozilla Firefox"; $ub = "Firefox"; } elseif (preg_match("/Chrome/i", $u_agent)) { $bname = "Chrome"; $ub = "Chrome"; } elseif (preg_match("/Safari/i", $u_agent)) { $bname = "Apple Safari"; $ub = "Safari"; } elseif (preg_match("/Opera/i", $u_agent)) { $bname = "Opera"; $ub = "Opera"; } elseif (preg_match("/Netscape/i", $u_agent)) { $bname = "Netscape"; $ub = "Netscape"; } $known = array("Version", $ub, "other"); $pattern = "#(?<browser>" . join("|", $known) . ")[/ ]+(?<version>[0-9.|a-zA-Z.]*)#"; if (!preg_match_all($pattern, $u_agent, $matches)) { } $i = count($matches["browser"]); if ($i != 1) { if (strripos($u_agent, "Version") < strripos($u_agent, $ub)) { $version = $matches["version"][0]; } else { $version = $matches["version"][1]; } } else { $version = $matches["version"][0]; } if ($version == null || $version == '') { $version = "?"; } return array("name" => $bname, "version" => $version, "platform" => $platform); } public static function get_ip() { $ipaddress = ''; if (getenv("HTTP_CLIENT_IP")) { $ipaddress = getenv("HTTP_CLIENT_IP"); } elseif (getenv("HTTP_X_FORWARDED_FOR")) { $ipaddress = getenv("HTTP_X_FORWARDED_FOR"); } elseif (getenv("HTTP_X_FORWARDED")) { $ipaddress = getenv("HTTP_X_FORWARDED"); } elseif (getenv("HTTP_FORWARDED_FOR")) { $ipaddress = getenv("HTTP_FORWARDED_FOR"); } elseif (getenv("HTTP_FORWARDED")) { $ipaddress = getenv("HTTP_FORWARDED"); } elseif (getenv("REMOTE_ADDR")) { $ipaddress = getenv("REMOTE_ADDR"); } else { $ipaddress = "UNKNOWN"; } return $ipaddress; } public static function JwtKey() { return "E955345AuLUvp%&365@%xPIOJKp7ycc_=WMJrxbzCPZZQ@E950903c_=WMJrxbzCPZZQ"; } public static function validate_url($url) { $path = parse_url($url, PHP_URL_PATH); $encoded_path = array_map("urlencode", explode("/", $path)); $url = str_replace($path, implode("/", $encoded_path), $url); return filter_var($url, FILTER_VALIDATE_URL) ? true : false; } public static function selectDb($table, $tableRow) { $connect = StaticFunctions::dbConnect(); if (!empty($table)) { if (!$tableRow) { $stmt = $connect->prepare("SELECT * FROM " . $table); $stmt->execute(); $data = $stmt->fetchAll(); return $data; } else { } } } public static function str_starts_with($haystack, $needle) { return strpos($haystack, $needle) === 0; } public static function setOnline() { StaticFunctions::new_session(); $connect = StaticFunctions::dbConnect(); $upq = $connect->prepare("UPDATE users SET lastactivity=?,status=? WHERE id = ?"); $upq->execute(array(time(), "online", $_SESSION["userid"])); } public static function totalHrs_tick() { StaticFunctions::new_session(); $connect = StaticFunctions::dbConnect(); $upq = $connect->prepare("UPDATE users SET totaltime_unix=? WHERE id = ?"); $upq->execute(array(date("Y-m-d h:i:s"), $_SESSION["userid"])); } public static function totalHrs_calculate() { StaticFunctions::new_session(); $connect = StaticFunctions::dbConnect(); $selfData = StaticFunctions::dbQuery("SELECT * FROM users WHERE id = ?", array($_SESSION["userid"]), false)[0]; $loginDate = date("d-m-Y h:i:s", strtotime($selfData["totaltime_unix"])); $currentDate = date("d-m-Y h:i:s"); $minDiff = round((strtotime($currentDate) - strtotime($loginDate)) / 60, 1); $upq = $connect->prepare("UPDATE users SET totaltime=? WHERE id = ?"); $timeUnix = intval($selfData["totaltime"]) + intval($minDiff); $upq->execute(array($timeUnix, $_SESSION["userid"])); } public static function setOffline() { StaticFunctions::new_session(); $connect = StaticFunctions::dbConnect(); $upq = $connect->prepare("UPDATE users SET status=? WHERE id = ?"); $upq->execute(array("offline", $_SESSION["userid"])); } public static function fetchOnlineUsers() { $connect = StaticFunctions::dbConnect(); $select_query = $connect->prepare("SELECT * FROM users"); $select_query->execute(); $query_result = $select_query->fetchAll(); $time_check = time() - 180; foreach ($query_result as $key) { if ($key["lastactivity"] > $time_check) { $upq = $connect->prepare("UPDATE users SET status=? WHERE id = ?"); $upq->execute(array("online", $key["id"])); } else { $upq = $connect->prepare("UPDATE users SET status=? WHERE id = ?"); $upq->execute(array("offline", $key["id"])); } } } public static function getUserCredentials() { StaticFunctions::new_session(); $connect = StaticFunctions::dbConnect(); $select_query = $connect->prepare("SELECT * FROM users WHERE id = ?"); $select_query->execute(array($_SESSION["userid"])); $query_result = $select_query->fetch(); return $query_result; } public static function dbQuery($statement, $target, $content) { $connect = StaticFunctions::dbConnect(); if (StaticFunctions::str_starts_with($statement, "SELECT")) { $select_query = $connect->prepare($statement); $select_query->execute($target); $query_result = $select_query->fetchAll(PDO::FETCH_ASSOC); if (count($query_result) > 0) { return $query_result; } else { return false; } } elseif (StaticFunctions::str_starts_with($statement, "UPDATE")) { $update_query = $connect->prepare($statement); $query_result = $update_query->execute($content); return $query_result; } elseif (StaticFunctions::str_starts_with($statement, "INSERT")) { $insert_query = $connect->prepare($statement); $query_result = $insert_query->execute($content); if ($query_result) { return $connect->lastInsertId(); } else { return false; } } elseif (StaticFunctions::str_starts_with($statement, "DELETE")) { $delete_query = $connect->prepare($statement); $delete_query->execute($target); $count = $delete_query->rowCount(); if ($delete_query) { return $count; } else { return false; } } else { return false; } } public static function isUserLogin() { StaticFunctions::new_session(); $durum = empty($_SESSION["userid"]) ? "false" : "true"; return $durum; } public static function isUserLogin_Execute() { StaticFunctions::new_session(); $durum = empty($_SESSION["userid"]) ? self::go("login") : "true"; } public static function isUserAdmin_Execute() { StaticFunctions::new_session(); $userState = StaticFunctions::getUserCredentials()["state"]; if ($userState != 2) { StaticFunctions::go_home(); } } public static function encryptPassword($data) { $secret = "35onoi2=-7#%g03kl"; $encrypt_method = "AES-256-CBC"; $secret_key = "11*_33"; $secret_iv = "22-=**_"; $key = hash("sha256", $secret_key); $iv = substr(hash("sha256", $secret_iv), 0, 16); $encrypted_Data = openssl_encrypt($data, $encrypt_method, $key, false, $iv); return $encrypted_Data; } } ?>

Function Calls

None

Variables

None

Stats

MD5 785e7d94f0caa85be50ebd8eeabd053f
Eval Count 0
Decode Time 185 ms