<% local msg = {} if _SESSION["logined"] ~= nil then local name = _POST["name"] local ssl_cert_path = _POST["ssl_certpath"] local ssl_key_path = _POST["ssl_keypath"] local ssl_password = _POST["ssl_password"] local modify = _POST["modify"] if modify == nil then local result = c_GetSSLCertificate(name) if result ~= nil then rawset(msg, "code", -2) rawset(msg, "error", "ssl config already exists") else local retval = c_AddSSLCertificate(name,ssl_cert_path,ssl_key_path,ssl_password) if retval == false then rawset(msg, "code", -3) rawset(msg, "error", "add ssl certificate config ["..name.."] failed.") c_AddAdminLog("administrator '".._SESSION["admin"].."' added ssl certificate config ["..name.."] failed.",ADMIN_LOG_ERROR) else rawset(msg, "code", 0) c_AddAdminLog("administrator '".._SESSION["admin"].."' added ssl certificate config ["..name.."].",ADMIN_LOG_OK) end end else local retval = c_AddSSLCertificate(name,ssl_cert_path,ssl_key_path,ssl_password) if retval == false then rawset(msg, "code", -3) rawset(msg, "error", "modify ssl certificate config ["..name.."] failed.") c_AddAdminLog("administrator '".._SESSION["admin"].."' modified ssl certificate config ["..name.."] failed.",ADMIN_LOG_ERROR) else rawset(msg, "code", 0) c_AddAdminLog("administrator '".._SESSION["admin"].."' modified ssl certificate config ["..name.."].",ADMIN_LOG_OK) end end print(json.encode(msg)) else rawset(msg, "code", -1) rawset(msg, "error", "not logged in") print(json.encode(msg)) end %>