Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

fbHMAC_Login_MySQL Class Reference

Inheritance diagram for fbHMAC_Login_MySQL:

Inheritance graph
[legend]
List of all members.

Detailed Description

Secure login using native Mysql functions.

Definition at line 25 of file MySQL.php.

Public Member Functions

 connect ($host= '', $user= '', $password= '', $database= '')
 close ()
 getChallenge ()
 validate ($challenge, $response, $login, $password)
 getPassword ($login)
 deleteUnused ($days=null)
 deleteUsed ($days)
 deletePercentage ($percent)
 getLastErrno ()
 getLastError ()
 setMaxAttempts ($max_attempts)
 setChallengeTable ($challenge_table)
 setLoginTable ($login_table)
 setLoginField ($login_field)
 setPasswordField ($password_field)
 connect ($host= '', $user= '', $password= '', $database= '', $driver= '')
 _getChallenge ($max_id, $attempts)
 checkAddress ($check_address)
 checkReferer ($check_referer)
 checkUserAgent ($check_user_agent)

Private Member Functions

 _setDbError ()


Member Function Documentation

fbHMAC_Login::_getChallenge max_id,
attempts
[inherited]
 

Get the next random challenge.

Returns:
string A 22 character challenge, or false if unsuccessful.

Definition at line 351 of file HMAC_Login.php.

References fbRandom::getInstance().

Referenced by getChallenge(), and fbHMAC_Login_ADOdb::getChallenge().

fbHMAC_Login_MySQL::_setDbError  )  [private]
 

Set the last error/errno to the last database error.

Reimplemented from fbHMAC_Login.

Definition at line 31 of file MySQL.php.

Referenced by connect(), deletePercentage(), deleteUnused(), deleteUsed(), getChallenge(), getPassword(), and validate().

fbHMAC_Login::checkAddress check_address  )  [inherited]
 

Todo:
Implement checkAddress() ?
Parameters:
$check_address string
Returns:
bool

Definition at line 452 of file HMAC_Login.php.

fbHMAC_Login::checkReferer check_referer  )  [inherited]
 

Todo:
Implement checkReferer() ?
Parameters:
$check_referer string
Returns:
bool

Definition at line 461 of file HMAC_Login.php.

fbHMAC_Login::checkUserAgent check_user_agent  )  [inherited]
 

Todo:
Implement checkUserAgent() ?
Parameters:
$check_user_agent string
Returns:
bool

Definition at line 470 of file HMAC_Login.php.

fbHMAC_Login_MySQL::close  ) 
 

Disconnect from the database.

Can be safely called if we're already disconnected.

Returns:
true if successful, otherwise false.

Reimplemented from fbHMAC_Login.

Definition at line 80 of file MySQL.php.

fbHMAC_Login::connect host = '',
user = '',
password = '',
database = '',
driver = ''
[inherited]
 

Connect to the database.

Parameters:
$host string
$user string
$password string
$database string
$driver string
Returns:
true if successful, otherwise false.

Reimplemented in fbHMAC_Login_ADOdb.

Definition at line 318 of file HMAC_Login.php.

fbHMAC_Login_MySQL::connect host = '',
user = '',
password = '',
database = ''
 

Connect to the database.

Parameters:
$host string
$user string
$password string
$database string
Returns:
true if successful, otherwise false.

Definition at line 46 of file MySQL.php.

References _setDbError().

Referenced by deletePercentage(), deleteUnused(), deleteUsed(), getChallenge(), getPassword(), and validate().

fbHMAC_Login_MySQL::deletePercentage percent  ) 
 

Delete a percentage of the oldest records in the challenges table.

Deletes the oldest records first.

Parameters:
$percent int The percentage of records to delete, 0 for none, 100 for all.
Returns:
bool true if successful, otherwise false.

Reimplemented from fbHMAC_Login.

Definition at line 436 of file MySQL.php.

References _setDbError(), fbHMAC_Login::_setError(), connect(), and FB_HMAC_LOGIN_ERROR_NOT_CONNECTED.

fbHMAC_Login_MySQL::deleteUnused days = null  ) 
 

Delete unused records that were never used and have expired in the challenges table.

These records were created when the user displayed the login page, but the user never subsequently logged in, leaving an used record in the challenges table.

Parameters:
$days int The number of days old a record has to be in order to be deleted. If 0, or unspecified, all records older than the timeout (default is 15 minutes) will be deleted.
Returns:
bool true if successful, otherwise false.

Reimplemented from fbHMAC_Login.

Definition at line 354 of file MySQL.php.

References _setDbError(), fbHMAC_Login::_setError(), connect(), and FB_HMAC_LOGIN_ERROR_NOT_CONNECTED.

