Well the big issue i have is that people can see the data send. In this case the Username and Password.
I know there is
$username = $_GET['fname'];
$password = $_GET['fpass'];
I have tried simply replacing the word GET with POST but that seems to stop the php script from working.
But there is more that i don't understand.
In construct2 there is the option to use AJAX to 'request url' and 'post to url'. I have tried both but both show in the console in the browser.
So the two questions I have are..
1- Do I need to use the 'post to url' in my eventsheet to make the data invisible?
2- How do I convert the bit of php to use POST instead of GET and does that make it invisible?
I just don't want everyone with a tiny bit of knowledge to see the username and password.
Hard to understand the tutorial I am using is on this website and that uses GET in both php and AJAX. But then states it is not a very secure way.however that it can be made more secure. The tutorial is more than two years old but there are no relevant posts on the scirra forums to make it secure. There is not even a post regarding how to use the AJAX function 'post to url' properly on here except the manual entry which doesn't explain my question. Is there a better way to go about this or something? Does nobody have large data sets to load or compare to a database? Now somebody mentioned somewhere else on this forum I should use JSON instead and load all my database into an array from a JSON file. *sigh* Then why is this AJAX even an option? And why is that tutorial still up if it is not really advised to use that method? *Bllllarg
I had to use POST in one of my project to send different array (and save in json file by php) for make the savegame for every user and that works perfect..
if you use POST method, in construct2 would be:
Post to url:
Tag: "somename"
URL: link of your php file
data: "username="&usernameC2&"&"&"password="&passwordC2
method: POST
the php would be:
[quote:mlsz2j52]$username= mysqli_real_escape_string($con,$_POST['username']);
$password= mysqli_real_escape_string($con,$_POST['password']);
and when you have the connection with your database, just start a query:
$sql1="INSERT INTO user(username, password)
VALUES
('$username','$password')";
mysqli_query($con,$sql1);
this works for me... if you have some error, in your server (where is the php file) the server will make a file with the name of the error, and you can check from the console of chrome when you try to send data to see some error
for more information about POST and GET: http://www.w3schools.com/tags/ref_httpmethods.asp