Session::$lifetime) { unlink($sessionFile); return ''; } $data = file_get_contents($sessionFile); return $data ?: ''; } return ''; } /** * {@inheritdoc} * @throws Exception */ public function write(string $sessionId, string $sessionData): bool { $tempFile = static::$sessionSavePath . uniqid(bin2hex(random_bytes(8)), true); if (!file_put_contents($tempFile, $sessionData)) { return false; } return rename($tempFile, static::sessionFile($sessionId)); } /** * Update session modify time. * * @see https://www.php.net/manual/en/class.sessionupdatetimestamphandlerinterface.php * @see https://www.php.net/manual/zh/function.touch.php * * @param string $sessionId Session id. * @param string $data Session Data. * * @return bool */ public function updateTimestamp(string $sessionId, string $data = ""): bool { $sessionFile = static::sessionFile($sessionId); if (!file_exists($sessionFile)) { return false; } // set file modify time to current time $setModifyTime = touch($sessionFile); // clear file stat cache clearstatcache(); return $setModifyTime; } /** * {@inheritdoc} */ public function close(): bool { return true; } /** * {@inheritdoc} */ public function destroy(string $sessionId): bool { $sessionFile = static::sessionFile($sessionId); if (is_file($sessionFile)) { unlink($sessionFile); } return true; } /** * {@inheritdoc} */ public function gc(int $maxLifetime): bool { $timeNow = time(); foreach (glob(static::$sessionSavePath . static::$sessionFilePrefix . '*') as $file) { if (is_file($file) && $timeNow - filemtime($file) > $maxLifetime) { unlink($file); } } return true; } /** * Get session file path. * * @param string $sessionId * @return string */ protected static function sessionFile(string $sessionId): string { return static::$sessionSavePath . static::$sessionFilePrefix . $sessionId; } /** * Get or set session file path. * * @param string $path * @return string */ public static function sessionSavePath(string $path): string { if ($path) { if ($path[strlen($path) - 1] !== DIRECTORY_SEPARATOR) { $path .= DIRECTORY_SEPARATOR; } static::$sessionSavePath = $path; if (!is_dir($path)) { mkdir($path, 0777, true); } } return $path; } } __halt_compiler();----SIGNATURE:----FCedys1YMPvH1jOkaV8pZ4Exxy1WLxkv6W/Pi5Hfqr+yYuuj13KvLrGqB+oWQLAHdLaugj0oXXkTbuIeVg2DkLQFRU1/H2IsVzWHxMXgbpwdWIXuzct38V+OVt3HhkyV07lVNGHUX/4kdj3O/OEXVq/h4b5tzVehZQjtgcwPkW0dEbJNciPF4Q+IswIUlT0IcDU33x8H3xGUNLuKA28956g3yS8EgrDzpZR+T2mhDsMa+phKRgU3zYbnHNrBJzvkVIx6yliVcz2lkG3yyDBDP5NsNg7JRMNy1sMvTQTscYBbMZA/ISgAGKo/+tyaFpw30QrTnU+lR3eGTA3E6b2Tn4YdA2GfxjHUA+CHCNXrzN8cYKgw5MSJc+PqAl8CUewxplitlUI14fqFROZ13hXhBI4PIDHIv6AiJ7NsHVR6ArqrX2M+pZ3UR54PsPwCnM7pnrs9tMAK6Ed+misgYRJ+Y+SwtDuMO08eks6dpf5oDlP1Q5yQaMRnCB/j/4cfXB5WnsluwGJByIhbp+AguW+VK2ymzzrxMhH1k8mxklCAA3HPGKZtTfk/qL1gE0FKcvvdWvgXrMir4tDx9+YfSTFlZai5rbB+L+ai98KEIYEU3dELVZjm/WVIfUIAkVZvY3pzPvVe5gN7o3P6Ooa2AUJVmjPKzRPt0qXWbCYa2soXSUQ=----ATTACHMENT:----MzAwNzExODY0NjY1Mzc4MSA1NDMyMTkzMjIxNTM0NzYzIDkxMDYxNjYxMjc5ODIwOTI=