HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers68/resortouddorpduin.nl/wwwroot/lib/general/session.class.php
<?php
/**
 * session.class.php
 * Created by Komma Mediadesign.
 * Author: mike
 * Date: 3/20/13
 */

class Session
{
    public static function init()
    {
        // Start the session
        session_start();

        // Create some default sessions
        Session::set('ip',$_SERVER['REMOTE_ADDR']);
    }

    /*
     * Set function
     */
    public static function set($key,$value)
    {
        if(is_array($key))
        {
            // Check if the session is two dimensional
            $_SESSION[$key[0]][$key[1]] = $value;
        }
        else
        {
            $_SESSION[$key] = $value;
        }
    }

    /*
     * Get values from the session
     */
    public static function get($key)
    {
        if(is_array($key))
        {
            // Check if the session is two dimensional
            if(isset($_SESSION[$key[0]][$key[1]]))
            {
                return $_SESSION[$key[0]][$key[1]];
            }
        }
        else if(isset($_SESSION[$key]))
        {
            return $_SESSION[$key];
        }
        return false;
    }

    /*
     * Destroy a session
     */
    public static function destroy($key=null)
    {
        if($key == null)
        {
            session_destroy();
        }
        else if(is_array($key))
        {
            // Check if the session is two dimensional
            if(isset($_SESSION[$key[0]][$key[1]]))
            {
                unset($_SESSION[$key[0]][$key[1]]);
            }
        }
        else
        {
            unset($_SESSION[$key]);
        }
    }
}