Navigation:  Advanced Features > Server Lua API >

Administrator

Previous pageReturn to chapter overviewNext page

 

c_CheckAdmin(string strUserName,string strPassword)

 

Parameters

[1]string   admin username

[2]string   admin password

 

Return Values

[1]bool  return true if check administrator login is successful, otherwise return false

 

Remarks

Administrator login ok?

 


c_CheckAdminIp(string strUserName,string strIp)

 

Parameters

[1]string   admin username

[2]string   the client IP

 

Return Values

[1]bool  return false when IP is banned, otherwise return true

 

Remarks

Check administrator login IP.

 


c_AdminLogout(string strSessionId)

 

Parameters

[1]string   the session ID

 

Return Values

nil

 

Remarks

Administrator logout.

 


c_AdminExist(string strUserName)

 

Parameters

[1]string   admin username

 

Return Values

[1]bool  return true if specified admin exists, otherwise return false

 

Remarks

Check whether the specified administrator exists.

 


c_AddAdmin(string strUserName, string strPassword, bool bReadonly, table tabAdminIpmasks)

 

Parameters

[1]string   admin username

[2]string   admin password

[3]bool   is read-only admin?

[4]table  administrator's IPmask(formated as {ip,refuse}) list table.

 

Return Values

nil

 

Remarks

Add or modify an administrator .

 


c_DeleteAdmin(string strUserName)

 

Parameters

[1]string   admin username

 

Return Values

nil

 

Remarks

Delete an administrator.

 


c_GetAdmin(string strUsername)

 

Parameters

[1]string   admin username

 

Return Values

[1]table   administrator data table formated as {username,password,{Ipmask table}}.

 

Remarks

Return an administrator data table if the specified admin exists, otherwise return nil.

 


c_GetAdminType()

 

Parameters

[1]string   the administrator name

 

Return Values

[1]bool   return true if administrator is read-only admin, otherwise return false

 

Remarks

Get the administrator type.

 


c_GetAdminList()

 

Parameters

nil

 

Return Values

[1]table   administrator(formated as {username,lastlogin,lastip}) list table.

 

Remarks

Return administrators list.

 


c_AddAdminFailedIp(string strIp)

 

Parameters

[1]string   client IP

 

Return Values

nil

 

Remarks

Add the client IP to a banned list when login failed, for system anti-hammer.

 


c_RemoveAdminFailedIp(string strIp)

 

Parameters

[1]string   the client IP

 

Return Values

nil

 

Remarks

Remove the specified IP from banned list when login is successful, for system anti-hammer.

 


c_ClearAdminSession()

 

Parameters

nil

 

Return Values

nil

 

Remarks

Clear all the expired admin sessions.

 


c_ChangeAdminListener(int nHttpPort,bool bHttpSecure)

 

Parameters

[1]int  administration listener's port

[1]bool  whether to use SSL, 1=yes, 0=no

 

Return Values

[1]bool  return true if change listener successfully, otherwise return false

 

Remarks

Modify the administrator's listener.

 


c_GetAdminIPMaskList()

 

Parameters

nil

 

Return Values

[1]table   the administrator IPmask(formated as {ip,refuse}) list table

 

Remarks

Return administrator IPmask list.

 


c_SetAdminIPMaskList(table tabIpmask)

 

Parameters

[1]table   the administrator IPmask(formated as {ip,refuse}) list table

 

Return Values

nil

 

Remarks

Set administrator IPmask list.

 


c_GetAdminLog()

 

Parameters

nil

 

Return Values

[1]string  admin log text

 

Remarks

Get all the admin log text.

 


c_AddAdminLog(string strLog,int nType)

 

Parameters

[1]string   the admin log text

[2]int  the admin log type, you can check them at the bottom.

 

Return Values

nil

 

Remarks

Add an admin log.

 


 

 

//Admin Option Field(used in c_SetAdminOptionInt, c_SetAdminOptionStr, c_GetAdminOptionInt, c_GetAdminOptionStr)

ADMIN_OPTION_LISTEN_PORT_INT = 0                //administration listener port number

ADMIN_OPTION_SECURE_ENABLE_INT = 1        //enable SSL with administration listener

ADMIN_OPTION_SSL_NAME_STR = 2                //the SSL configuration name

ADMIN_OPTION_LOGFILE_ENABLE_INT = 3        //enable admin log

ADMIN_OPTION_LOGFILE_FILENAME_STR = 4 //admin log's filename

ADMIN_OPTION_LOGFILE_MAXSIZE_INT = 5        //admin log's max size

ADMIN_OPTION_ENABLE_UPNP_INT = 6        //enable auto-forwarding admin listener port to router