Navigation:  Advanced Features > Server Lua API >

Domain Function

Previous pageReturn to chapter overviewNext page

 

c_AccessDataWay(string strDomain)

 

Parameters

[1]string   the domain name

 

Return Values

[1]int   the storage method for user data, 1=XML file, 2=Mysql, 3=ODBC

 

Remarks

Returns the storage method for user data, 1=XML file, 2=Mysql, 3=ODBC

 


c_ResetUserData(string strDomain)

 

Parameters

[1]string   the domain name

 

Return Values

nil

 

Remarks

Reset all the user/group data in the specified domain.

 


c_ReconnectDB(string strDomain)

 

Parameters

[1]string   the domain name

 

Return Values

nil

 

Remarks

Reconnects the database.

 


c_TestMysql(string strDomain)

 

Parameters

[1]string   the domain name

 

Return Values

[1]bool  return true if Mysql connection is successful, otherwise return false

 

Remarks

Test Mysql connection.

 


c_TestODBC(string strDomain)

 

Parameters

[1]string   the domain name

 

Return Values

[1]bool  return true if ODBC connection is successful, otherwise return false

 

Remarks

Test ODBC connection.

 


c_KickSession(string strDomain,int nId,int nKickWay,int nBlockMin,int nAddToUser,int nAddToGroup,int nAddToDomain,int nDisableAccount,string strSendMsg)

 

Parameters

[1]string   the domain name

[2]int  the session ID

[3]int  the kick way,0=disconnect,1=disconnect and ban IP for minutes, 2=disconnect and block IP permanently

[4]int  the minutes number for banning IP.

[5]int  add this IP to user's IP-block list, 1=yes, 0=no.

[6]int  add this IP to group's IP-block list, 1=yes, 0=no.

[7]int  add this IP to domain's IP-block list, 1=yes, 0=no.

[8]int  disable user account, 1=yes, 0=no.

 

Return Values

[1]int  the result code,1=success, 0=failure

 

Remarks

Kill the specified session with full options.

 


c_KickSessionByName(string strDomain, string strName)

 

Parameters

[1]string   the domain name

[2]string   the user name

 

Return Values

[1]int  the result code,1=success, 0=failure

 

Remarks

Kill the online sessions by the user name.

 


c_KickAllSessions(string strDomain)

 

Parameters

[1]string   the domain name

 

Return Values

[1]int  the result code,1=success, 0=failure

 

Remarks

Kill all the online sessions.

 


c_GetConnectionsList(string strDomain)

 

Parameters

[1]string   the domain name

 

Return Values

[1]table   an online session (formatted as {id, username, protocol, ip, lastcommand,directory}) list table.

 

Remarks

Return a table list of all the online sessions.

 


c_GetDomainLog(string strDomain)

 

Parameters

[1]string   the domain name

 

Return Values

[1]string  domain log text

 

Remarks

Get the domain logs.

 


c_SetFTPEvent(string strDomain,int nEventType,int bExecute,string strExeFilePath,string strParameter,int bLogFile,string strLogFilePath,string strLogText,int bSendMail,string strMailTo,string strSubject,string strPlainText,string strAttachFile,int nPriority,int bLuaScript,string strLuaScriptText)

 

Parameters

[1]string   the domain name

[2]int  the event type, see the bottom description.

[3]int  execute a program? 1=yes, 0=no.

[4]string  the physical path of third party program.

[5]string  the parameters of third party program.

[6]int   write something to a log file? 1=yes, 0=no.

[7]string  the path of log file.

[8]string  the log text.

[9]int  send an email? 1=yes, 0=no.

[10]string  the receiver's email address.

[11]string  the email's subject.

[12]string  the email's plain text.

[13]string  the email's attachment file path.

[14]int  the priority for sending email,1=normal, 2=high, 3=low

[15]int  execute lua script? 1=yes, 0=no.

[16]string  the lua script.

 

Return Values

nil

 

Remarks

This function is used for configuring the FTP event's settings.

 


c_GetFTPEvent(string strDomain,int nEventType)

 

Parameters

[1]string   the domain name

[2]int  the FTP event type, see the bottom description.

 

Return Values

[1]int  execute a program,1=yes,0=no.

[2]string  the physical path of third-party program.

[3]string  the parameters of third-party program.

[4]int  write something to a log file? 1=yes, 0=no.

[5]string  the path of log file.

[6]string  the log text.

[7]int  send an email? 1=yes, 0=no.

[8]string  the receiver's email address.

[9]string  the email's subject.

[10]string  the email's plain text.

