Location: PHPKode > scripts > WebNight Commander > webnight-commander-v2/source/includes/10_class_session.php
<?php

class session {

    public $values;

    protected $sess_name;
    protected $stamp_name;

    public function __construct($sess_name="wnc", $lifetime=30, $stamp_name="stamp", $store_dir=null) {
        $this->sess_name = $sess_name;
        $this->stamp_name = $stamp_name;
        $lifetime *= 60;
        ini_set('session.gc_maxlifetime', $lifetime);
        if ($store_dir !== null)
            ini_set('session.save_path', $store_dir);
        $this->start();
    }

    public function start() {
        session_start();
        $stamp = @md5(
            $_SERVER['HTTP_ACCEPT_CHARSET'] .
            $_SERVER['HTTP_ACCEPT_ENCODING'] .
            preg_replace('/\d\.?/', "", $_SERVER['HTTP_USER_AGENT']) .
            $_SERVER['REMOTE_ADDR']
        );

        if (!isset($_SESSION [$this->sess_name] [$this->stamp_name] ))
            $_SESSION [$this->sess_name] [$this->stamp_name] = $stamp;

        elseif ($_SESSION [$this->sess_name] [$this->stamp_name] != $stamp) {
            $this->restart();
            return;
        }

        $this->values = &$_SESSION[$this->sess_name];
    }

    public function destroy() {
        session_destroy();
    }

    public function restart() {
        $this->destroy();
        $this->start();
    }

}

?>
Return current item: WebNight Commander