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

Class: LiveUser_Auth_Container_DB

Source Location: /LiveUser-0.11.1/Auth/Container/DB.php

Class Overview

LiveUser_Auth_Common
   |
   --LiveUser_Auth_Container_DB

Class LiveUser_Auth_Container_DB


Author(s):

Version:

  • $Id: DB.php,v 1.47 2004/04/24 17:28:41 lsmith Exp $

Variables

Methods


Inherited Variables

Inherited Methods

Class: LiveUser_Auth_Common

LiveUser_Auth_Common::LiveUser_Auth_Common()
Class constructor. Feel free to override in backend subclasses.
LiveUser_Auth_Common::decryptPW()
Decrypts a password so that it can be compared with the user input. Uses the algorithm defined in the passwordEncryptionMode property.
LiveUser_Auth_Common::disconnect()
properly disconnect from resources
LiveUser_Auth_Common::encryptPW()
Encrypts a password for storage in a backend container.
LiveUser_Auth_Common::freeze()
store all properties in an array
LiveUser_Auth_Common::getProperty()
Function returns the inquired value if it exists in the class.
LiveUser_Auth_Common::isNewLogin()
Checks if there's enough time between lastLogin and current login (now) to count as a new login.
LiveUser_Auth_Common::login()
Tries to make a login with the given handle and password.
LiveUser_Auth_Common::readUserData()
Reads auth_user_id, passwd, is_active flag
LiveUser_Auth_Common::unfreeze()
Reinitializes properties
LiveUser_Auth_Common::updateUserData()
Writes current values for user back to the database.
LiveUser_Auth_Common::userExists()
Helper function that checks if there is a user in the database who's matching the given parameters.

Class Details

[line 54]
Class LiveUser_Auth_Container_DB

Description: This is a PEAR::DB backend driver for the LiveUser class. A PEAR::DB connection object can be passed to the constructor to reuse an existing connection. Alternatively, a DSN can be passed to open a new one.

Requirements:

  • File "LoginManager.php" (contains the parent class "LiveUser")
  • Array of connection options or a PEAR::DB connection object must be passed to the constructor. Example: array('dsn' => 'mysql://user:pass@host/db_name', 'connection => &$conn, # PEAR::DB connection object 'loginTimeout' => 0, 'allowDuplicateHandles' => 1);

  • Author: Markus Wolff <wolff@21st.de>
  • Version: $Id: DB.php,v 1.47 2004/04/24 17:28:41 lsmith Exp $


[ Top ]


Class Variables

$authTable =  'liveuser_users'

[line 83]

Auth table Table where the auth data is stored.
  • Access: public

Type:   string


[ Top ]

$authTableCols = array('user_id'   => 'auth_user_id',
                               'handle'    => 'handle',
                               'passwd'    => 'passwd',
                               'lastlogin' => 'lastlogin',
                               'is_active' => 'is_active')

[line 96]

Columns of the auth table.

Associative array with the names of the auth table columns. The 'user_id', 'handle' and 'passwd' fields have to be set. 'lastlogin' and 'is_active' are optional. It doesn't make sense to set only one of the time columns without the other.

  • Access: public

Type:   array


[ Top ]



Method Detail

LiveUser_Auth_Container_DB (Constructor)   [line 109]

LiveUser_Auth_Container_DB &LiveUser_Auth_Container_DB( mixed &$connectOptions)

LiveUser_Auth_Container_DB::LiveUser_Auth_Container_DB()

Class constructor.


Parameters:

mixed   &$connectOptions   — 

[ Top ]

disconnect   [line 138]

void disconnect( )

properly disconnect from resources
  • Access: public

Overrides LiveUser_Auth_Common::disconnect() (properly disconnect from resources)
[ Top ]

readUserData   [line 193]

boolean readUserData( string $handle, [boolean $passwd = false])

LiveUser_Auth_Container_DB::readUserData()

Reads auth_user_id, passwd, is_active flag lastlogin timestamp from the database If only $handle is given, it will read the data from the first user with that handle and return true on success. If $handle and $passwd are given, it will try to find the first user with both handle and password matching and return true on success (this allows multiple users having the same handle but different passwords - yep, some people want this). If no match is found, false is being returned.


Overrides LiveUser_Auth_Common::readUserData() (Reads auth_user_id, passwd, is_active flag)

Parameters:

string   $handle   —  user handle
boolean   $passwd   —  user password

[ Top ]

userExists   [line 267]

mixed userExists( [boolean $checkHandle = false], [boolean $checkPW = false])

Helper function that checks if there is a user in the database who's matching the given parameters.

If $checkHandle is given and $checkPW is set to false, it only checks if a user with that handle exists. If only $checkPW is given and $checkHandle is set to false, it will check if there exists a user with that password. If both values are set to anything but false, it will find the first user in the database with both values matching. Please note:

  • If no match was found, the return value is false
  • If a match was found, the auth_user_id from the database is being returned
Whatever is returned, please keep in mind that this function only searches for the _first_ occurence of the search values in the database. So when you have multiple users with the same handle, only the ID of the first one is returned. Same goes for passwords. Searching for both password and handle should be pretty safe, though - having more than one user with the same handle/password combination in the database would be pretty stupid anyway.

  • Return: auth_user_id DB error or false if the user does not exist

Overrides LiveUser_Auth_Common::userExists() (Helper function that checks if there is a user in the database who's matching the given parameters.)

Parameters:

boolean   $checkHandle   —  The handle (username) to search
boolean   $checkPW   —  The password to check against

[ Top ]


Documentation generated on Mon, 11 Mar 2019 10:16:11 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.