[11]string  the email's attachment file path.

[12]int  the priority for sending email,1=normal, 2=high, 3=low

[13]int  execute lua script? 1=yes, 0=no.

[14]string  the lua script.

 

Remarks

Get specified FTP event's settings.

 


c_SetSSHEvent(string strDomain,int nEventType,int bExecute,string strExeFilePath,string strParameter,int bLogFile,string strLogFilePath,string strLogText,int bSendMail,string strMailTo,string strSubject,string strPlainText,string strAttachFile,int nPriority,int bLuaScript,string strLuaScriptText)

 

Parameters

similar to c_SetFTPEvent()

 

Return Values

nil

 

Remarks

This function is used for configuring the SSH event's settings.

 


c_GetSSHEvent(string strDomain, int nEventType)

 

Parameters

[1]string   the domain name

[2]int  the SSH event type, see the bottom description.

 

Return Values

similar to c_SetFTPEvent()

 

Remarks

Get specified SSH event's settings.

 


c_SetHTTPEvent(string strDomain,int nEventType,int bExecute,string strExeFilePath,string strParameter,int bLogFile,string strLogFilePath,string strLogText,int bSendMail,string strMailTo,string strSubject,string strPlainText,string strAttachFile,int nPriority,int bLuaScript,string strLuaScriptText)

 

Parameters

similar to c_SetFTPEvent()

 

Return Values

nil

 

Remarks

This function is used for configuring HTTP event's settings.

 


c_GetHTTPEvent(string strDomain,int nEventType)

 

Parameters

[1]string   the domain name

[2]int  the HTTP event type, see the bottom description.

 

Return Values

same as c_SetFTPEvent()

 

Remarks

Get specified HTTP event's settings.

 


c_GetListenerList(string strDomain)

 

Parameters

[1]string   the domain name

 

Return Values

[1]table   a domain listener(formatted as {ID,Type,Ip_Address,Port,Gateway_Host,Gateway_Port,Is_Listening}) list table.

 

Remarks

Return a table list of domain listeners.

 


c_AddListener(string strDomain,int nListenerType,string strListenerIp,int nListenerPort,strGatewayHost,nGatewayPort)

 

Parameters

[1]string   the domain name

[2]int  listener type,1=FTP, 2=FTPS, 3=HTTP, 4=HTTPS, 5=SFTP.

[3]string   listener's IP address, * for all local addresses.

[4]int  listener port

[5]string   gateway host

[6]int  gateway port

 

Return Values

[1]int  the result code, 0=success, 1=invalid IP, 2=invalid port, 3=invalid index, 4=listener exists, 99=unknown error.

 

Remarks

Add a domain listener.

 


c_DeleteListener(string strDomain,int nIndex)

 

Parameters

[1]string   the domain name

[2]int  listener index

 

Return Values

[1]int  the result code, 0=success, 1=invalid IP, 2=invalid port, 3=invalid index, 4=listener exists, 99=unknown error.

 

Remarks

Delete a domain listener.

 


c_UpdateListener(string strDomain,int nIndex,int nListenerType,string strListenerIp,int nListenerPort,strGatewayHost,nGatewayPort)

 

Parameters

[1]string   the domain name

[2]int  the listener's index

[3]int  listener type,1=FTP, 2=FTPS, 3=HTTP, 4=HTTPS, 5=SFTP.

[4]string   listener's IP address, * for all local addresses.

[5]int  listener port

[6]string   gateway host

[7]int  gateway port

 

Return Values

[1]int  the result code, 0=success, 1=invalid IP, 2=invalid port, 3=invalid index, 4=listener exists, 99=unknown error.

 

Remarks

Modify a domain listener.

 


c_GetSfvDirList(string strDomain)

 

Parameters

[1]string   the domain name

 

Return Values

[1]table   the SFV directory list table.

 

Remarks

Return SFV directory list.

 


c_GetIPMaskList(string strDomain)

 

Parameters

[1]string   the domain name

 

Return Values

[1]table   the domain's IP mask (formatted as {ip,refuse}) list table.

 

Remarks

Return domain's IPmask list.

 


c_GetFileMaskList(string strDomain)

 

Parameters

[1]string   the domain name

 

Return Values

[1]table   the domain's file mask(formatted as {filename,refuse}) list table.

 

Remarks

Return domain's filemask list.

 


c_SetSfvDirList(string strDomain,table tabSfvDir)

 

Parameters

[1]string   the domain name

[2]table   the SFV directory list table

 

Return Values

nil

 

Remarks

Set SFV directory list.

 


