PHP Classes

File: test_ooauth.php

Recommend this page to a friend!
  Classes of Heiko Dillemuth   OO Auth   test_ooauth.php   Download  
File: test_ooauth.php
Role: Example script
Content type: text/plain
Description: Example File
Class: OO Auth
Manage life time limited sessions securely
Author: By
Last change: changed TEST variable
Date: 19 years ago
Size: 1,167 bytes
 

Contents

Class file image Download
<?php
######################################################################################
#
# Simple test Script for class: ooauth
#
# (c) Heiko at dillemuth . de, 2004-07-01, 2004-07-20
######################################################################################


include "class_ooauth.php";

#Which var will be tracked?
$ooauth_remote_addr=& $_SERVER['REMOTE_ADDR'];

#Init Session as Projekt: "test_session"
$s=& new ooauth("test_session");
print
"<body><pre>";

#Print Debugs
#$s->set_debug(true);

#Store Var within Session, test
$s->set_uvar("money", "200,--");


#Simple Password/User Test :-)
if($_REQUEST[loginname]=="admin" and $_REQUEST[password]=="password") {

   
#Create new session, Timeout 5 Sek.,
    #and take a look at Server Var $HTTP_HOST
   
print "<br>:new session:".$s->new_session(5, "ooauth_remote_addr");
}

#Wait 2 Sek., increase to test the timeout
sleep(2);

#Got Timeout or Error?
if($ooauth->test_session(5)) {

   
header("Location: http://www.phpclasses.org\n\n"); #Redirect if not valid session
   
exit();
}


print
"<hr>no timeout<p>";
print_r( $s->get_uvar("money"));

exit(
0);
?>