<?php
// Using custom modes
require "request.class.php";
$request = new request();
$request->add_mode("x", $_SESSION); // Add session as the mode "x". Note that "s" is already taken by $_SERVER
$time = $request->get_int("logged_time", "x"); // Example of getting data from $_SESSION using same syntax as other variables
$request->remove_mode("x"); // mode "x" no longer needed
// You could also do this:
$request->allow_mode_override(true);
$request->add_mode("s", $_SESSION);
$time = $request->get_int("logged_time", "s");
$request->remove_mode("s");
$exampledata = array("id" => "5", "username" => "jsmith"); // Example data, such as that about a user
$request->add_mode("u", $exampledata); // Add user data as the mode "u"
$id = $request->get_int("id", "u"); // Example of getting data from $exampledata using same syntax as other variables
$request->set_default_mode("u");
$id = $request->get_int("id"); // Now "id" comes from mode "u", because second parameter was equivalent to null
?>
|