local function emptyFields( event ) if ( username.text == "" or password.text == "" or password2 == "" or email.text == "" ) then local alert = native.showAlert( "Please fill in all fields .", emptyFields ) end end local function urlencode(str) if (str) then str = string.gsub (str, "\n", "\r\n") str = string.gsub (str, "([^%w])", function (c) return string.format ("%%%02X", string.byte(c)) end) str = string.gsub (str, " ", "+") end return str end local function networkListener( event ) if ( event.isError ) then print( "Network error. ") else if event.response == "success" then print("Success! We are now registered!") -- put the code here to go to where the user needs to be -- after a successful registration composer.gotoScene("login") else -- put code here to notify the user of the problem, perhaps -- a native.alert() dialog that shows them the value of event.response -- and take them back to the registration screen to let them try again end end end local function userRegister( event ) if ( "ended" == event.phase ) then local URL = "http://hash.comxa.com/register.php?Register=1&username=" .. username.text .. "&password=" .. password.text .. "&password2=" .. password2.text .. "&email=" .. urlencode( email.text ) network.request(URL, "GET", networkListener) end end
That’s the order that I have it in