fbHMAC_Login_MySQL::deleteUsed days  ) 
 

Delete used records in the challenges table.

Parameters:
$days int The number of days old a record has to be in order to be deleted. If 0, or unspecified, all records older than the timeout (default is 15 minutes) will be deleted.
Returns:
bool true if successful, otherwise false.

Reimplemented from fbHMAC_Login.

Definition at line 394 of file MySQL.php.

References _setDbError(), fbHMAC_Login::_setError(), connect(), and FB_HMAC_LOGIN_ERROR_NOT_CONNECTED.

fbHMAC_Login_MySQL::getChallenge  ) 
 

Get the next random challenge.

Returns:
string A 22 character challenge, or false if unsuccessful.

Reimplemented from fbHMAC_Login.

Definition at line 96 of file MySQL.php.

References fbHMAC_Login::_getChallenge(), _setDbError(), fbHMAC_Login::_setError(), connect(), FB_HMAC_LOGIN_ERROR_NO_CHALLENGE, and FB_HMAC_LOGIN_ERROR_NOT_CONNECTED.

fbHMAC_Login::getLastErrno  )  [inherited]
 

Get last error number, or 0 if no error has yet occured.

Returns:
int The last error number.

Definition at line 220 of file HMAC_Login.php.

fbHMAC_Login::getLastError  )  [inherited]
 

Get last error message, or '' of no error has yet occured.

Returns:
string The last error message.

Definition at line 229 of file HMAC_Login.php.

fbHMAC_Login_MySQL::getPassword login  ) 
 

Get the password associated with the login $login.

Parameters:
$login string Login name to retrieve password for.
Returns:
bool true if successful, otherwise false.

Reimplemented from fbHMAC_Login.

Definition at line 307 of file MySQL.php.

References _setDbError(), fbHMAC_Login::_setError(), connect(), FB_HMAC_LOGIN_ERROR_INVALID_LOGIN, and FB_HMAC_LOGIN_ERROR_NOT_CONNECTED.

Referenced by validate().

fbHMAC_Login::setChallengeTable challenge_table  )  [inherited]
 

Set the name for SQL table containing challenges, default is 'challenges'

Parameters:
$challenge_table string Name for SQL table containing challenges.
Returns:
void

Definition at line 254 of file HMAC_Login.php.

fbHMAC_Login::setLoginField login_field  )  [inherited]
 

Set name for SQL field containing login name in login table, default is 'login'.

Parameters:
$login_field string name for SQL field containing login name in login table.
Returns:
void

Definition at line 280 of file HMAC_Login.php.

fbHMAC_Login::setLoginTable login_table  )  [inherited]
 

Set name for SQL table containing login/password, default is 'logins'.

Parameters:
$login_table string name for SQL table containing login/password.
Returns:
void

Definition at line 267 of file HMAC_Login.php.

fbHMAC_Login::setMaxAttempts max_attempts  )  [inherited]
 

Set the maximum attempts to generate a new challenge to $max_attempts.

Parameters:
$max_attempts int the the maximum attempts to generate a new challenge.
Returns:
void

Definition at line 241 of file HMAC_Login.php.

fbHMAC_Login::setPasswordField password_field  )  [inherited]
 

Set name for SQL field containing password in login table, default is 'password'.

Parameters:
$password_field string name for SQL field containing password in login table.
Returns:
void

Definition at line 293 of file HMAC_Login.php.

fbHMAC_Login_MySQL::validate challenge,
response,
login,
password
 

Validate the $response.

Will work if JavaScript is turned off on the client, but the password we be sent as clear text.

Parameters:
$challenge string 22 character challenge generated via getChallenge().
$response string 32 character response generated on the client.
$login string Login name entered by user.
$password string Password entered by user.
Returns:
bool true if successful, otherwise false.

Reimplemented from fbHMAC_Login.

Definition at line 198 of file MySQL.php.

References _setDbError(), fbHMAC_Login::_setError(), connect(), FB_HMAC_LOGIN_ERROR_BAD_CHALLENGE, FB_HMAC_LOGIN_ERROR_BAD_PASSWORD, FB_HMAC_LOGIN_ERROR_INVALID_CHALLENGE, FB_HMAC_LOGIN_ERROR_INVALID_PASSWORD, FB_HMAC_LOGIN_ERROR_LOGIN_EXPIRED, FB_HMAC_LOGIN_ERROR_NOT_CONNECTED, FB_HMAC_LOGIN_ERROR_UNSAFE_BAD_PASSWORD, FB_HMAC_LOGIN_ERROR_UNSAFE_PASSWORD, and getPassword().


The documentation for this class was generated from the following file:
Generated on Fri Mar 19 12:52:32 2004 for Freebeer by doxygen 1.3.6-20040222