default
[ class tree: default ] [ index: default ] [ all elements ]

Class: shield

Source Location: /class.shield.php

Class Overview




Variables

Methods



Class Details

[line 84]


[ Top ]


Class Variables

$ALGORITHM =  'twofish'

[line 110]

The algorithm to be used by mcrypt. is a faster and lighter algorithm.

The algorithm to be used by mcrypt. Marc Wšhlken believes that twofish is a faster and lighter algorithm.




Tags:

access:  public

Type:   string


[ Top ]

$DIGITAL_SIG =  'h0PsC0Tch'

[line 102]

Digital signature md5'd into the var for validation

Digital signature md5'd into the var for validation




Tags:

access:  public

Type:   string


[ Top ]

$HASH_KEY =  'vr1Akqw28HIpqwTlm1o4AqQe6roAf85vnDwcc9vYSmx2cDmo6wrb8gSpDwa60VwsU86YNiur3DgnBiw4ec1d'

[line 95]

hash key used to encrypt the url data.

hash key used to encrypt the url data.




Tags:

access:  public

Type:   string


[ Top ]

$MODE =  'ecb'

[line 117]

The mode to be used by mcrypt.

The mode to be used by mcrypt. default = 'ecb'




Tags:

access:  public

Type:   string


[ Top ]

$ON_ERROR =  SHIELD_FATAL

[line 152]

Determines if errors are returned or false values, SHIELD_VERBOSE (default), SHIELD_QUIET, SHIELD_FATAL

Determines if errors are returned or false values, SHIELD_VERBOSE (default), SHIELD_QUIET, SHIELD_FATAL




Tags:

var:  var
access:  public

Type:   defined


[ Top ]

$POST_ALGORITHM =  'des'

[line 131]

The algorithm to be used by javascript and mcrypt to enable POST data encryption, currently only supports one encryption module, des (default)

The algorithm to be used by javascript and mcrypt to enable POST data encryption, currently only supports one encryption module, des (default)




Tags:

access:  public

Type:   string


[ Top ]

$POST_MODE =  'ecb'

[line 138]

The mode to be used by javascript and mcrypt to enable POST data encryption, currently only supports one encryption mode, default = 'ecb'

The mode to be used by javascript and mcrypt to enable POST data encryption, currently only supports one encryption mode, default = 'ecb'




Tags:

access:  public

Type:   string


[ Top ]

$POST_VAR_NAME =  'SHIELD'

[line 145]

The name of the var that the encoded data will take, default = '@c'

The name of the var that the encoded data will take, default = '@c'




Tags:

access:  public

Type:   string


[ Top ]

$VAR_NAME =  '@c'

[line 124]

The name of the var that the encoded data will take, default = '@c'

The name of the var that the encoded data will take, default = '@c'




Tags:

access:  public

Type:   string


[ Top ]



Class Methods


constructor shield [line 200]

void shield( [$remove_register_globals $remove_register_globals = true], [$remove_magic_quotes $remove_magic_quotes = false])

Constructor

Constructor




Tags:

access:  public


Parameters:

$remove_register_globals   $remove_register_globals   bool Removes defined globals if register_globals is active
$remove_magic_quotes   $remove_magic_quotes   bool Removes magic quotes if magic quotes are active

[ Top ]

method close [line 665]

void close( )

close

close public shortcut for closing the mcrypt module




Tags:

access:  public


[ Top ]

method create_html_elements [line 479]

void create_html_elements( string $form_name, array $form_elements_to_protect, [string $form_onsubmit_callback = false])

create_html_elements

create_html_elements Creates html form elements and the includes the nessecary javascript files




Tags:

access:  public


Parameters:

string   $form_name   The name of the form the elements are residing in
array   $form_elements_to_protect   An array of element names that require protection
string   $form_onsubmit_callback   The name of the function to callback on submit if the form

[ Top ]

method create_key_image [line 418]

void create_key_image( integer $character_num, string $font, [integer $fontsize = 30], [array $font_rgb = array('r'=>255,'g'=>0,'b'=>0)], [integer $padding = 10], [array $back_rgb = array('r'=>255,'g'=>255,'b'=>255)], [boolean $transparent = false])

create_key_image Creates the image used by the javascript to enter the correct key for encryption.

create_key_image Creates the image used by the javascript to enter the correct key for encryption. It should be used in a seperate file from the main class as it outputs a png file.




Parameters:

integer   $character_num   The number of charactes the key should have
string   $font   The path to the font used by the CAPTCHA
integer   $fontsize   The size of the font used
array   $font_rgb   The color of the font in the format array('r'=>255,'g'=>0,'b'=>0)
integer   $padding   The padding between the edge of the image and the text
array   $back_rgb   The color of the background in the format array('r'=>255,'g'=>0,'b'=>0)
boolean   $transparent   If the background is transparent or not

[ Top ]

method debug_mcrypt [line 678]

void debug_mcrypt( )

debug_mcrypt

debug_mcrypt Displays a table of mycrypt compatability. lifted from http://www.php.net/mcrypt




Tags:

access:  public


[ Top ]

method expose [line 292]

array|string expose( [string|boolean $str = false], [string $var_name = false], [string $digital_sig = false], [boolean $modify = true])

expose

expose This exposes the data that has been encrypted by the shield class. If required it modifies the super global arrays, ie $_GET, $_POST & $_REQUEST. If the data is contains the appropriate signature or if a valid time period has been set the data is also returned as and array. If the data does not contain a valid signature returns SIG_404. If the data contains a validity period and the value is being accessed past that period then it returns TIMEOUT




Tags:

access:  public


Parameters:

string|boolean   $str   The encrypted string to decrypt and validate, or false to get it from the $_REQUEST global array.
string   $var_name   The name of the value of the return string
string   $digital_sig   If you want to use a different digital signature other than the default class one, make this the sig string, otherwise if false the default signature is used.
boolean   $modify   If true, modifies the Super Global Arrays so you can reference any data how you would of in the first place, ie $_GET['nextpage'];

[ Top ]

method expose_form [line 569]

mixed expose_form( [boolean $modify = true])

expose_form

expose_form Acts similar to the normal expose function except it exposes data that has been encrypted by javascript from inside a form




Tags:

return:  returns array on success or boolean or defined var on fault


Parameters:

boolean   $modify   If you wish the GLOBALS to be modified for easy use then true it is.

[ Top ]

method expunge [line 385]

void expunge( [mixed $make_secure = false])

expunge

expunge removes the data from the super global arrays




Tags:

access:  public


[ Top ]

method is_data_shielded [line 555]

boolean is_data_shielded( )

is_data_shielded

is_data_shielded Returns true if the $_REQUEST data has data that has been shielded in the SHIELD_GET format




[ Top ]

method is_form_shielded [line 543]

boolean is_form_shielded( )

is_form_shielded

is_form_shielded Returns true if the $_REQUEST data has data that has been shielded from a form




[ Top ]

method make_secure [line 646]

void make_secure( )

make_secure

make_secure deletes all class values and makes class void to prevent re-writing of a key;




Tags:

access:  public


[ Top ]

method protect [line 246]

string protect( mixed $data, [string $shield_type = SHIELD_PLAIN], [integer $time = 0], [string $var_name = false], [string|boolean $digital_sig = false])

protect Protects data by converting the data into a string that contains the encrypted information.

protect Protects data by converting the data into a string that contains the encrypted information. The returned value can take several formats depending on what is required by the script.




Tags:

access:  public


Parameters:

mixed   $data   Variables you want to encrypt for transfering to another page
string   $shield_type   The type of return string SHIELD_PLAIN - returns a plain string for input into a form value for submission ie vreinvg3rihviv234rv23vjmosvfe => <input type="hidden" name="shield" value="vreinvg3rihviv234rv23vjmosvfe" /> SHIELD_GET - returns a string for an url sending data ie ?shield=vreinvg3rihviv234rv23vjmosvfe => http://www.myhost.com/submit.php?shield=vreinvg3rihviv234rv23vjmosvfe SHIELD_PURE_GET - returns a string for in the form var_name=encrypted_value ie shield=vreinvg3rihviv234rv23vjmosvfe Added by Marc Wšhlken SHIELD_INPUT - returns a ready made form input string ie <input type="hidden" name="shield" value="vreinvg3rihviv234rv23vjmosvfe" />
string   $var_name   The name of the value of the return string
string|boolean   $digital_sig   If you want to use a different digital signature other than the default class one, make this the sig string, otherwise if false the default signature is used.
integer   $time   If you wish to create a timeout period for this var then set this to the number of milliseconds you want the var to be valid for. If left at '0' then no timeout setting will be used.

[ Top ]


Documentation generated on Fri, 30 Sep 2005 02:58:55 +0100 by phpDocumentor 1.3.0RC3