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

c_ExitServer()

Parameters

nil

Return Values

nil

Remarks

Safely shut down the WingFTP service.

c_StartServer()

Parameters

nil

Return Values

nil

Remarks

Put all the domains online.

c_StopServer()

Parameters

nil

Return Values

nil

Remarks

Put all the domains offline.

c_ReplaceGlobalVar(string strSource)

Parameters

[1]string the source string

Return Values

[1]string the string with replaced values.

Remarks

Replace all the global variables of the source string and return it.

c_SendMail(string strTo,string strSubject,string strPlainText,string strAttach,string strSmtpName,bool bHTML)

Parameters

[1]string the receiver's email addresses, multiple email addresses can be separated by a comma

[2]string mail subject

[3]string mail content

[4]string attach file path

[5]string the SMTP configuration name

[6]bool mail content is HTML?, true=yes, false=no.

Return Values

[1]bool return true if email is sent successfully, otherwise return false

Remarks

Send an email with a few options.

c_SendMailComplete(string strTo,string strSubject,string strPlainText,string strAttach,string strSenderEmail,string strSenderName,

string strSmtpServer,int nSmtpPort,string strSmtpUserName,string strSmtpPassword,bool bSmtpNeedAuth,bool bUseSsl,bool bHTML)

Parameters

[1]string the receiver's email addresses, multiple email addresses can be separated by a comma

[2]string mail subject

[3]string mail content

[4]string attachment file path

[5]string the sender's email address

[6]string the sender's name

[7]string the server address

[8]int the smtp server's port

[9]string the login username

[10]string the login password

[11]bool need auth?, true=yes, false=no.

[12]bool need SSL?, true=yes, false=no.

[13]bool content is HTML?, true=yes, false=no.

Return Values

[1]bool return true if email is sent successfully, otherwise return false

Remarks

Send an email with full options.

c_GetVersion()

Parameters

nil

Return Values

[1]string the installed version of Wing FTP Server, such as "3.0.0"

Remarks

Get the installed version of Wing FTP Server.

c_GetLastVersion()

Parameters

nil

Return Values

[1]string the latest version of Wing FTP Server, such as "3.0.0"

Remarks

Get the latest version of Wing FTP Server.

c_GetOsType()

Parameters

nil

Return Values

[1]string the current operating system type, such as "Windows"

Remarks

Get the current operating system type.

c_ClearThumbCache()

Parameters

nil

Return Values

nil

Remarks

Clear all the thumbnail images cache.

c_CreateCustomLogo()

Parameters

[1]string the image path of your company logo.

Return Values

nil

Remarks

Create a custom logo for all domains.

c_ResetDefaultLogo()

Parameters

nil

Return Values

nil

Remarks

Reset to the default logo for all domains.

c_GetGlobalIPMaskList()

Parameters

nil

Return Values

[1]table the domain IPmask(formatted as {ip,refuse}) list table.

Remarks

Return entire server's IP mask list.

c_GetGlobalFileMaskList()

Parameters

nil

Return Values

[1]table the domain Filemask(formatted as {filename,refuse}) list table.

Remarks

Return entire server's file mask list.

c_SetGlobalIPMaskList(table tabIpMask)

Parameters

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

Return Values

nil

Remarks

Set entire server's IP mask list.

c_SetGlobalFileMaskList(table tabFileMask)

Parameters

[1]table the Filemask list table (formatted as {filename,refuse})

Return Values

nil

Remarks

Set entire server's file mask list.

c_GetSystemLog()

Parameters

nil

Return Values

[1]string system log text

Remarks

Get all the system logs.

c_AddSystemLog(string strLog,int nType)

Parameters

[1]string the system log text

[2]int the system log type: 1=normal log, 2=error log

Return Values

nil

Remarks

Add a system log.

c_GetServerStatistic()

Parameters

nil

Return Values

[1]table server 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 server statistics.

c_CreateSSLCertificate(string strFileName,string strFilePath,int nKeySize,string strCountry,string strState,string strLocality,string strOrganization,string strDomainName,string strPassword)

Parameters

[1]string the certificate file name

[2]string the output directory

[3]int key size

[4]string 2-digit country code

[5]string full state or province

[6]string locality(city)

[7]string organization

[8]string domain name/common name

[9]string SSL key password

Return Values

[1]bool return true if SSL certificate is created successfully, otherwise return false

Remarks

This function is used for creating a self-signed SSL certificate file.

c_GetSSLCertList()

Parameters

nil

Return Values

[1]table a table list of all the SSL configuration (formatted as {name,state})

Remarks

Return all the SSL certificate configurations.

c_GetSSLCertificate(string strName)

Parameters

[1]string the certificate configuration name

Return Values

[1]table a table formatted as {ssl_certpath,ssl_keypath,ssl_password}.

Remarks

Get an SSL certificate configuration on success, or nil on error.

c_CheckSSLCertificate(string strName)

Parameters

[1]string the certificate configuration name

Return Values

