Advanced Features > Server Lua API > Domain Function

Navigation: Advanced Features > Server Lua API > Domain Function |

c_AccessDataWay(string strDomain)

Parameters

[1]string the domain name

Return Values

[1]int the method for database storage of accounts information, 1=xml file, 2=mysql, 3=ODBC

Remarks

Returns method of database storage, 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 whether to add this IP to user's IP-block list, 1=yes, 0=no.

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

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

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

[9]string the message string will be sent to ftp client.

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 of same names as parameter "strName".

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 online sessions.

c_GetDomainLog(string strDomain)

Parameters

[1]string the domain name

Return Values

[1]string domain log text

Remarks

Get the log text of a specified domain.

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 ftp event type, you can check them at the bottom.

[3]int whether to 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 whether to write something to a log file,1=yes, 0=no.

[7]string the path of log file.

[8]string the log text.

[9]int whether to 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 whether to execute lua script,1=yes, 0=no.

[16]string the lua script content.

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, you can check them at the bottom.

Return Values

[1]int whether to 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 whether to write something to a log file,1=yes, 0=no.

[5]string the path of log file.

[6]string the log text.

[7]int whether to 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 whether to execute lua script,1=yes, 0=no.

[14]string the lua script content.

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

same as 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, you can check them at the bottom.

Return Values

same as 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

same as 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, you can check them at the bottom.

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 listener 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 by specified index.

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 IPmask(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 Filemask(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 IPmask list table (formatted as {ip,refuse})

Return Values

nil

Remarks

Set domain's IPmask 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 filemask 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 session number

Remarks

Return the current session number in the specified domain.

c_GetSessionLiveTime(string strDomain,int nSessionID)

Parameters

[1]string the domain name

[2]int the client session ID

Return Values

[1]int the live time of this session

Remarks

Return session's living time.

c_GetSessionStatistic(string strDomain,int nSessionID)

Parameters

[1]string the domain name

[2]int the client 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 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 domain statistics.

c_SendSiteMsg(string strDomain,int nSessionID,string strMessage)

Parameters

[1]string the domain name

[2]int the client session ID

[3]string the message text

Return Values

nil

Remarks

Send a message to the client(with FTP/FTPS protocol).

c_BroadcastSiteMsg(string strDomain,string strMessage)

Parameters

[1]string the domain name

[2]string the message text

Return Values

nil

Remarks

Broadcast a message to all the clients(with FTP/FTPS protocol).

c_GetSiteMsg(string strDomain,int nSessionID)

Parameters

[1]string the domain name

[2]int the client session ID

Return Values

[1]string the message text

Remarks

Return all the chatting message of the specified client.

c_CreateDomainLogo(string strDomain,string strLogoPath)

Parameters

[1]string the domain name

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

Return Values

nil

Remarks

Create 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 value of banned seconds

Return Values

[1]bool return true if added the temporary banned IP 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 removed the temporary banned IP 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 get server's IP way in ftp pasv mode transfer

[3]string your server's IP on internet

[4]string the specified web url that will resolve your internet IP.

[5]string the specified dynamic DNS, will resolve the hostname as my.dnsdns.org.

[6]int the refreshed interval value for getting server's IP.

[7]int enable auto-forwarding pasv ports to router, 1=yes, 0=no.

[8]int the pasv ports range from.

[9]int the pasv ports range to.

Return Values

nil

Remarks

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

//FTP Event Type(used in 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

//SSH Event Type(used in 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

//HTTP Event Type(used in 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