GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — phpSession/session.class.php at master · adrius/phpSession Expand file tree/ Copy pathsession.class.phpMore file actions 114 lines (92 loc) · 2.05 KB / Copy pathsession.class.phpFile metadata and controls114 lines (92 loc) · 2.05 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 <?php /* * Satellite class for session handling. */ class Session { public function __construct( $autostart = TRUE ) { $this->started = ( isset( $_SESSION ) ? TRUE : FALSE ); if ( $autostart == TRUE && $this->started == FALSE ) { $this->start(); } } /* Avoids that pesky notice error if the session was already started previously in the stack. --Kris */ public function start() { if ( !$this->started ) { session_start(); $this->started = TRUE; } } /* Stop the session. --Kris */ public function stop( $clear_cookie = TRUE, $clear_data = TRUE ) { if ( $this->started ) { if ( $clear_cookie == TRUE && ini_get( "session.use_cookies" ) == TRUE ) { $params = session_get_cookie_params(); setcookie( session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"] ); } if ( $clear_data == TRUE ) { $_SESSION = array(); } session_destroy(); session_write_close(); $this->started = FALSE; } } /* Generates a random string for use as a new sessionid or any other purpose. --Kris */ public function generate_sid( $chars = 100, $alpha = TRUE, $numeric = TRUE, $symbols = TRUE, $timestamp = TRUE ) { if ( $chars <= 0 || !is_numeric( $chars ) ) { return FALSE; } $salt = NULL; if ( $alpha == TRUE ) { $salt .= "abcdefghijklmnopqrstuvwxyz"; } if ( $numeric == TRUE ) { $salt .= "1234567890"; } if ( $symbols == TRUE ) { $salt .= "-_"; } $sid = NULL; for ( $c = 1; $c <= $chars; $c++ ) { $sid .= $salt{mt_rand( 0, strlen( $salt ) - 1 )}; if ( mt_rand( 0, 1 ) == 1 ) { $sid{strlen( $sid ) - 1} = strtoupper( $sid{strlen( $sid ) - 1} ); } } if ( $timestamp == TRUE ) { $sid .= time(); } return $sid; } public function set( $var, $val ) { $_SESSION[$var] = $val; } public function clear( $var ) { unset( $_SESSION[$var] ); } public function get( $var ) { return ( isset( $_SESSION[$var] ) ? $_SESSION[$var] : FALSE ); } } |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |