Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Registration form
Started by H.R.H The Duke of Birmingham Aug 14 2016 06:32 AM

174 replies to this topic
[TOPIC CONTROLS]
Page 1 of 7 1 2 3 »
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

H.R.H The Duke of Birmingham

[GLOBAL: userInfoPane.html]
H.R.H The Duke of Birmingham
  • Contributor

  • 946 posts
  • Corona SDK

I am creating a social app and wanted to know when the user clicks register how to send the info into the database . I am using 000webhost as my database . I know the network.request code I have works because I tried it before but I don't exactly know where to put it and make it work . Can someone help me make everything work properly ? I already wrote the php code on 000webhost . I would really appreciate it .

 

register.lua

local composer = require( "composer" )
local scene = composer.newScene()

local widget = require("widget")

local function handleButtonEvent( event )
    if ( "ended" == event.phase ) then
        networkListener
end
end

network.request("http://web.web.com", "GET", function (e) 

end)

local function networkListener( event )

    if ( event.isError ) then
        print( "Network error: ", event.response )
    else
    end
end

local function loginLink( event )
    if ( "ended" == event.phase ) then
         composer.gotoScene("login")
    end
end

function scene:create(event)
   local screenGroup = self.view 
   
   display.setDefault("background", 0, 3, 5)

   local icon = display.newImage("icon_opt.png", 160, 70)
   screenGroup:insert(icon)

   local username = native.newTextField( 160, 200, 180, 30 )
   username.placeholder = "Username"
   screenGroup:insert(username)

   local password = native.newTextField( 160, 260,180, 30 )
   password.isSecure = true
   password.placeholder = "Password"
   screenGroup:insert(password)

   local email = native.newTextField( 160, 320, 180, 30 )
   email.placeholder = "E-mail"
   screenGroup:insert(email)

 local Button = widget.newButton(
    {
        shape = "roundedRect",
        left = 70,
        top = 360,
        id = "Register",
        label = "Register",
        onEvent = handleButtonEvent
    }
)
screenGroup:insert(Button)


local  Button2 = widget.newButton(
    {
        left = 70,
        top = 440,
        id = "Loginhere",
        label = "Login here",
        onEvent = loginLink
    }
) 
screenGroup:insert(Button2)

end

function scene:show(event)
end

function scene:hide(event)
end

function scene:destroy(event)
end

scene:addEventListener("create", scene)
scene:addEventListener("show", scene)
scene:addEventListener("hide", scene)
scene:addEventListener("destroy", scene)

return scene

network.request 

network.request("http://web.web.com", "GET", function (e) 

end)

local function networkListener( event )

    if ( event.isError ) then
        print( "Network error: ", event.response )
    else
    end
end


[TOPIC: post.html]
#2

ldurniat

[GLOBAL: userInfoPane.html]
ldurniat
  • Contributor

  • 389 posts
  • Corona SDK

Check out these links 

 

Corona SDK – Saving player score on server using PHP

 

https://arekzb.wordpress.com/2012/04/27/corona-sdk-saving-player-score-on-server-using-php/

 

Saving JSON from web to SQL Database

 

https://forums.coronalabs.com/topic/58690-saving-json-from-web-to-sql-database/

 

YouTube - Downloading JSON data from MySQL to Corona SDK

 

In this tutorial Dr. Burton explains how to connect to a remote database through php, convert the data to JSON and pass to a mobile app using Corona SDK. The data is then saved to a local SQLite database.

 

https://www.youtube.com/watch?v=iIeJEBQYA10



[TOPIC: post.html]
#3

H.R.H The Duke of Birmingham

[GLOBAL: userInfoPane.html]
H.R.H The Duke of Birmingham
  • Contributor

  • 946 posts
  • Corona SDK

That kind of helped but I honestly think I don't know what I'm doing . If I post what I have will you be able to tell me if i"m going down the right path



[TOPIC: post.html]
#4

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,042 posts
  • Enterprise

You have several things going on. Most importantly you're network code isn't working. But before  you get there, you have to understand the work flow.

 

You have two buttons:  one labeled "Register" and executes a function called "handleButtonEvent" when pressed. I'm assuming this function should take the values of username, password and email and do something to create a new user on the web server for this person.

 

The second button "Login" tries to go to a new scene called "login".

 

