WAN Mode Page to configure this page." end if (ButtonType and ButtonType == "config") then local inputTable = web.cgiToLuaTable(cgi) --automation part begin local tableIndex = 1 local errorFlag = "OK" validationTable = { --function() return validations.ipAddressValidate(inputTable["SSLVPNClientConf.PrimaryDNSServer"],"","Primary DNS Error","skip") end, --function() return validations.ipAddressValidate(inputTable["SSLVPNClientConf.SecondaryDNSServer"],"","Secondary DNS error","skip") end, --function() return validations.ipRangeValidate(inputTable["SSLVPNClientConf.BeginClientAddress"],inputTable["SSLVPNClientConf.EndClientAddress"],"Start/End IP error") end } while (tableIndex <= #(validationTable)) do validationFunc = validationTable[tableIndex] errorFlag, statusCode,field,skipValidations = validationFunc() if(errorFlag==1 or errorFlag == "ERROR") then statusMessage = db.getAttribute("stringsMap", "stringId", statusCode, LANGUAGE) or statusCode statusMessage = field .. ": " .. statusMessage break end tableIndex = tableIndex + 1 end if(errorFlag == "OK" or errorFlag == 0) then configRow = db.getRow("SSLVPNClientConf","_ROWID_", "1") if(configRow== nil) then errorFlag, statusCode = sslvpn.sslVpnClientConfig (inputTable, "-1", "add") else errorFlag, statusCode = sslvpn.sslVpnClientConfig (inputTable, "1", "edit") end -- save db if no error if (errorFlag == "OK") then db.save() end statusMessage = db.getAttribute("stringsMap", "stringId", statusCode, LANGUAGE) end web.goToPage(NextPage, true, true) elseif (ButtonType and ButtonType == "add") then local inputTable = web.cgiToLuaTable(cgi) --automation part begin local tableIndex = 1 local errorFlag = "OK" validationTable = { --function() return validations.ipAddressValidate(inputTable["SSLVPNClientRoute.DestinationNetwork"],inputTable["SSLVPNClientRoute.SubnetMask"],"IP/Subnet Mask Error") end } while (tableIndex <= #(validationTable)) do validationFunc = validationTable[tableIndex] errorFlag, statusCode,field,skipValidations = validationFunc() if(errorFlag==1 or errorFlag == "ERROR") then statusMessage = db.getAttribute("stringsMap", "stringId", statusCode, LANGUAGE) or statusCode statusMessage = field .. ": " .. statusMessage break end tableIndex = tableIndex + 1 end if(errorFlag == "OK" or errorFlag == 0) then if(cgi["hdCount"] ~= nil) then local hdCount = cgi["hdCount"] if(tonumber(hdCount) >= 32) then statusCode = "Can't add configuration to this table. Maximum limit reached." errorFlag = "ERROR" NextPage = "sslvpn_client" else errorFlag, statusCode = sslvpn.sslClientRouteConfig (inputTable, "-1", "add") end end -- save db if no error if (errorFlag == "OK") then db.save() end statusMessage = db.getAttribute("stringsMap", "stringId", statusCode, LANGUAGE) or statusCode end web.goToPage(NextPage, true, true) elseif (ButtonType and ButtonType == "delete") then -- if any rows to delete local rowTbl = {} rowTbl[1] = RowId errorFlag, statusCode = sslvpn.sslClientRouteConfig (rowTbl, "-1", "delete") -- save db if no error if (errorFlag == "OK") then db.save() end statusMessage = db.getAttribute("stringsMap", "stringId", statusCode, LANGUAGE) web.goToPage(NextPage, true, true) else configRow = db.getRow("SSLVPNClientConf","_ROWID_", "1") if(configRow == nil) then configRow = db.getDefaults(true, "SSLVPNClientConf") end local remoteMgmtStatus = db.getAttribute ("accessMgmt", "accessMgmt._ROWID_", "0", "accessMgmtEnable") ?>