Use POST in change_ndpi_category

This commit is contained in:
emanuele-f 2017-09-19 17:51:33 +02:00
parent 1345196ba2
commit 09a1facad0
2 changed files with 14 additions and 7 deletions

View file

@ -11,16 +11,16 @@ sendHTTPContentTypeHeader('application/json')
interface.select(ifname)
if(haveAdminPrivileges()) then
local app_id = tonumber(_GET["l7proto"])
local new_cat_id = tonumber(_GET["ndpi_new_cat_id"])
local old_cat_id = tonumber(_GET["ndpi_old_cat_id"])
if(haveAdminPrivileges() and (_POST["l7proto"] ~= nil)) then
local app_id = tonumber(_POST["l7proto"])
local new_cat_id = tonumber(_POST["ndpi_new_cat_id"])
local old_cat_id = tonumber(_POST["ndpi_old_cat_id"])
if new_cat_id ~= nil and old_cat_id ~= nil and new_cat_id ~= old_cat_id then
setCustomnDPIProtoCategory(ifname, app_id, new_cat_id)
end
local res = {status = "OK"}
local res = {status = "OK", new_csrf = ntop.getRandomCSRFValue()}
print(json.encode(res))
else
print({status = "ERROR"})