c_SetIPMaskList(string strDomain,table tabIpMask)

 

Parameters

[1]string   the domain name

[2]table   the IP mask list table (formatted as {ip,refuse})

 

Return Values

nil

 

Remarks

Set domain's IP mask list.

 


c_SetFileMaskList(string strDomain,table tabFileMask)

 

Parameters

[1]string   the domain name

[2]table   the filemask list table (formatted as {filename,refuse})

 

Return Values

nil

 

Remarks

Set domain's file mask list.

 


c_GetTransferLimit(string strDomain)

 

Parameters

[1]string   the domain name

 

Return Values

[1]table   the transfer limit table formatted as {enable_upload_never,cur_upload_size_never,max_upload_size_never,enable_download_never,cur_download_size_never,

max_download_size_never,enable_upload_hourly,cur_upload_size_hourly,max_upload_size_hourly,enable_download_hourly,cur_download_size_hourly,max_download_size_hourly,

enable_upload_daily,cur_upload_size_daily,max_upload_size_daily,enable_download_daily,cur_download_size_daily,max_download_size_daily,enable_upload_weekly,

cur_upload_size_weekly,max_upload_size_weekly,enable_download_weekly,cur_download_size_weekly,max_download_size_weekly,enable_upload_monthly,

cur_upload_size_monthly,max_upload_size_monthly,enable_download_monthly,cur_download_size_monthly,max_download_size_monthly}.

 

Remarks

Return a table of transfer limit settings.

 


c_SetTransferLimit(string strDomain,table tabTransferLimit)

 

Parameters

[1]string   the domain name

[2]table   the transfer limit table (like the return value format of c_GetTransferLimit() ).

 

Return Values

nil

 

Remarks

Set domain's transfer limit.

 


c_StartDomain(string strDomain)

 

Parameters

[1]string   the domain name

 

Return Values

nil

 

Remarks

Put the domain online.

 


c_StopDomain(string strDomain,int nStopMode)

 

Parameters

[1]string   the domain name

[2]int  the options, 0=disconnect all clients, 1=wait for clients to disconnect, 2=wait for clients to terminate their transfer.

 

Return Values

nil

 

Remarks

Put the domain offline.

 


c_IsDomainOnline(string strDomain)

 

Parameters

[1]string   the domain name

 

Return Values

[1]bool  return true if the domain is online, otherwise return false

 

Remarks

Check whether the domain is online.

 


c_GetSessionCount(string strDomain)

 

Parameters

[1]string   the domain name

 

Return Values

[1]int  the current online session number

 

Remarks

Return the current online session number in the specified domain.

 


c_GetSessionLiveTime(string strDomain,int nSessionID)

 

Parameters

[1]string   the domain name

[2]int  the session ID

 

Return Values

[1]int  the up time of current session

 

Remarks

Return current session's up time.

 


c_GetSessionStatistic(string strDomain,int nSessionID)

 

Parameters

[1]string   the domain name

[2]int  the session ID

 

Return Values

[1]table   session statistics table formatted as {down_speed,down_averagespeed,down_bytes,down_files,up_speed,up_averagespeed,up_bytes,up_files}.

 

Remarks

Get the session statistics.

 


c_GetDomainStatistic(string strDomain)

 

Parameters

[1]string   the domain name

 

Return Values

[1]table   domain statistics table formatted as {running_time,current_session,max_session,last24hour_session,session_averagesec,session_maxsec,total_session,

down_speed,down_averagespeed,down_bytes,down_files,up_speed,up_averagespeed,up_bytes,up_files}.

 

Remarks

Get the domain statistics.

 


c_CreateDomainLogo(string strDomain,string strLogoPath)

 

Parameters

[1]string   the domain name

[2]string   the file path of your logo image.

 

Return Values

nil

 

Remarks

Add a customized logo for the specified domain.

 


c_GetTempBlockIpList(string strDomain)

 

Parameters

[1]string   the domain name

 

Return Values

[1]table temporary banned IP(formatted as {ip,sec}) list table

 

Remarks

Get the temporary banned IP list.

 


c_AddTempBlockIp(string strDomain,string strBanIP,int nBanSec)

 

Parameters

[1]string   the domain name

[2]string   the banned IP address

[3]int        the banned seconds

 

Return Values

[1]bool        return true if the temp banned IP is added successfully, otherwise return false

 

Remarks

Add a temporary banned IP.

 


c_DelTempBlockIp(string strDomain,string strBanIP)

 

Parameters

[1]string   the domain name

[2]string   the banned IP address

 

Return Values

