/**
  * Registers the handler into PHP
  * @param string $db
  * @param string $collection
  * @param array $config
  */
 public static function register($db, $collection, $config = array())
 {
     $m = new self();
     self::$_instance = $m;
     // boom.
     session_set_save_handler(array($m, 'noop'), array($m, 'noop'), array($m, 'read'), array($m, 'write'), array($m, 'destroy'), array($m, 'gc'));
 }
Exemple #2
0
<?php

/**
 * Clears all PHP sessions out of Dynamo by dropping the table
 */
header('Content-type: text/plain');
require_once '../DynamoSessionHandler.php';
DynamoSessionHandler::register('session', 'session');
DynamoSessionHandler::getInstance()->getTable()->dropTable();
echo "Sessions Cleared\n";
Exemple #3
0
<?php

header('Content-Type: text/plain');
require_once '../DynamoSessionHandler.php';
DynamoSessionHandler::register('session', 'session');
if (isset($_GET['s'])) {
    session_id($_GET['s']);
}
try {
    session_start();
} catch (Exception $e) {
    // a failure
    header("HTTP/1.0 500 oh. shit.");
}
if (isset($_GET['v'])) {
    $start = microtime(true);
    $key = 'k' . $_GET['v'];
    if (isset($_SESSION[$key])) {
        $_SESSION[$key]['c']++;
    } else {
        $_SESSION[$key]['c'] = 1;
    }
    $time = microtime(true) - $start;
    if (isset($_SESSION[$key]['t'])) {
        $_SESSION[$key]['t'] += $time;
    } else {
        $_SESSION[$key]['t'] = $time;
    }
}
print_r($_SESSION);
$totalc = 0;