ph_system PowerHome formula function
Description
Updates and retrieves various system related functions within PowerHome 
Syntax
ph_system ( type, parm1, parm2, local )
Argument Description
type String. The type of system function you wish to interact with. Current valid value is "ws" for webserver.
parm1 Long. Parm1 to be passed for the specific function.
parm2 String. Parm2 to be passed for the specific function
local Integer. The local variable that you want extended data to be returned in (1 thru 10). Use a value of 0 to discard this data.
Return value
Double. Returns either a value requested for the system parameter or a success/error indicator.  Returns -3 if the type parameter is "ws" and the other parameters are invalid. Returns -999 if the type parameter is invalid.
Usage
Use this function to access various system related parameters. See the table below for valid usage parameters: 
type parm1 parm2 local Return value Notes
ws 0 enable 0 0 if successful
-1 if the webserver is already enabled
-2 if an error occurs
Use to enable the webserver
ws 0 disable 0 0 if successful
-1 if the webserver is already disabled
Use to disable the webserver
ws 0 status 0 0 if the webserver is disabled
1 if the webserver is enabled
Check the current status of the webserver
ws 0 to only read count
1 to read and reset count
getbadlogincnt 0 Returns the total count of bad login attempts
-1 if the webserver is not active
Get and optionally reset the count of bad login attempts
ws 0 to only read count
1 to read and reset count
getblacklistcnt 0 Returns the total count of hits from blacklisted IP's
-1 if the webserver is not active
Get and optionally reset the count of hits from blacklisted IP's
ws 0 to only read count
1 to read and reset count
gettrustedcnt 0 Returns the total count of hits from trusted IP's
-1 if the webserver is not active
Get and optionally reset the count of hits from trusted IP's
ws 0 to only read count
1 to read and reset count
getguestcnt 0 Returns the total count of hits using the guest account
-1 if the webserver is not active
Get and optionally reset the count of hits from the guest account
ws 0 to only read count
1 to read and reset count
getmastercnt 0 Returns the total count of hits using the master account
-1 if the webserver is not active
Get and optionally reset the count of hits from the master account
ws 0 to only read count
1 to read and reset count
getunauthcnt 0 Returns the total count of unauthorized hits
-1 if the webserver is not active
Get and optionally reset the count of unauthorized hits
ws 0 to only read count
1 to read and reset count
gethitcnt 0 Returns the total hit count of all access types
-1 if the webserver is not active
Get and optionally reset the total count of hits
ws 0 to only read count
1 to read and reset count
gethitovercnt 0 Returns the total overflows of the gethitcnt counter.
-1 if the webserver is not active
The gethitcnt value overflows and is reset to 0 at 4,200,000,000 and this counter is incremented by 1.
ws 0 clearcounts 0 0 if successful
-1 if the webserver is not active
Clears all above counts
ws 0 getallcounts 1 thru 10. The number of the LOCAL variable to return the counts in. 0 if successful
-1 if the webserver is not active
Retrieves all the counts into a formatted string and returns it in the specified LOCAL variable.
userdata 1 thru 5 for table userdata1 thru userdata5 truncate 0 0 if successful
-1 if parm1 is out of range
-2 if parm2 is out of range
Truncates the specified userdata (1 - 5) table. Keep in mind a truncate will delete all existing data. Useful resetting the autoincrement count in the userdata2 thru userdata5 tables.
Examples
The following examples demonstrate typical syntax/usage for this function.
ph_system("ws",0,"enable",0) - Enable the webserver
ph_system("ws",0,"disable",0) - Disable the webserver
ph_system("ws,1,"getbadlogincnt",0) - Retrieve the bad login attempts count and reset the count to 0.