PHP Object Framework (PHPOF) Manual

Token Class

Class to assist in using authentication tokens (useful to help avoid Cross-Site Request Forgery (CSRF) attacks)

Constructor Description

See DBRow Class constructor

#
# Table structure for table 'tokens'
#

CREATE TABLE tokens (
  id varchar(127) NOT NULL default '',
  action varchar(64) default NULL,
  timestamp int(11) default NULL,
  valid_time int(11) default NULL,
  PRIMARY KEY  (id)
) TYPE=MyISAM;

Public Properties

string id - Unique identifier
string action - Permitted action associated with this token
int timestamp - UNIX timestamp of token creation
int valid_time - The number of seconds which this token is valid for, from timestamp

Public Methods

::ExpungeAllExpired - Expunge all expired tokens
::Generate - Generate a new token
::Initialise - Clear the object properties
::Refresh - Refresh a token
::Validate - Validate a token

See also DBRow Class.