sessions class PHP script

SPONSORED LINKS

    Specification

  • Version:
  • File size: 0 KB
  • File name: fundisom.com
  • Last update:
  • Platform: Windows / Linux / BSD
  • Language: PHP
  • Price:GPL
  • Company: fundisom (View more)

sessions class script description:




Publisher review:
sessions class - php snippet Sessions class - php snippetclass Session { // Start a new session // Syntax: $session = new session(); function Session() { session_start(); } // Set a variable in a current session // Syntax: $session->set_var("Var name", "Value"); function set_var($varname,$varvalue) { if(!isset($varname) || !isset($varvalue) ) { die('Function setvar( String $varname, mixed $value ) expects two parameters!'); } if(phpversion() >= "4.1.0") { $_SESSION[$varname] = $varvalue; } if(!isset($GLOBALS[$varname]) ) { $GLOBALS[$varname] = $varvalue; }else{ global $HTTP_SESSION_VARS; session_register($varname); $GLOBALS['HTTP_SESSION_VARS'][$varname] = $varvalue; if(!isset($GLOBALS[$varname]) ) { $GLOBALS[$varname] = $varvalue; } } } // Get a variable from current session // Syntax: $variable = $session->get_var("var name"); // echo "$variable" to get grabbed session variable function get_var( $varname ) { if(!isset($varname)) { die('Function getvar( String $varname ) expects a parameter!'); } if( phpversion() >= "4.1.0" ) { if (isset($GLOBALS[$varname])) { return $GLOBALS[$varname]; } elseif (isset($GLOBALS['_SESSION'][$varname])) { $GLOBALS[$varname] = $GLOBALS['_SESSION'][$varname]; return $GLOBALS['_SESSION'][$varname]; } }else{ if (isset($GLOBALS[$varname])) { return $GLOBALS[$varname]; } elseif (isset($GLOBALS['HTTP_SESSION_VARS'][$varname])) { $GLOBALS[$varname] = $GLOBALS['HTTP_SESSION_VARS'][$varname]; return $GLOBALS['HTTP_SESSION_VARS'][$varname]; } } } // Get a current session string (EXAMPLE: PHPSESSID=b188e8c9c45b347cdded2) // Syntax: $sid = $session->get_sid_string(); // echo "$sid" to grab the string id. By default it uses PHPSESSID= variable function get_sid_string() { return session_name() . "=" . session_id(); } // Get current session ID (EXAMPLE: whatever=b188e8c9c45b347cdded2) // Syntax: $sid = $session->get_sid(); function get_sid() { return session_id(); } // Unset a current session variable // Syntax: $session->var_unset("variable name"); function var_unset($varname) { if(!isset($varname)) { die('Function var_unset( String $varname ) expects a parameter!'); } if( phpversion() >= '4.1.0') { if(isset($GLOBALS[$varname])) { unset($GLOBALS[$varname] ); } if (isset($GLOBALS['_SESSION'][$varname])) { unset($GLOBALS['_SESSION'][$varname]); } }else{ if (isset($GLOBALS[$varname])) { unset($GLOBALS[$varname] ); } if (isset($GLOBALS['HTTP_SESSION_VARS'][$varname])) { unset($GLOBALS['HTTP_SESSION_VARS'][$varname]); } } } // Unset every variable in the current session // Syntax: $session->ses_unset(); function ses_unset() { if(phpversion() >= '4.1.0') { if(isset($GLOBALS['_SESSION'])) $a = $GLOBALS['_SESSION']; { while(list($key,) = each($a)) { $this->var_unset($key); } } }else{ if(isset($GLOBALS['HTTP_SESSION_VARS'])) { $a = $GLOBALS['HTTP_SESSION_VARS']; while(list($key,) = each($a)) { $this->var_unset($key); } } } } // This will delete your current session and delete every session variable created // Syntax: $session->destroy(); function destroy() { $this->ses_unset(); session_destroy(); } // Display all variables in a current session // Syntax: $session->show(); function show() { echo 'Variables set in current session:'; if(phpversion() >= '4.1.0') { if(isset($GLOBALS['_SESSION'
sessions class is a PHP script for Snippets scripts design by fundisom. It runs on following operating system: Windows / Linux / BSD.

Operating system:
Windows / Linux / BSD

Latest script and internet news

222

222

22

Posted on: 18 Jul 2023 22:27 by A. Brown

111

111

111

Posted on: 18 Jul 2023 22:24 by A. Brown

The permanently active Push system offered by the new Google Chrome 42

The permanently active Push system offered by the new Google Chrome 42

Hacked By !Sc-sT

Posted on: 17 Mar 2015 07:57 by A. Brown

SPREAD THE WORD

User Rating


Rating: 2.2 out of 5
Based on 13 ratings. 13 user reviews.

  • Currently 2.15 out of 5
  • 1
  • 2
  • 3
  • 4
  • 5