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

PasswordField Class Reference
[Basic Fields]

Inheritance diagram for PasswordField:

TextField AbstractField Field List of all members.

Detailed Description

Password field.

Author:
Scott Peshak
Date:
Date
2006-04-11 03:05:52 -0500 (Tue, 11 Apr 2006)
The PasswordField supports setting the member encCallback to the name of a function to use for encypting the password. For example:

 // Use the PHP builtin md5
 $field = new PasswordField('passwd', array('encCallback' => 'md5'));

You can also define your own functions for this use too:

 function weakCrypt($val, &$noQuote)
 {
     $noQuote = false;
     return ucfirst($val);
 }

 $field = new PasswordField('passwd', array('encCallback' => 'weakCrypt'));

The rules for the callback function are as follows:

  1. Must be in global context (must be callable from everywhere)
  2. Must accept two parameters
  3. Must return the encrypted string, ready for use.

The encCallback is especially useful if you want to use some sort of built in encryption in your database server. This example uses the MySQL built in AES_ENCRYPT function.

 function strongCrypt($val, &$noQuote)
 {
    $noQuote = true;
    return "AES_ENCRYPT('$val', 'TopS3cr3t')";
 }

Definition at line 48 of file password-field.inc.php.

Public Member Functions

 drawInput ()
 Draw the field.
 getData ()
 Get the field data, run through the encCallback method if defined.
 getSqlImpl ()
 Get field data as an SQL string ready for use in a query.

Protected Member Functions

 doEncCallback (&$noQuote)
 If an encryption callback function has been defined, call it on the data.

Protected Attributes

 $encCallback
 Name of callback function to use to encrypt the password.


Member Function Documentation

PasswordField::doEncCallback &$  noQuote  )  [protected]
 

If an encryption callback function has been defined, call it on the data.

Parameters:
@noQuote Boolean flag, is set to true if the value should not be quoted when used in SQL string.

Definition at line 93 of file password-field.inc.php.

Referenced by getData(), and getSqlImpl().

PasswordField::drawInput  ) 
 

Draw the field.

Reimplemented from TextField.

Definition at line 55 of file password-field.inc.php.

References AbstractField::extrasAsAttributes().

PasswordField::getData  ) 
 

Get the field data, run through the encCallback method if defined.

Returns:
field value

Reimplemented from AbstractField.

Definition at line 72 of file password-field.inc.php.

References doEncCallback().

PasswordField::getSqlImpl  ) 
 

Get field data as an SQL string ready for use in a query.

Returns:
SQL string

Reimplemented from AbstractField.

Definition at line 81 of file password-field.inc.php.

References doEncCallback().


Member Data Documentation

PasswordField::$encCallback [protected]
 

Name of callback function to use to encrypt the password.

Definition at line 50 of file password-field.inc.php.


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