It would help to understand what you want to happen each time one of these buttons are pressed, then the community can help straighten out the code.

 

Next is security. How well do you know PHP and MySQL to write the server scripts? Have you thought about how you intend to secure the user's data? Login/Password credentials need to be well secured and how you secure things on the server impacts how you write the Corona code to match.

 

Rob



[TOPIC: post.html]
#5

H.R.H The Duke of Birmingham

[GLOBAL: userInfoPane.html]
H.R.H The Duke of Birmingham
  • Contributor

  • 946 posts
  • Corona SDK

When the user clicks the register button the users info will go to the database I have setup . The login here button takes the user to a page where they can sign up . That works properly . But I need help with the registration button . When I first tried my network code it worked but It wasn't using the url I have now , it was example.com and it outputed what was on the website which was good . But when the user signs up and if its successful I want them to go to the page and login . Can you help Me with this ?

[TOPIC: post.html]
#6

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,042 posts
  • Enterprise

Maybe something like:

-- forward declare the text fields
local username
local password
local email

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: ", event.response )
    else
    	print( event.response )
    end
end

local function handleButtonEvent( event )
    if ( "ended" == event.phase ) then
    	local URL = "http://web.web.com/yourscript.php?username=" .. urlencode( username.text ) .. "&password=" .. urlencode(password.text) .. "&email=" .. urlencode( email.text )
        network.request(URL, "GET", networkListener)
	end
end

local function loginLink( event )
    if ( "ended" == event.phase ) then
         composer.gotoScene("login")
    end
end

function scene:create(event)
   local screenGroup = self.view 
   
   display.setDefault("background", 0, 3, 5)

   local icon = display.newImage("icon_opt.png", 160, 70)
   screenGroup:insert(icon)

   username = native.newTextField( 160, 200, 180, 30 )  -- take the local off since it's forward declared
   username.placeholder = "Username"
   screenGroup:insert(username)

   password = native.newTextField( 160, 260,180, 30 ) -- take the local off since it's forward declared
   password.isSecure = true
   password.placeholder = "Password"
   screenGroup:insert(password)

   email = native.newTextField( 160, 320, 180, 30 ) -- take the local off since it's forward declared
   email.placeholder = "E-mail"
   screenGroup:insert(email)
-- rest of your code

Now there are still major concerns with this.  First of all, you're access http:// which is not secure. This script as I have it written will transmit the password in the clear and anyone snooping on your network will be easily able to grab the username and password.  THIS IS INCREDIBLY INSECURE.

 

How can you secure it?

 

1. Don't use obvious keys like "username", "password" and "email

2. Base64 encode the data before you transmit it and your script needs to know to base64 decode it. If you base64 encode it, you won't need to URL encode it which is a benefit.

3. Use https:// instead of http://. Your server must be set up to run SSL but at least the data is encrypted during its transmission to the server.

 

A more secure version of this, would be:

-- forward declare the text fields
local mime = require("mime")

local username
local password
local email

local function networkListener( event )

    if ( event.isError ) then
        print( "Network error: ", event.response )
    else
    	print( event.response )
    end
end

local function handleButtonEvent( event )
    if ( "ended" == event.phase ) then
    	local URL = "https://web.web.com/yourscript.php?a=" .. mime.b64( username.text ) .. "&b=" .. mime.b64(password.text) .. "&c=" .. mime.b64( email.text )
        network.request(URL, "GET", networkListener)
	end
end

local function loginLink( event )
    if ( "ended" == event.phase ) then
         composer.gotoScene("login")
    end
end

function scene:create(event)
   local screenGroup = self.view 
   
   display.setDefault("background", 0, 3, 5)

   local icon = display.newImage("icon_opt.png", 160, 70)
   screenGroup:insert(icon)

   username = native.newTextField( 160, 200, 180, 30 )  -- take the local off since it's forward declared
   username.placeholder = "Username"
   screenGroup:insert(username)

   password = native.newTextField( 160, 260,180, 30 ) -- take the local off since it's forward declared
   password.isSecure = true
   password.placeholder = "Password"
   screenGroup:insert(password)

   email = native.newTextField( 160, 320, 180, 30 ) -- take the local off since it's forward declared
   email.placeholder = "E-mail"
   screenGroup:insert(email)
-- rest of your code

