Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Submit network request
- --
- local function submitButtonPress (event)
- --print ("submitButtonPress")
- local URL
- local info
- -- Get data to check if it already exists
- -- Get data by email specified
- -- Set up HTTP request:
- local headers = {}
- headers[ "Content-Type" ] = "application/x-www-form-urlencoded"
- --print ("username: " .. usernameText.text)
- --print ("email: " .. emailText.text)
- --print ("password: " .. passwordText.text)
- local URL
- local info
- -- Encryption (MD5)
- local password = crypto.digest (crypto.md5, passwordText.text)
- info = "&email=" .. string.urlEncode (emailText.text) .. "&password=" .. password .. "&status=" .. status .. "&username=" .. string.urlEncode (usernameText.text)
- local params = {}
- params.headers = headers
- params.body = info
- -- Post data with specified info stored in the "info" var
- if info ~= "" then
- URL = "http://localhost:5723/users_post.php"
- network.request (URL, "POST", networkListenerPost, params)
- else
- print ("info to post is empty")
- end
- end
- -- Back to menu
- --
- local function menuButtonPress (event)
- print ("menuButtonPress")
- composer.gotoScene ("login", "slideRight", 300)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement