Example lib.php Files
Ex 1 (filename: lib.php)
<?php
// THIS PROGRAM WAS GENERATED WITH DDATAOBJECTS 2.7
require_once('/path/to/lib/generated/generated_class_functions.php');
////////////////// All your code below this line ///////////////////////////////
load_all();
?>
Ex 2 (filename: lib.php) - included simple authentication, global site variables, and frame variables
<?php
// THIS PROGRAM WAS GENERATED WITH DDATAOBJECTS 2.7
require_once('/path/to/lib/generated/generated_class_functions.php');
////////////////// All your code below this line ///////////////////////////////
function __autoload($class_name) { include '/path/to/lib/'.$class_name.'.php'; }
session_start();
Header("Content-type: text/html");
Header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
Header("Cache-Control: no-cache, must-revalidate");
Header ("Pragma: no-cache");
$rwd = $GLOBALS["rwd"] = "/example"; // root web directory
$awd = $GLOBALS["awd"] = "/path/to/example"; // absolute web directory
$rid = $GLOBALS["rid"] = "icons"; // root icons directory
$aid = $GLOBALS["aid"] = "/path/to/icons"; // absolute icons directory
if ($_GET['logout'])
{
$_SESSION['authenticated_user_id'] = null;
$_SESSION['login_time'] = null;
Header("Location: $rwd/");
return 0;
}
if ($person_id = (int) $_SESSION['authenticated_user_id'])
{
$p = new person($person_id);
$max_login_interval = 86400; // 24 hours
if ((time() - $_SESSION['login_time']) > $max_login_interval || !$p->name)
{
unset($person_id);
unset($p);
}
}
if (!$person_id)
{
if ($_SERVER['SCRIPT_NAME'] != "$rwd/login.php" && $_SERVER['SCRIPT_NAME'] != "$rwd/signup.php")
{
Header("Location: $rwd/login.php");
return 0;
}
}
$head = "
<html>
<head>
<title>Page Title</title>
<link rel=\"stylesheet\" href=\"$rwd/styles.css\" type=\"text/css\">
<script language=\"Javascript\" src=\"$rwd/functions.js\"></script>
</head>
<body>";
$foot = "\n</body>\n</html>";
?>