PHP Classes

File: examples/simple-example.php

Recommend this page to a friend!
  Classes of Tony   twzAuth   examples/simple-example.php   Download  
File: examples/simple-example.php
Role: Example script
Content type: text/plain
Description: example script
Class: twzAuth
Authenticate users using HTTP Basic authentication
Author: By
Last change:
Date: 9 years ago
Size: 1,110 bytes
 

Contents

Class file image Download
<?php
/*
    Example - basic entry page for twzAuth (simple mode)
    ----------------------------------------------------
   
    Only valid, authenticated users can view this page.
   
*/

// clumsy "logout" (for testing only)..
if(isset($_POST['logout']))
    { unset(
$_SERVER['PHP_AUTH_USER']); }


require
'simple-include.php';


?><!DOCTYPE HTML>
<html lang="en">
<head>
    <title>twzAuth (simple mode)</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <style> form { display:inline; } </style>
</head>
<body>

<h2>Welcome <?php echo $Username; ?></h2>
<p>If you can see this page, you have authenticated successfully in <b>simple mode</b>.</p>
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>

<div>There is no "logout" facility with HTTP authentication (except <br />
    by restarting the browser). For testing purposes you can <br />
    click <form method="post"><input type="submit" name="logout" value="&quot;logout&quot;" /></form>,
    and then cancel the subsequent dialog.</div>

<p><a href="./">home</a></p>

</body>
</html>