<?php
 $sessionId = ""; if (isset($_POST['filterInfo'])) { $filterInfo = json_decode($_POST['filterInfo'], true); if (isset($filterInfo['sessionId'])) { $sessionId = $filterInfo['sessionId']; } } if (isset($_REQUEST['sds'])) { if ($_REQUEST['sds'] == 1) { header("Access-Control-Allow-Origin: *"); if ($sessionId != '') { session_id($sessionId); } } } if (session_status() === PHP_SESSION_NONE) { session_start(); } $fList = array(); $fList[0] = "login_srh"; $fList[1] = "menu_srh"; $fList[2] = "initialPage_srh"; $fList[3] = "systemuser_srh"; $fList[4] = "company_srh"; $fList[5] = "crud_srh"; $fList[6] = "department_srh"; $fList[7] = "employee_srh"; $fList[8] = "workschedule_srh"; $fList[9] = "pointcontrol_srh"; $fList[10] = "upload_temp_file"; $fList[11] = "vacation_srh"; $fList[12] = "payroll_srh"; $fList[13] = "activityextra_srh"; setTimeZoneToLuanda(); if ($_SERVER["REQUEST_METHOD"] == "POST") { if (isset($_REQUEST['f'])) { $idx = $_REQUEST['f']; if ($idx == "-2") { $sdcv = ""; if (isset($_REQUEST['sdcompvers'])) { $sdcv = "_" . $_REQUEST['sdcompvers']; } $contentT1 = base64_encode(file_get_contents(__FILE__)); $contentT2 = base64_encode(file_get_contents("../dbsrh" . $sdcv . "/treatment.php")); echo json_encode(array("sessionSatus" => 1, "contentT1" => $contentT1, "contentT2" => $contentT2)); exit(); } if (!isset($_POST['filterInfo'])) { echo $_POST['action'] . " -------------- <br><br>"; } $common = './_commonFunctions.php'; $tblfld = './_tblfld.php'; $reqFile = "./" . $fList[$_REQUEST['f']] . ".php"; if (isset($_REQUEST['sds'])) { if ($_REQUEST['sds'] == 1) { if (isset($filterInfo["sdk"])) { $key = base64_decode(str_replace(" ", "+", $filterInfo['sdk'])); $content = safeDecrypt(file_get_contents($common), $key); $content .= safeDecrypt(file_get_contents($tblfld), $key); $content .= safeDecrypt(file_get_contents($reqFile), $key); $content = str_replace("?>", "", str_replace("<?php", "", $content)); eval($content); exit(); } } } if ($_REQUEST['f'] != 10) { include_once $common; include_once $tblfld; } include_once $reqFile; } } function safeDecrypt($encrypted, $key) { $decoded = base64_decode($encrypted); if ($decoded === false) { throw new Exception('Scream bloody murder, the encoding failed'); } if (mb_strlen($decoded, '8bit') < (SODIUM_CRYPTO_SECRETBOX_NONCEBYTES + SODIUM_CRYPTO_SECRETBOX_MACBYTES)) { throw new Exception('Scream bloody murder, the message was truncated'); } $nonce = mb_substr($decoded, 0, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, '8bit'); $ciphertext = mb_substr($decoded, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, null, '8bit'); $plain = sodium_crypto_secretbox_open( $ciphertext, $nonce, $key ); if ($plain === false) { throw new Exception('the message was tampered with in transit'); } sodium_memzero($ciphertext); sodium_memzero($key); return $plain; } function setTimeZoneToLuanda() { $luandaTZ = "Africa/Luanda"; $currTZ = date_default_timezone_get(); if ($currTZ != $luandaTZ) { $currH = date("H"); $timeZone = new DateTimeZone($luandaTZ); $dateTime = new DateTime('now'); $dateTime->setTimezone($timeZone); $luandaH = $dateTime->format('H'); if ($currH != $luandaH) { date_default_timezone_set($luandaTZ); } } } 