Class UserDB
The Database class is meant to simplify the task of accessing information from the website's database.
- DbPlugin
- DB
- OpenHomeoDB
- UserDB
Category: Login
Copyright: 2007-2014 Henri Schumacher
License: GNU Affero General Public License v3
Author: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
Author: Henri Schumacher <henri.hulski@gazeta.pl>
Located at include/classes/login/database.php
public
|
#
get_num_visitors( )
Only query database to find out number of members when getNumMembers() is called for the first time, until then, default value set. |
public
integer
|
#
confirmUserPass( string $username, string $password )
confirmUserPass - Checks whether or not the given username is in the database, if so it checks if the given password is the same password in the database for that user. If the user doesn't exist or if the passwords don't match up, it returns an error code (1 or 2). On success it returns 0. |
public
integer
|
#
confirmUserID( string $username, string $userid )
confirmUserID - Checks whether or not the given username is in the database, if so it checks if the given userid is the same userid in the database for that user. If the user doesn't exist or if the userids don't match up, it returns an error code (1 or 2). On success it returns 0. |
public
boolean
|
#
usernameTaken( string $username )
usernameTaken - Returns true if the username has been taken by another user, false otherwise. |
public
boolean
|
#
usernameBanned( string $username )
usernameBanned - Returns true if the username has been banned by the administrator. |
public
boolean
|
#
addNewUser( string $username, string $password, string $email )
addNewUser - Inserts the given (username, password, email) info into the database. Appropriate user level is set. Returns true on success, false otherwise. |
public
boolean
|
#
updateUserField( string $username, string $field, string $value )
updateUserField - Updates a field, specified by the field parameter, in the user's row of the database. |
public
boolean
|
#
getUserInfo( string $username, string $column )
getUserInfo - Returns the result array from a database query asking for all information stored regarding the given username. If query fails, NULL is returned. |
public
integer
|
#
getNumMembers( )
getNumMembers - Returns the number of signed-up users of the website, banned members not included. The first time the function is called on page load, the database is queried, on subsequent calls, the stored result is returned. This is to improve efficiency, effectively not querying the database when no call is made. |
private
integer
|
#
calcNumActiveUsers( )
calcNumActiveUsers - Finds out how many active users are viewing site and sets class variable accordingly. |
private
integer
|
#
calcNumActiveGuests( )
calcNumActiveGuests - Finds out how many active guests are viewing site and sets class variable accordingly. |
public
|
#
addActiveUser( string $username )
addActiveUser - Updates username's last activity in the database, and also adds him to the table of active users, or updates timestamp if already there. |
public
|
|
public
|
#
removeActiveUser( string $username )
removeActiveUser - removes user with given username from active_users table |
public
|
#
removeActiveGuest( string $ip )
removeActiveGuest - removes guest with given IP from active_guests table |
public
|
#
removeInactiveUsers( )
removeInctiveUsers - removes users after inactivity of USER_TIMEOUT from active_users table |
public
|
#
removeInactiveGuests( )
removeInactiveGuest - removes guests after inactivity of GUEST_TIMEOUT from active_guests table |
db_fetch_assoc(),
db_fetch_row(),
get_primary_key(),
reset_result(),
send_query_limit(),
table_exists()
|
public
integer
|
$num_active_users |
|
#
Number of active users viewing site |
public
integer
|
$num_active_guests |
|
#
Number of active guests viewing site |
public
integer
|
$num_members |
|
#
Number of signed-up users |