[1]bool return true if SSL certificate is valid, otherwise return false

Remarks

Check whether the specified SSL certificate is valid.

c_AddSSLCertificate(string strName,string strCertPath,string strKeyPath,string strPassword)

Parameters

[1]string the certificate configuration name

[2]string the certificate file path

[3]string the key file path

[4]string the key password

Return Values

[1]bool return true if successfully added an SSL certificate configuration, otherwise return false

Remarks

Add or modify an SSL certificate configuration.

c_DeleteSSLCertificate(string strName)

Parameters

[1]string the certificate configuration name

Return Values

[1]bool return true if successfully deleted an SSL certificate configuration, otherwise return false

Remarks

Delete an SSL certificate configuration.

c_CreateSSHKey(string strFileName,string strFilePath,string strKeyPassword,int nKeySize,int nKeyType)

Parameters

[1]string the host key filename

[2]string the output directory

[3]int the host key password

Return Values

[1]bool return true if SSH host key is created successfully, otherwise return false

Remarks

This function is used for creating an SSH host key file .

c_GetSSHKeyList()

Parameters

nil

Return Values

[1]table the table list of all SSH host keys (formated as {name,state})

Remarks

Return all the SSH host keys.

c_GetSSHKey(string strName)

Parameters

[1]string the SSH configuration name

Return Values

[1]table a table formated as {ssh_keypath,ssh_password}.

Remarks

Get an SSH configuration on success, or nil on error.

c_CheckSSHKey(string strName)

Parameters

[1]string the SSH configuration name

Return Values

[1]bool return true if SSH host key is valid, otherwise return false

Remarks

Check whether the specified SSH host key is valid.

c_AddSSHKey(string strName,string strKeyPath,string strPassword)

Parameters

[1]string the SSH configuration name

[2]string the key file path

[3]string the host key password

Return Values

[1]bool return true if an SSH configuration is added successfully, otherwise return false

Remarks

Add or modify an SSH configuration.

c_DeleteSSHKey(string strName)

Parameters

[1]string the SSH configuration name

Return Values

[1]bool return true if SSH configuration is deleted successfully, otherwise return false

Remarks

Delete an SSH configuration.

c_GetSMTPList()

Parameters

nil

Return Values

[1]string SMTP configuration list.

Remarks

Return all the SMTP configurations, the configuration name string is separated with a carriage return.

c_GetSMTP(string strName)

Parameters

[1]string the smtp configuration name

Return Values

[1]table a table formatted as {sender_name,sender_email,need_auth,smtp_server,smtp_port,smtp_username,smtp_password,use_ssl}.

Remarks

Get an SMTP configuration on success, or nil on error.

c_AddSMTP(string strName,string strSenderName,string strSenderEmail,bool bSmtpNeedAuth,string strSmtpServer,int nSmtpPort,string strSmtpUserName,string strSmtpPassword,bool bUseSsl)

Parameters

[1]string the smtp configure name

[2]string the sender's name

[3]string the sender's email address

[4]bool need auth?, true=yes,false=no.

[5]string the smtp server's address

[6]int the smtp server's port

[7]string the smtp server's username

[8]string the smtp server's password

[9]bool need SSL?, true=yes,false=no.

Return Values

nil

Remarks

Add or modify an SMTP configuration.

c_DeleteSMTP(string strName)

Parameters

[1]string the smtp configuration name

Return Values

[1]bool return true if deleted an SMTP configuration successfully, otherwise return false

Remarks

Delete an SMTP configuration.

c_GetTaskList()

Parameters

nil

Return Values

[1]table the system task(formatted as {taskname,type,day,executed,datefrom,timefrom}) list table

Remarks

Return all the system tasks.

c_GetTask(string strTaskName)

Parameters

[1]string the task scheduler name

Return Values

[1]table a table formatted as {taskname,type,day,executed,datefrom,timefrom,script}.

Remarks

Get a task scheduler on success, or nil on error.

c_AddTask(string strTaskName,int nType,int nDay,string strDatefrom,string strTimefrom,string strScript,bool bReset)

Parameters

[1]string the task scheduler name

[2]int the task scheduler type,0=one time task,1=hourly task,2=daily task,3=weekly task,4=monthly task

[3]int means the day number when you select weekly task or monthly task.

[4]string the date string of first starting task, such as 2009-9-9

[5]string the time string of first starting task, such as 09:09:09

[6]string the lua script text for the task.

[7]bool whether to reset the task, true=yes, false=no.

Return Values

nil

Remarks

Add or modify a system task scheduler.

c_DeleteTask(string strTaskName)

Parameters

[1]string the task scheduler name

Return Values

[1]bool return true if deleted system task scheduler successfully, otherwise return false

Remarks

Delete a system task scheduler.

c_TaskExist(string strTaskName)

Parameters

[1]string the task scheduler name

Return Values

[1]bool return true if the specified task scheduler exists, otherwise return false

Remarks

Check whether the specified task scheduler exists.