[1]bool        return true if the temp banned IP is removed successfully, otherwise return false

 

Remarks

Remove a temporary banned IP.

 


c_GetUserAbsolutePath(string strDomain,string strUsername,string strNowDir)

 

Parameters

[1]string   the domain name

[2]string   the user name

[3]string   the current user directory

 

Return Values

[1]string   return the physical path of current user directory

 

Remarks

Get the physical path of current user directory.

 


c_GetChartData(string strDomain,int nTimeType,int nTrafficType)

 

Parameters

[1]string   the domain name

[2]int   time period type   0:last 5minutes, 1:last 5hours, 2:last 10days

[3]int   traffic type   0:download speed, 1:upload speed, 2:session number

 

Return Values

[1]string   return the input data for graphs chart of real-time server traffics.

 

Remarks

Get the input data for graphs chart of real-time server traffics.

 


c_SetDomainPasvOption(string strDomain,int nPasvModeWay,string strPasvFixIp,string strPasvWebIp,string strPasvDnsIp,int nPasvRefIntval,int nEnableUPnP,int nMinPasvPort,int nMaxPasvPort)

 

Parameters

[1]string   the domain name

[2]int  the way to get the IP address of your FTP server

[3]string  a fixed IP address

[4]string  specify a web URL that will resolve your internet IP.

[5]string  specify a dynamic DNS that will resolve your internet IP.

[6]int  the interval time for resolving the server IP.

[7]int  enable auto-forwarding passive ports? 1=yes, 0=no.

[8]int  the min passive port number.

[9]int  the max passive port number.

 

Return Values

nil

 

Remarks

This function is used to change domain's FTP passive mode options.

 

 

 


 

//FTP Event Type(for c_SetFTPEvent, c_GetFTPEvent)

FTP_USER_LOGIN_EVENT = 0                        //When user has successfully logged in

FTP_USER_DISCONNECT_EVENT = 1                //When user leaves the server

FTP_USER_CONNECT_TIMEOUT_EVENT = 2        //When user has been disconnected for no command sending

FTP_DIR_CREATE_EVENT = 3                        //When a directory has been created

FTP_DIR_DELETE_EVENT = 4                        //When a directory has been deleted

FTP_EXCEED_USERPASS_EVENT = 5                //When a user failed to authenticate(exceed limit USER/PASS)

FTP_FILE_BANNED_EVENT = 6                //When users attempt to upload a banned file

FTP_FILE_DELETE_EVENT = 7                        //When a file has just been deleted

FTP_FILE_DOWNLOAD_EVENT = 8                //When a file has just been downloaded

FTP_FILE_RENAME_EVENT = 9                //When a file has been renamed

FTP_FILE_UPLOAD_EVENT = 10                //When a file was just uploaded

FTP_QUOTA_EXCEED_EVENT = 11                //When quota has reached maximum quota allowed

FTP_TOOMANY_CONNECTION_PERIP_EVENT = 12                //When too many connections have logged in with same IP

FTP_TOOMANY_CONNECTION_PERACCOUT_EVENT = 13        //When too many connections have logged in with same account

FTP_IP_BANNED_EVENT = 14                        //When a banned IP try to login on this server

FTP_SITE_COMMAND_MESSAGE = 15                //When user use site command to send a message to the server

FTP_SITE_COMMAND_CHANGE_PASSWORD = 16                //When user use site command to change password

FTP_EXCEED_LIMIT = 17                                        //When user exceeds transfer limit

FTP_EXCEED_MAX_SESSION_ON_GROUP = 18                //When exceed Maximum number of sessions for group

FTP_EXCEED_MAX_SESSION_PER_IP_ON_GROUP = 19        //When exceed Maximum sessions per IP address for group

FTP_EXCEED_MAX_SESSION_ON_DOMAIN = 20                //When exceed Maximum number of sessions on domain

FTP_EXCEED_MAX_SESSION_PER_IP_ON_DOMAIN = 21        //When exceed Maximum sessions per IP address on domain

FTP_BEFORE_LOGIN_EVENT = 22

FTP_BEFORE_DOWNLOAD_EVENT = 23

FTP_BEFORE_UPLOAD_EVENT = 24

FTP_BEFORE_DELETE_EVENT = 25

FTP_BEFORE_DIR_DELETE_EVENT = 26

 

//SSH Event Type(for c_SetSSHEvent,c_GetSSHEvent)

SSH_USER_LOGIN_EVENT = 0                        //When user has successfully logged in

SSH_USER_DISCONNECT_EVENT = 1                //When user leaves the server

