Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

BaseTicket Class Reference
[Basic Modules]

Inheritance diagram for BaseTicket:

MyModule BaseModule List of all members.

Detailed Description

A class to handle automated logins via special links called 'tickets'.

BaseTicket handles teh creation, validation, and deletion of 'tickets' which are basically specially generated links that allow a user to automatically be logged in once. These are for sending emails and such where it is handy for a user not to have to remember a password. They are designed to be secure, but may not be entirely secure. Use them at your own risk.

Definition at line 12 of file base-ticket.inc.php.

Public Member Functions

 __construct ($hash=null, $table= 'tickets')
 our constructor
 getPagesXml ()
 our pages xml function...
 getCreateTableSql ()
 this gets the sql statement(s) that create the tables needed for this module.
 initGatePage ()
 initializes teh gate page.
 drawMainPage ()
 another placeholder
 verify ()
 verify that the ticket is legitimate.
 generate ($url, $user, $expire=null)
 generates a 16 letter hash based on sha1 of rand.
 url ()
 gets teh url to use.
 process ()
 process our hash.
 destroy ()
 destroy our hash from the database.

Private Attributes

 $hash
 The hash of the ticket...
 $url
 The url to send the user to.
 $user
 A user object for our ticket.
 $table
 The table to use.


Member Function Documentation

BaseTicket::__construct hash = null,
table = 'tickets'
 

our constructor

Parameters:
$hash the hash we're working with.

Definition at line 39 of file base-ticket.inc.php.

BaseTicket::destroy  ) 
 

destroy our hash from the database.

Definition at line 192 of file base-ticket.inc.php.

References dbExecute().

Referenced by process().

BaseTicket::drawMainPage  ) 
 

another placeholder

Reimplemented from BaseModule.

Definition at line 100 of file base-ticket.inc.php.

BaseTicket::generate url,
user,
expire = null
 

generates a 16 letter hash based on sha1 of rand.

Parameters:
$url the url to send the user to.
$user the user object we want to make a ticket for.
$expire when to expire... generated via date("Y-m-d H:i:s", foo). Optional... defaults to 2 months
Returns:
the hash key of the ticket.

Definition at line 131 of file base-ticket.inc.php.

References dbExecute(), and url().

BaseTicket::getCreateTableSql  ) 
 

this gets the sql statement(s) that create the tables needed for this module.

these should be the tables the module directly accesses.

Returns:
teh sql string

Reimplemented from BaseModule.

Definition at line 63 of file base-ticket.inc.php.

References url().

BaseTicket::getPagesXml  ) 
 

our pages xml function...

adds a 'gate' page which processes tickets.

Returns:
see BaseModule::getPagesXml()

Reimplemented from BaseModule.

Definition at line 52 of file base-ticket.inc.php.

BaseTicket::initGatePage  ) 
 

initializes teh gate page.

processes teh ticket. redirects them if its legit, checks for a url and redirects to that (pages should be asserting login if they need users logged in.), otherwise it errors out if there is no url parameter

Definition at line 84 of file base-ticket.inc.php.

References BaseModule::params(), process(), Util::redirect(), and url().

BaseTicket::process  ) 
 

process our hash.

if we can verify it, then we create the user, destroy the hash, and redirect them.

Returns:
true on success, false on failure

Definition at line 169 of file base-ticket.inc.php.

References $hash, $user, destroy(), Util::redirect(), url(), and verify().

Referenced by initGatePage().

BaseTicket::url  ) 
 

gets teh url to use.

Returns:
a full url for use in emails, etc.

Definition at line 158 of file base-ticket.inc.php.

References BaseModule::getUrl().

Referenced by generate(), getCreateTableSql(), initGatePage(), and process().

BaseTicket::verify  ) 
 

verify that the ticket is legitimate.

(ie it exists in teh database.)

Returns:
the db result row on success, false on failure.

Definition at line 110 of file base-ticket.inc.php.

References dbFetchAssoc(), dbGetNumRows(), and dbQuery().

Referenced by process().


Member Data Documentation

BaseTicket::$hash [private]
 

The hash of the ticket...

basically the ticket id.

Definition at line 17 of file base-ticket.inc.php.

Referenced by process().

BaseTicket::$table [private]
 

The table to use.

Definition at line 32 of file base-ticket.inc.php.

BaseTicket::$url [private]
 

The url to send the user to.

Definition at line 22 of file base-ticket.inc.php.

BaseTicket::$user [private]
 

A user object for our ticket.

Definition at line 27 of file base-ticket.inc.php.

Referenced by process().


The documentation for this class was generated from the following file:
Generated on Fri Oct 27 12:26:41 2006 for BaseJumper by doxygen 1.3.9.1