PHP Classes

File: sample.php

Recommend this page to a friend!
  Classes of Stanislav Shramko   DB_Session   sample.php   Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: Just a simple test.
Class: DB_Session
Storing session data in DB.
Author: By
Last change: Little fix in a test file.
Date: 21 years ago
Size: 633 bytes
 

Contents

Class file image Download
<?

   
include_once 'DB_Session.php';

   
// Setting the values up
   
$dsn = 'mysql://root:@dragon/test';
   
$session_table = 'session_table';
   
$persistent = true;

   
// Creating the session
   
$sess = new DB_Session($dsn, $session_table, $persistent);

   
// Making anything you like with it
   
if (!isset($_SESSION['foo'])) {
       
$_SESSION['foo'] = 1;
       
session_register('foo');
    } else for (
$i = 0; $i < 100000; $i++) {
       
$_SESSION['foo']++;
    }

   
// Showing the result
   
echo "<br>\$_SESSION['foo']: " . $_SESSION['foo'];

?>
<br>
<a href="sample.php">Press here</a>