example
1 <?php 2 # include the configuration file. 3 require_once($_SERVER['DOCUMENT_ROOT'] . '../global.conf.php'); 4 require_once($APP['path']['core'] . 'net/http/session/Bs_SimpleSession.class.php'); 5 6 ################################################################################ 7 # Start of the session 8 $session =& $GLOBALS['Bs_SimpleSession']; // Use the per ref operator '=&' <-- !! 9 10 ################################################################################ 11 # Sample 1 12 # -------- 13 # Simple use. (No parallel sessions and using default property settings). 14 //$session->unregister('my_var'); 15 $aVariable=0; 16 $ok = $session->register('my_var', $aVariable); 17 $output = ''; 18 if (!$ok) XR_dump($session->getErrors(), __LINE__, '', __FILE__); 19 $output .= "Simple Counter: <B>" . $aVariable++ . "</B><br>"; 20 ?> 21 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 22 23 <html> 24 <head> 25 <title>Example 1 of Bs_SimpleSession</title> 26 </head> 27 28 <body> 29 <H2>Bs_SimpleSession Sample 1</H2> 30 31 <hr> 32 <?php 33 echo $output; 34 ?> 35 <br><br> 36 37 <a href="#" onClick="javascript:var block=document.getElementById('sessProps'); block.style.visibility='hidden'">Hide Session Properties</a> 38 <div id="sessProps" style="visibility : visible;"> 39 <a name="x" href="x"></a> 40 <?php 41 echo $session->toHtml(); 42 ?> 43 </div> 44 45 </body> 46 </html>
|