SSH_USER_CONNECT_TIMEOUT_EVENT = 2        //When user has been disconnected for no command sending

SSH_DIR_CREATE_EVENT = 3                        //When a directory has been created

SSH_DIR_DELETE_EVENT = 4                        //When a directory has been deleted

SSH_EXCEED_USERPASS_EVENT = 5                //When a user failed to authenticate(exceed limit USER/PASS)

SSH_FILE_BANNED_EVENT = 6                //When users attempt to upload a banned file

SSH_FILE_DELETE_EVENT = 7                        //When a file has just been deleted

SSH_FILE_DOWNLOAD_EVENT = 8                //When a file has just been downloaded

SSH_FILE_RENAME_EVENT = 9                //When a file has been renamed

SSH_FILE_UPLOAD_EVENT = 10                //When a file was just uploaded

SSH_QUOTA_EXCEED_EVENT = 11                //When quota has reached maximum quota allowed

SSH_TOOMANY_CONNECTION_PERIP_EVENT = 12                //When too many connections have logged in with same IP

SSH_TOOMANY_CONNECTION_PERACCOUT_EVENT = 13        //When too many connections have logged in with same account

SSH_IP_BANNED_EVENT = 14                        //When a banned IP try to login on this server

SSH_EXCEED_LIMIT = 15                        //When user exceed transfer limit

SSH_EXCEED_MAX_SESSION_ON_GROUP = 16                //When exceed Maximum number of sessions for group

SSH_EXCEED_MAX_SESSION_PER_IP_ON_GROUP = 17        //When exceed Maximum sessions per IP address for group

SSH_EXCEED_MAX_SESSION_ON_DOMAIN = 18                //When exceed Maximum number of sessions on domain

SSH_EXCEED_MAX_SESSION_PER_IP_ON_DOMAIN = 19        //When exceed Maximum sessions per IP address on domain

SSH_BEFORE_LOGIN_EVENT = 20

SSH_BEFORE_DOWNLOAD_EVENT = 21

SSH_BEFORE_UPLOAD_EVENT = 22

SSH_BEFORE_DELETE_EVENT = 23

SSH_BEFORE_DIR_DELETE_EVENT = 24

 

//HTTP Event Type(for c_SetHTTPEvent,c_GetHTTPEvent)

WEB_USER_LOGIN_EVENT = 0                //When user has successfully logged in

WEB_DIR_CREATE_EVENT = 1                        //When a directory has been created

WEB_DIR_DELETE_EVENT = 2                        //When a directory has been deleted

WEB_EXCEED_USERPASS_EVENT = 3        //When a user failed to authenticate(exceed limit USER/PASS)

WEB_FILE_BANNED_EVENT = 4                //When users attempt to upload a banned file

WEB_FILE_DELETE_EVENT = 5                //When a file has just been deleted

WEB_FILE_DOWNLOAD_EVENT = 6                //When a file has just been downloaded

WEB_FILE_RENAME_EVENT = 7                //When a file has been renamed

WEB_FILE_UPLOAD_EVENT = 8                //When a file was just uploaded

WEB_QUOTA_EXCEED_EVENT = 9                //When quota has reached maximum quota allowed

WEB_TOOMANY_CONNECTION_PERIP_EVENT = 10                //When too many connections have logged in with same IP

WEB_TOOMANY_CONNECTION_PERACCOUT_EVENT = 11        //When too many connections have logged in with same account

WEB_IP_BANNED_EVENT = 12                        //When a banned IP try to login on this server

WEB_CHANGE_PASSWORD = 13                //When user changes his password

WEB_EXCEED_LIMIT = 14                                //When user exceeds transfer limit

WEB_EXCEED_MAX_SESSION_ON_GROUP = 15        //When exceed Maximum number of sessions for group

WEB_EXCEED_MAX_SESSION_PER_IP_ON_GROUP = 16        //When exceed Maximum sessions per IP address for group

WEB_EXCEED_MAX_SESSION_ON_DOMAIN = 17        //When exceed Maximum number of sessions on domain

WEB_EXCEED_MAX_SESSION_PER_IP_ON_DOMAIN = 18        //When exceed Maximum sessions per IP address on domain

WEB_USER_DISCONNECT_EVENT = 19        //When user leaves the server

WEB_BEFORE_LOGIN_EVENT = 20

WEB_BEFORE_DOWNLOAD_EVENT = 21

WEB_BEFORE_UPLOAD_EVENT = 22

WEB_BEFORE_DELETE_EVENT = 23

WEB_BEFORE_DIR_DELETE_EVENT = 24