But this assumes you have control over your script that's going to handle the input and store the data into a database and you can use https://.  Here I used keys: a, b and c and all the data has been base64 encoded.  On the server side if you're using PHP it would be something like:

<?php

$username = mysqli_real_escape_string( base64_decode( $_GET["a"]) );
$password = mysqli_real_escape_string( base64_decode( $_GET["b"]) );
$email = mysqli_real_escape_string( base64_decode( $_GET["c"]) );

// rest of  your script
echo "Success" // or whatever you want to communicate back to the Corona App as event.response.
?>

Now this could be even more secure by making sure you only store the password in a one way encryption such as an MD5 hash. The server should add some additional text to the password (called a salt) before it's hashed.  Then when the user logs in, you pass in the password from the user, salt it, hash it and then compare to what's in the database. You should never store user passwords in clear text.  And MD5 is considered minimal security. An SHA hash with larger encryption keys is more secure. Most hackers can bust an MD5 hash pretty quickly these days. That's why adding a salt string is important.

 

If you don't have control over the server script, then you will have to make your URL, key-value pairs, encoding match what the server expects.

 

Rob



[TOPIC: post.html]
#7

H.R.H The Duke of Birmingham

[GLOBAL: userInfoPane.html]
H.R.H The Duke of Birmingham
  • Contributor

  • 946 posts
  • Corona SDK

when I click register nothing happens 



[TOPIC: post.html]
#8

H.R.H The Duke of Birmingham

[GLOBAL: userInfoPane.html]
H.R.H The Duke of Birmingham
  • Contributor

  • 946 posts
  • Corona SDK

never mind I think I know what to do 



[TOPIC: post.html]
#9

H.R.H The Duke of Birmingham

[GLOBAL: userInfoPane.html]
H.R.H The Duke of Birmingham
  • Contributor

  • 946 posts
  • Corona SDK

Is this code good ?

<?php
       include("db.php");

       if (isset($_POST['submit'])) {
                if ($_POST['password'] == $_POST['password2']) {
                     $username = $_POST['username'];
                     $pw = $_POST['password'];
                     $email = $_POST['email'];
           // validate and sanitize all of these inputs
           // and see that they are not blank at the same time

           // Do your MySql here to find the $username and 
           // bring out result of find in $username_result
		   
		                $result = mysqli_query($conn ,"SELECT * FROM users WHERE username='$username' AND email='$email'");
                        if(mysqli_num_rows($result) > 0)
                        {
                        echo "User exist";
                        } else {
							
                        // it is not in use so put it in
                                            $pw = password_hash($pw, PASSWORD_BCRYPT, array('cost' => 12));

                           $sql = "INSERT into users VALUES(null, '$username', '$pw', '$email')";

                           if(mysqli_query($conn, $sql)){                                  
                           // if insert checked as successful echo username and password saved successfully
		                   echo"Your user was created. <a href= login.php>Click here to login </a><br />";
                           }else{
                           echo "Sorry something went wrong, <a href= signup.php>Try again</a><br />";   // and send them back to registration page 
                           }   
						}
                }else{
                echo "The passwords do not match. <a href= signup.php>Try again</a><br />";  // and send them back to registration page
                }    
      }
?>


[TOPIC: post.html]
#10

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,807 posts
  • Enterprise

You should check out coronium:

forums.coronalabs.com/topic/64888-release-coronium-ls-123-beta/

coronium.cloud

coronium.io



[TOPIC: post.html]
#11

H.R.H The Duke of Birmingham

[GLOBAL: userInfoPane.html]
H.R.H The Duke of Birmingham
  • Contributor

  • 946 posts
  • Corona SDK

I like the way i'm doing it now



[TOPIC: post.html]
#12

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,042 posts
  • Enterprise

First the PHP script is using HTTP POST not HTTP GET. The code I provide above assumes you're doing GET. Your network.request() call has to match your server's script methods.  network.request() can use POST, but you have to restructure the call to use a table for the body parameters rather than passing them on the URL.

 

Your script only requested the password once. On new registration's you should have two password fields. The PHP script expects two passwords. You should also validate the passwords on the local device before sending them.

 

I've not used password_hash() so I'm not sure how secure it is, but it seems better than a clear text password. The script outputs HTML which is great for a website. You might want to consider JSON output which will work better with your Corona App.

 

