\GSPPanel\User
Methods
AddAdmin(array $params) : array
Adds an administrator
$params requires the following:
- email: Email address for the new administrator(REQUIRED)
- password: Plain text password for the new administrator, if empty a random password will be generated
- mainadmin: 0/1 for main administrator privledges
- perm: An array of permissions if mainadmin is 0
- allowedips: A list of allowed IP's
- servermon_emails: 0/1 will receive emails from the server monitor
Returns the following:
- error
- -1 - No email/invalid email
- -2 - No password(obsolete)
- -3 - Taken/Blacklisted email
- -0 - Added successfully
Name | Type | Description |
---|---|---|
$params | array |
Type | Description |
---|---|
array |
AddClient(array $params) : array
Adds a user
$params requires the following:
- email: Email address for the new user(REQUIRED)
- password: Plain text password for the new administrator, if empty a random password will be generated
- status: 0/1 to activate(1) or suspend(0) the account
- phone: User's phone number
- firstname: User's first name
- lastname: User's last name
- address: User's address
- city: User's city
- state: User's state
- zipcode: User's zipcode
- country: User's country
- notes: Account notes
- billingid: A reference ID sent from billing systems such as WHMCS
Returns the following:
- error
- -1 - No email address
- -2 - Taken/Blacklisted email
- -3 - The specified billingid is already associated with a user
- 0 - Added successfully
- uid: The user id for the new user
Name | Type | Description |
---|---|---|
$params | array |
Type | Description |
---|---|
array |
AddIPBan(string $ip) : void
Bans and IP address or increments the counter if the IP has already been marked for invalid logins
Name | Type | Description |
---|---|---|
$ip | string | IP to ban |
AddSubUser(array $params) : array
Adds a subuser
$params requires the following:
- email: Email for the subuser
- password: plain text password for the subuser
- gameserver: Array of permissions for the main users gameservers(ugid => control(permissions))
- uid: The main user's ID
Returns the following:
- error
- -1 - No email
- -2 - Taken/Blacklisted email
- -0 - Added successfully
Name | Type | Description |
---|---|---|
$params | array |
Type | Description |
---|---|
array |
DeleteAdmin(integer $uid) : array
Delete the specified administrator
Returns the following:
- error
- -1 - No user found
- -2 - Unable to delete the main administrator
- -0 - Removed successfully
Name | Type | Description |
---|---|---|
$uid | integer | The user id of the administrator to delete |
Type | Description |
---|---|
array |
DeleteSubUser(integer $subid) : array
Delete the specified subuser
Returns the following:
- error
- -1 - No user found
- -0 - Removed successfully
Name | Type | Description |
---|---|---|
$subid | integer | The subuser's id to delete |
Type | Description |
---|---|
array |
DeleteUser(integer $uid) : array
Delete the specified user and all their services
Returns the following:
- error
- -1 - No user found
- -2 - Unable to remove game, server is offline
- -3 - Unable to remove game, enable debugging on the remote server
- -4 - LEGACY - No longer used
- -0 - Removed successfully
Name | Type | Description |
---|---|---|
$uid | integer | The user id to delete |
Type | Description |
---|---|
array |
EditAdmin(array $params) : array
Edits an administrator
$params requires the following:
- uid: User id of the adminstrator to edit(REQUIRED)
- email: Email address for the administrator(REQUIRED)
- password: Plain text password for the administrator
- mainadmin: 0/1 for main administrator privledges
- perm: An array of permissions if mainadmin is 0
- allowedips: The list of allowed IP's
- servermon_emails: 0/1 will receive emails from the server monitor
Returns the following:
- error
- -1 - No userid
- -2 - No email address
- -3 - Cannot remove the main admin
- -4 - Taken/Blacklisted email
- -5 - User does not exist
- -0 - Edited successfully
Name | Type | Description |
---|---|---|
$params | array |
Type | Description |
---|---|
array |
EditClient(array $params) : array
Edits a user
$params requires the following:
- uid: The user's id(REQUIRED)
- email: Email address for the user(REQUIRED)
- password: Plain text password for the user
- status: 0/1 to activate(1) or suspend(0) the account
- phone: User's phone number
- firstname: User's first name
- lastname: User's last name
- address: User's address
- city: User's city
- state: User's state
- zipcode: User's zipcode
- country: User's country
- notes: Account notes
- billingid: A reference ID sent from billing systems such as WHMCS
Returns the following:
- error
- -1 - No userid
- -2 - Taken/Blacklisted email
- -3 - User does not exist
- -4 - No email address
- -0 - Edited successfully
Name | Type | Description |
---|---|---|
$params | array |
Type | Description |
---|---|
array |
EditSubUser(array $params) : array
Edits a subuser
$params requires the following:
- subid: Subuser's id(REQUIRED)
- uid: Main user's id(REQUIRED)
- email: Email for the subuser
- password: plain text password for the subuser
- gameserver: Array of permissions for the main users gameservers(ugid => control(permissions))
Returns the following:
- error
- -1 - Missing subid or uid
- -2 - Taken/Blacklisted email
- -3 - User does not exist
- -0 - Saved successfully
Name | Type | Description |
---|---|---|
$params | array |
Type | Description |
---|---|
array |
EncodePass(string $password, string $typeoverride = null) : string
This encrypts the users password using the encryption type set in settings
Name | Type | Description |
---|---|---|
$password | string | The password you want to encrypt |
$typeoverride | string | The type to use if not the default |
Type | Description |
---|---|
string | The encrypted password |
ExpireBans() : void
Expires any bans past the expiration time
GetAdministratorInfo(integer $uid) : array
Returns an array of administrator information
Name | Type | Description |
---|---|---|
$uid | integer | User ID of administrator |
Type | Description |
---|---|
array |
GetClientInfo(integer $uid) : array
Returns an array of client information
Name | Type | Description |
---|---|---|
$uid | integer | User ID |
Type | Description |
---|---|
array |
GetPass(integer $uid, string $type = "user") : string
Returns the user's or subuser's password decoded
Name | Type | Description |
---|---|---|
$uid | integer | The user id of the password you want to decrypt |
$type | string | The type of user(user, subuser) |
Type | Description |
---|---|
string | The decrypted password |
GetSubUserInfo(integer $subid, integer $mainid = "") : array
Returns an array of subuser information
Name | Type | Description |
---|---|---|
$subid | integer | Subusers ID |
$mainid | integer | The main user's ID |
Type | Description |
---|---|
array |
ListAdministrators() : array
Returns an array of administrators
Type | Description |
---|---|
array |
ListSubUsers(integer $uid) : array
Returns an array of sub-users
Name | Type | Description |
---|---|---|
$uid | integer | The UID of the main user |
Type | Description |
---|---|
array |
ListUsers(array $params = array()) : array
Returns an array of users
$params can accept the following:
- search: A string to search for
- status: 0 for suspended, 1 for active
- limit: Amount of results to return
- order: Field to order results by
Name | Type | Description |
---|---|---|
$params | array |
Type | Description |
---|---|
array |
Login(string $email, string $password) : integer
Logs a user in
Returns the following:
- 1 - Valid login
- 0 - Invalid login
- -1 - Suspended
- -2 - Invalid login IP
Name | Type | Description |
---|---|---|
string | Users email address | |
$password | string | Users password |
Type | Description |
---|---|
integer |
RecodePasswords(string $type) : void
This will recrypt all the passwords in the database to the new encryption method
Name | Type | Description |
---|---|---|
$type | string | The new type of encryption to use(mcryptnew, plain) |
SuspendClient(integer $uid) : array
Suspends a client and all of their services
Returns the following:
- error
- -1 - No userid
- -2 - User does not exist
- -0 - Suspend successfully
Name | Type | Description |
---|---|---|
$uid | integer | User's id to suspend |
Type | Description |
---|---|
array |
UIDToUser(integer $uid, string $type = "user") : string
Converts a userid to an email address.
Will return System if the uid is -1, and Unknown if it's not found
Name | Type | Description |
---|---|---|
$uid | integer | The userid to get the email to |
$type | string | The type of user(subuser/user) |
Type | Description |
---|---|
string |
UnsuspendClient(integer $uid) : array
Unsuspends a client and all of their services
Returns the following:
- error
- -1 - No userid
- -2 - User does not exist
- -0 - Unsuspend successfully
Name | Type | Description |
---|---|---|
$uid | integer | User's id to unsuspend |
Type | Description |
---|---|
array |
ValidateSession() : void
Validates the users session and refreshes permissions
howManyLoginAttempts(string $ip) : integer
Returns the number of failed login attempts for the specified IP
Name | Type | Description |
---|---|---|
$ip | string | IP to check |
Type | Description |
---|---|
integer |
isIPBanned(string $ip) : boolean
Check to see if an IP is banned or has failed login attempts
Name | Type | Description |
---|---|---|
$ip | string | IP to check |
Type | Description |
---|---|
boolean |
isNewUserValid(string $email, string $existing = "") : boolean
Checks if the email address is valid (not blacklisted and not used by another user)
Name | Type | Description |
---|---|---|
string | The email address to verify | |
$existing | string | If its an email change of an existing user specify the existing email |
Type | Description |
---|---|
boolean |