PHP Classes

File: sample.php

Recommend this page to a friend!
  Classes of teste   SessionManager   sample.php   Download  
File: sample.php
Role: Sample output
Content type: text/plain
Description: Learn to use SessionManager
Class: SessionManager
Manager class for easy session variable handling
Author: By
Last change: Grafia do comentário corrigida.
Date: 20 years ago
Size: 916 bytes
 

Contents

Class file image Download
<?php include("SessionManager.php"); // Constructor call: $session = new SessionManager("path_for_session", client_ip, expiration_time) // // path_for_session: local directory where the session files will be stored // client_ip: client ip used to handle session, you can use $REMOTE_ADDR. // expiration_time: the time in minutes that the session is going to be active. $sessao = new SessionManager("./",getenv("REMOTE_ADDR"),100); // Create and start the session engine $sessao->createSession(); // Store some variables in the session $sessao->registerSessionVar("exp1","Hello"); $sessao->registerSessionVar("exp2","World!"); $sessao->registerSessionVar("exp3","Man"); // Load and print stored variables print("exp1 = " . $sessao->getSessionVar("exp1") . "<br>"); print("exp2 = " . $sessao->getSessionVar("exp2") . "<br>"); print("exp3 = " . $sessao->getSessionVar("exp3") . "<br>"); ?>