g1doz Posted August 4, 2019 Share Posted August 4, 2019 anyone help me to explain how to this script exchange data with server ? function LOGIN() Variable = {} Variable.LoginURL = "https://test.000webhostapp.com/ASQ/FE/Login.php" local configFile = gg.EXT_CACHE_DIR .. "/" .. gg.getFile():match("[^/]+$") .. ".cfg" local data = loadfile(configFile) if data ~= nil then data = data() end local Prompt = gg.prompt({[[LOGIN HERE Username]], "Password","Remember Me"}, data, {"text", "text","checkbox"}) if Prompt == nil then START() end gg.saveVariable(Prompt, configFile) if Prompt[3] == false then os.remove(gg.EXT_CACHE_DIR .. "/" .. gg.getFile():match("[^/]+$") .. ".cfg") end Variable.TempLogin = '{"Username":"' .. Prompt[1] .. '","Password":"' .. Prompt[2] .. '"}' ResponseContent = gg.makeRequest(Variable.LoginURL, nil, Variable.TempLogin).content if not ResponseContent then gg.alert(' CHECK YOUR CONNECTION ') print("⚠ Something Went Wrong ⚠") os.exit() else pcall(load(ResponseContent)) end end Link to comment Share on other sites More sharing options...
ZIOFUNNYGAMER Posted May 20, 2020 Share Posted May 20, 2020 Broo I don't understand any of that Link to comment Share on other sites More sharing options...
ItsSC Posted May 21, 2020 Share Posted May 21, 2020 Learn php. Variable.TempLogin = '{"Username":"' .. Prompt[1] .. '","Password":"' .. Prompt[2] .. '"}' This is json encoded string. Example Username : 123456 Password : Abc123456 With this input, you will get a json string like this: {"Username":"123456","Password":"Abc123456"} When this has post to your php, your php actually get the json string. Then now you can use json_decode to get the password. $username = json_decode("Username",true);// Store the username of user into the variable "username" $password = json_decode("Password",true);// Store the password of user into variable "password" Then the data sent by Lua can be receive by PHP. Link to comment Share on other sites More sharing options...
Question
g1doz
anyone help me to explain how to this script exchange data with server ?
function LOGIN()
Variable = {}
Variable.LoginURL = "https://test.000webhostapp.com/ASQ/FE/Login.php"
local configFile = gg.EXT_CACHE_DIR .. "/" .. gg.getFile():match("[^/]+$") .. ".cfg"
local data = loadfile(configFile)
if data ~= nil then
data = data()
end
local Prompt = gg.prompt({[[LOGIN HERE
Username]],
"Password","Remember Me"}, data, {"text", "text","checkbox"})
if Prompt == nil then
START()
end
gg.saveVariable(Prompt, configFile)
if Prompt[3] == false then
os.remove(gg.EXT_CACHE_DIR .. "/" .. gg.getFile():match("[^/]+$") .. ".cfg")
end
Variable.TempLogin = '{"Username":"' .. Prompt[1] .. '","Password":"' .. Prompt[2] .. '"}'
ResponseContent = gg.makeRequest(Variable.LoginURL, nil, Variable.TempLogin).content
if not ResponseContent then
gg.alert(' CHECK YOUR CONNECTION ')
print("⚠ Something Went Wrong ⚠")
os.exit()
else
pcall(load(ResponseContent))
end
end
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.