But the script is a minimalist user registration script.

 

Rob



[TOPIC: post.html]
#13

H.R.H The Duke of Birmingham

[GLOBAL: userInfoPane.html]
H.R.H The Duke of Birmingham
  • Contributor

  • 946 posts
  • Corona SDK

 $username = $_POST["username"];
    $password = $_POST["password"];

    $statement = mysqli_prepare($con, "INSERT INTO users (username, password, email) VALUES (?, ?, ?)");

    $password = password_hash($password, PASSWORD_BCRYPT, array('cost' => 12));

    mysqli_stmt_bind_param($statement, "sss", $username, $password, $email);
    mysqli_stmt_execute($statement);
    
    $response = array();
    $response["success"] = true;  
    
    print_r(json_encode($response));

Is this better



[TOPIC: post.html]
#14

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,042 posts
  • Enterprise

You're still using POST, which is okay if you change Corona to use POST.

You've removed the check to make sure that username/email doesn't already exist.

You've removed the check to validate the password with the second copy of the password.

You are not sanitizing the input using mysqli_real_escape_string

And you're potentially passing the password in the clear if this isn't an https:// service.

 

But just looking at the code, the basics are there.

 

Rob



[TOPIC: post.html]
#15

H.R.H The Duke of Birmingham

[GLOBAL: userInfoPane.html]
H.R.H The Duke of Birmingham
  • Contributor

  • 946 posts
  • Corona SDK

when I was using the code to check if the username doesn't exists on my website , it didn't work .



[TOPIC: post.html]
#16

H.R.H The Duke of Birmingham

[GLOBAL: userInfoPane.html]
H.R.H The Duke of Birmingham
  • Contributor

  • 946 posts
  • Corona SDK

Nothing happens when I click the register button 



[TOPIC: post.html]
#17

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,042 posts
  • Enterprise

You will need to post both your lua code and your PHP code.



[TOPIC: post.html]
#18

H.R.H The Duke of Birmingham

[GLOBAL: userInfoPane.html]
H.R.H The Duke of Birmingham
  • Contributor

  • 946 posts
  • Corona SDK

register.php :

 if (isset($_POST['register'])) {
                if ($_POST['password'] == $_POST['password2']) {
                     $username = $_POST['username'];
                     $password = $_POST['password'];
                     $email = $_POST['email'];
           // validate and sanitize all of these inputs
           // and see that they are not blank at the same time

           // Do your MySqli here to find the $username and 
           // bring out result of find in $username_result
		   
		        $result = mysqli_query($con ,"SELECT * FROM users WHERE username='$username' AND email='$email'");
                        if(mysqli_num_rows($result) > 0)
                        {
                        echo "User exist";
                        } else {
							
                        // it is not in use so put it in
                                            $pw = password_hash($pw, PASSWORD_BCRYPT, array('cost' => 12));

                           $sql = "INSERT into users VALUES(null, '$username', '$pw', '$email')";

                           if(mysqli_query($conn, $sql)){                                  
                           // if insert checked as successful echo username and password saved successfully
		                   echo"Your user was created. <a href= login.php>Click here to login </a><br />";
                           }else{
                           echo "Sorry something went wrong, <a href= signup.php>Try again</a><br />";   // and send them back to registration page 
                           }   
						}
                }else{
                echo "The passwords do not match. <a href= signup.php>Try again</a><br />";  // and send them back to registration page
                }    
      }

register.lua :

local composer = require( "composer" )
local scene = composer.newScene()

local widget = require("widget")
-- forward declare the text fields
local mime = require("mime")

local username
local password
local email

local function networkListener( event )

    if ( event.isError ) then
        print( "Network error: ", event.response )
    else
        print( event.response )
    end
end

local function handleButtonEvent( event )
    if ( "ended" == event.phase ) then
        local URL = "https://web.web.com/register.php?a=" .. mime.b64( username.text ) .. "&b=" .. mime.b64(password.text) .. "&c=" .. mime.b64( email.text )
        network.request(URL, "POST", networkListener)
        composer.gotoScene("login")

        else 
              print( "Something went wrong.")
    end
end

local function loginLink( event )
    if ( "ended" == event.phase ) then
         composer.gotoScene("login")
    end
end

