<% local msg = {} if _SESSION["logined"] ~= nil then local domain = _POST["domain"] local user = _POST["user"] if user ~= nil then user = json.decode(user) local result, bADuser = c_UserExist(domain,user.username) if result == true then if bADuser == true then rawset(msg, "code", -4) rawset(msg, "error", "AD user exists") print(json.encode(msg)) else rawset(msg, "code", -3) rawset(msg, "error", "User exists") print(json.encode(msg)) end else user.username = string.gsub(user.username,"%[","") user.username = string.gsub(user.username,"%]","") user.note_name = specialhtml_encode_enhance(user.note_name) user.note_address = specialhtml_encode_enhance(user.note_address) user.note_zip = specialhtml_encode_enhance(user.note_zip) user.note_phone = specialhtml_encode_enhance(user.note_phone) user.note_fax = specialhtml_encode_enhance(user.note_fax) user.note_email = specialhtml_encode_enhance(user.note_email) user.note_memo = specialhtml_encode_enhance(user.note_memo) AddUser(domain,user) if c_UserExist(domain,user.username) == true then rawset(msg, "code", 0) print(json.encode(msg)) else rawset(msg, "code", -2) rawset(msg, "error", "Add user failed") print(json.encode(msg)) end end end else rawset(msg, "code", -1) rawset(msg, "error", "not logged in") print(json.encode(msg)) end %>