Viewing file: 5.php (1.58 KB) -rw-rw-rw- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
// Include Magic Quotes stripping script
require_once('MagicQuotes/strip_quotes.php');
// Include MySQL class
require_once ('Database/MySQL.php');
// Include Session class
require_once ('Session/Session.php');
// Include Auth class
require_once ('AccessControl/Auth.php');
$host='localhost'; // Hostname of MySQL server
$dbUser='harryf'; // Username for MySQL
$dbPass='secret'; // Password for user
$dbName='sitepoint'; // Database name
// Instantiate MySQL connection
$db=& new MySQL($host,$dbUser,$dbPass,$dbName);
// Instantiate the Auth class
$auth=& new Auth ($db,'4.php','secret');
// For logging out
if ( isset ( $_GET['action'] ) && $_GET['action'] == 'logout' ) {
$auth->logout();
}
?>
<!doctype html public "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> Welcome </title>
<meta http-equiv="Content-type"
content="text/html" charset="iso-8859-1" />
<style type="text/css">
body, a, td, input
{
font-family: verdana;
font-size: 11px;
}
h1
{
font-family: verdana;
font-size: 15px;
color: navy
}
</style>
</head>
<body>
<h1>Welcome</h1>
<p>You are now logged in</p>
<?php
if ( isset ($_GET['action']) && $_GET['action'] == 'test' ) {
echo ( '<p>This is a test page. You are still logged in' );
}
?>
<p><a href="<?php echo ( $_SERVER['PHP_SELF'] ); ?>?action=test">Test page</a></p>
<p><a href="<?php echo ( $_SERVER['PHP_SELF'] ); ?>?action=logout">Logout</a></p>
</body>
</html>
|