function scene:create(event)
   local screenGroup = self.view 
   
   display.setDefault("background", 0, 3, 5)

   local icon = display.newImage("web_opt.png", 160, 70)
   screenGroup:insert(icon)

   username = native.newTextField( 160, 200, 180, 30 )  -- take the local off since it's forward declared
   username.placeholder = "Username"
   screenGroup:insert(username)

   password = native.newTextField( 160, 250,180, 30 ) -- take the local off since it's forward declared
   password.isSecure = true
   password.placeholder = "Password"
   screenGroup:insert(password)

   password2 = native.newTextField( 160, 300,180, 30 ) -- take the local off since it's forward declared
   password2.isSecure = true
   password2.placeholder = "Confirm Password"
   screenGroup:insert(password2)

   email = native.newTextField( 160, 350, 180, 30 ) -- take the local off since it's forward declared
   email.placeholder = "E-mail"
   screenGroup:insert(email)

 local Button = widget.newButton(
    {
        shape = "roundedRect",
        left = 70,
        top = 400,
        id = "Register",
        label = "Register",
        onEvent = userRegister
    }
)
screenGroup:insert(Button)


local Button2 = widget.newButton(
    {
        left = 70,
        top = 460,
        id = "Loginhere",
        label = "Login here",
        onEvent = loginLink
    }
) 
screenGroup:insert(Button2)

end

function scene:show(event)
end

function scene:hide(event)
end

function scene:destroy(event)
end

scene:addEventListener("create", scene)
scene:addEventListener("show", scene)
scene:addEventListener("hide", scene)
scene:addEventListener("destroy", scene)

return scene


[TOPIC: post.html]
#19

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,042 posts
  • Enterprise

Your lua code won't work with your PHP code.

 

You changed your network.request() to "POST", but you didn't change the parameters. There is an example of using POST on the docs page for network.request(). Honestly it may be easier to adapt your PHP script to GET instead of POST.

 

Next, you're still trying to use my suggestion of key-value pairs named "a", "b", "c", but your PHP script is looking for "username", "password", "password", and "email". The parameters have to match.  You're also not passing password2 in either.

 

For security I suggested using base64 encoding, which you are doing on the Corona side, but you never base64 decode on the PHP side.

 

Rob



[TOPIC: post.html]
#20

H.R.H The Duke of Birmingham

[GLOBAL: userInfoPane.html]
H.R.H The Duke of Birmingham
  • Contributor

  • 946 posts
  • Corona SDK

But I think that if I change from post to get I wouldn't understand anything i'm doing and it would be a lot of changing 



[TOPIC: post.html]
#21

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,042 posts
  • Enterprise

Both sides either have to be POST or both sides have to be GET.  POST is a little more difficult to setup on the Corona side and the PHP side, just change the $_POST's to $_GET's.

 

But you have to make the parameter names match on both sides. If you're going to use "username", "password", etc. on the PHP side, you have to use username, password etc. on the Corona side. "a", "b" and "c" wont work.

 

If you're going to base64 encode on one side, you have to base64 decode on the other.

 

We can do this in a very simple example, but your server will be very insecure. 

 

Rob



[TOPIC: post.html]
#22

H.R.H The Duke of Birmingham

[GLOBAL: userInfoPane.html]
H.R.H The Duke of Birmingham
  • Contributor

  • 946 posts
  • Corona SDK

Sorry I had some business to attend to , but I corrected everything you told me to but when I click the register button nothing happens . The info doesn't go in the database . 

 

register.lua :

local composer = require( "composer" )
local scene = composer.newScene()

local widget = require("widget")
-- forward declare the text fields
local mime = require("mime")

local username
local password
local email

local function networkListener( event )

    if ( event.isError ) then
        print( "Network error: ", event.response )
    else
        print( event.response )
    end
end

local function handleButtonEvent( event )
    if ( "ended" == event.phase ) then
        local URL = "https://web.web.com/register.php?username=" .. mime.b64( username.text ) .. "&password=" .. mime.b64(password.text) .. "&email=" .. mime.b64( email.text )
        network.request(URL, "GET", networkListener)
        composer.gotoScene("login")

        else 
            print( "Something went wrong. Try again.")
    end
end

local function loginLink( event )
    if ( "ended" == event.phase ) then
         composer.gotoScene("login")
    end
end

