.htaccess
11 years ago
index.php
1 year ago
session.php
1 year ago
trace.php
2 days ago
wp-login.php
1 year ago
wp-settings.php
2 years ago
session.php
80 lines
| 1 | <?php |
| 2 | /** |
| 3 | * GOTMLS SESSION Start |
| 4 | * @package GOTMLS |
| 5 | * @since 4.23.77 |
| 6 | */ |
| 7 | |
| 8 | require_once(dirname(__FILE__)."/trace.php"); |
| 9 | |
| 10 | if (!defined("GOTMLS_SESSION_TIME")) { |
| 11 | define("GOTMLS_SESSION_TIME", microtime(true)); |
| 12 | |
| 13 | function GOTMLS_session_start($ID_sess = false) { |
| 14 | GOTMLS_define("GOTMLS_SESSION_ID", session_id()); |
| 15 | if (!($GOTMLS_LOGIN_KEY = GOTMLS_SESSION_ID)) { |
| 16 | GOTMLS_define("SESS_TEST", @session_start()); |
| 17 | if (!($GOTMLS_LOGIN_KEY = session_id())) |
| 18 | GOTMLS_define("SESS_FILE", $GOTMLS_LOGIN_KEY = GOTMLS_session_file()); |
| 19 | } |
| 20 | if (isset($_SESSION["GOTMLS_SESSION_TIME"])) |
| 21 | $_SESSION["GOTMLS_SESSION_LAST"] = $_SESSION["GOTMLS_SESSION_TIME"]; |
| 22 | else |
| 23 | $_SESSION["GOTMLS_SESSION_LAST"] = 0; |
| 24 | $_SESSION["GOTMLS_SESSION_TIME"] = GOTMLS_SESSION_TIME; |
| 25 | return md5($GOTMLS_LOGIN_KEY.GOTMLS_SESSION_TIME.serialize($_SERVER)); |
| 26 | } |
| 27 | |
| 28 | function GOTMLS_session_close() { |
| 29 | if (defined("SESS_FILE")) |
| 30 | GOTMLS_session_file($_SESSION["GOTMLS_server_time"]); |
| 31 | if (session_id()) |
| 32 | session_write_close(); |
| 33 | } |
| 34 | |
| 35 | function GOTMLS_session_die($output, $header = "Content-type: text/javascript") { |
| 36 | if ($header) |
| 37 | @header($header); |
| 38 | GOTMLS_session_close(); |
| 39 | die($output); |
| 40 | } |
| 41 | |
| 42 | function GOTMLS_session_init($GOTMLS_server_times = array()) { |
| 43 | if (!(isset($_SESSION["GOTMLS_server_time"]) && is_array($_SESSION["GOTMLS_server_time"]))) |
| 44 | $_SESSION["GOTMLS_server_time"] = array(); |
| 45 | if (defined("GOTMLS_SESSION_TIME") && !(isset($_SESSION["GOTMLS_server_time"]["time_START"]) && is_numeric($_SESSION["GOTMLS_server_time"]["time_START"]))) |
| 46 | $_SESSION["GOTMLS_server_time"]["time_START"] = GOTMLS_SESSION_TIME; |
| 47 | if (defined("GOTMLS_LOGIN_PROTECTION") && !(isset($_SESSION["GOTMLS_server_time"]["sess_ID"]) && strlen($_SESSION["GOTMLS_server_time"]["sess_ID"]) == 32)) |
| 48 | $_SESSION["GOTMLS_server_time"]["sess_ID"] = GOTMLS_LOGIN_PROTECTION; |
| 49 | if (is_array($GOTMLS_server_times) && count($GOTMLS_server_times)) |
| 50 | $_SESSION["GOTMLS_server_time"] = array_replace_recursive($_SESSION["GOTMLS_server_time"], $GOTMLS_server_times); |
| 51 | } |
| 52 | |
| 53 | function GOTMLS_session_file($GOTMLS_server_times = array()) { |
| 54 | if (defined("GOTMLS_INSTALL_TIME") && defined("GOTMLS_SESSION_FILE")) { |
| 55 | GOTMLS_session_init(); |
| 56 | $GOTMLS_server_times["GOTMLS_LOGIN_ARRAY"] = array("ADDR" => GOTMLS_REMOTEADDR, "AGENT" => (isset($_SERVER["HTTP_USER_AGENT"])?$_SERVER["HTTP_USER_AGENT"]:"HTTP_USER_AGENT"), "TIME"=>GOTMLS_INSTALL_TIME); |
| 57 | $GOTMLS_LOGIN_KEY = md5(serialize($GOTMLS_server_times["GOTMLS_LOGIN_ARRAY"])); |
| 58 | $LAST_HOUR = GOTMLS_encode_njG(intval(GOTMLS_SESSION_TIME) - 3600); |
| 59 | $THIS_HOUR = GOTMLS_encode_njG(intval(GOTMLS_SESSION_TIME)); |
| 60 | if (!defined("GOTMLS_LOG_FILE")) |
| 61 | define("GOTMLS_LOG_FILE", dirname(GOTMLS_SESSION_FILE)."/gotmls_$THIS_HOUR.$GOTMLS_LOGIN_KEY.php"); |
| 62 | if (is_file(GOTMLS_LOG_FILE)) |
| 63 | include(GOTMLS_LOG_FILE); |
| 64 | elseif (is_file($LOG_FILE = dirname(GOTMLS_SESSION_FILE)."/gotmls_$LAST_HOUR.$GOTMLS_LOGIN_KEY.php")) |
| 65 | include($LOG_FILE); |
| 66 | if (is_array($GOTMLS_server_times) && count($GOTMLS_server_times)) |
| 67 | $_SESSION["GOTMLS_server_time"] = array_replace_recursive($_SESSION["GOTMLS_server_time"], $GOTMLS_server_times); |
| 68 | if (GOTMLS_save_contents(GOTMLS_LOG_FILE, '<?php $_SESSION["GOTMLS_server_time"] = array_replace_recursive($_SESSION["GOTMLS_server_time"], GOTMLS_uckserialize(GOTMLS_decode("'.GOTMLS_encode(serialize($_SESSION["GOTMLS_server_time"]), "D").'")));')) { |
| 69 | if (is_array($sess_files = scandir(dirname(GOTMLS_SESSION_FILE)))) |
| 70 | foreach ($sess_files as $sess_file) |
| 71 | if (is_file(dirname(GOTMLS_SESSION_FILE)."/$sess_file") && preg_match('/^gotmls_(?!'.$LAST_HOUR.')(?!'.$THIS_HOUR.')\w{3}\.[a-f\d]{32}\.php$/i', $sess_file)) |
| 72 | @unlink(dirname(GOTMLS_SESSION_FILE)."/$sess_file"); |
| 73 | return $GOTMLS_LOGIN_KEY; |
| 74 | } else |
| 75 | return 0; |
| 76 | } else |
| 77 | return false; |
| 78 | } |
| 79 | } |
| 80 |