function scene:create(event)
   local screenGroup = self.view 
   
   display.setDefault("background", 0, 3, 5)

   local icon = display.newImage("icon_opt.png", 160, 70)
   screenGroup:insert(icon)

   username = native.newTextField( 160, 200, 180, 30 )  -- take the local off since it's forward declared
   username.placeholder = "Username"
   screenGroup:insert(username)

   password = native.newTextField( 160, 250,180, 30 ) -- take the local off since it's forward declared
   password.isSecure = true
   password.placeholder = "Password"
   screenGroup:insert(password)

   password2 = native.newTextField( 160, 300,180, 30 ) -- take the local off since it's forward declared
   password2.isSecure = true
   password2.placeholder = "Confirm Password"
   screenGroup:insert(password2)

   email = native.newTextField( 160, 350, 180, 30 ) -- take the local off since it's forward declared
   email.placeholder = "E-mail"
   screenGroup:insert(email)

 local Button = widget.newButton(
    {
        shape = "roundedRect",
        left = 70,
        top = 400,
        id = "Register",
        label = "Register",
        onEvent = userRegister
    }
)
screenGroup:insert(Button)


local Button2 = widget.newButton(
    {
        left = 70,
        top = 460,
        id = "Loginhere",
        label = "Login here",
        onEvent = loginLink
    }
) 
screenGroup:insert(Button2)

end

function scene:show(event)
end

function scene:hide(event)
end

function scene:destroy(event)
end

scene:addEventListener("create", scene)
scene:addEventListener("show", scene)
scene:addEventListener("hide", scene)
scene:addEventListener("destroy", scene)

return scene

register.php :

 if (isset($_GET['register'])) {
                if ($_GET['password'] == $_POST['password2']) {
                     $username = $_GET['username'];
                     $password = $_GET['password'];
                     $email = $_GET['email'];

           // validate and sanitize all of these inputs
           // and see that they are not blank at the same time

           // Do your MySqli here to find the $username and 
           // bring out result of find in $username_result
		   
		        $result = mysqli_query($con ,"SELECT * FROM users WHERE username='$username' AND email='$email'");
                        if(mysqli_num_rows($result) > 0)
                        {
                        echo "User exist";
                        } else {
							
                        // it is not in use so put it in
                                            $password = password_hash($password, PASSWORD_BCRYPT, array('cost' => 12));

                           $sql = "INSERT into users VALUES(null, '$username', '$password', '$email')";

                           if(mysqli_query($conn, $sql)){                                  
                           // if insert checked as successful echo username and password saved successfully
		                   echo"Your user was created.";
                           }else{
                           echo "Sorry something went wrong.
                           }   
						}
                }else{
                echo "The passwords do not match.";
                }    
      }


[TOPIC: post.html]
#23

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,042 posts
  • Enterprise

First of all, is the URL of your web service really:  https://web.web.com/register.php? (it's not, it gives a 404 page not found error).

 

Secondly have you tested the URL to make sure it's working. You should be able to hand construct the URL and put it in a web browser and make sure it's doing what you think it does. If you have errors in your web script, you may need to look at your server logs to see it.

 

Third, you are base64 encoding your parameters on the Corona Side. You are not base64 decoding them on your host side.

 

Forth, there is still a $_POST reference in your PHP script (side note, your password2 text field is global, don't forget to forward declare it)

 

You need to also look at the console log for your app and see what messages are being printed there (and share them with us).

 

Rob



[TOPIC: post.html]
#24

H.R.H The Duke of Birmingham

[GLOBAL: userInfoPane.html]
H.R.H The Duke of Birmingham
  • Contributor

  • 946 posts
  • Corona SDK

No the real URL works . Do I need to use base64 ? I am securing my password with a password hash which works good . My console log isn't showing anything I don't know what's wrong with the register button



[TOPIC: post.html]
#25

H.R.H The Duke of Birmingham

[GLOBAL: userInfoPane.html]
H.R.H The Duke of Birmingham
  • Contributor

  • 946 posts
  • Corona SDK

Warning: Could not load font HelveticaNeue-Light. Using default font.
Warning: Could not load font HelveticaNeue-Light. Using default font.
 
That is all that comes out of the console log



[topic_controls]
Page 1 of 7 1 2 3 »
 
[/topic_controls]