How do I create a Login and Signup system to work with AJAX?

Get help using Construct 2

Post » Tue Sep 13, 2016 12:06 am

Hi Guys,

I am looking for some help on how to create a login and register system to work with my Construct 2 mobile application. This system will be exactly like most modern apps on your mobile today that require you to signup and login.

I have webspace and the ability to setup a mySQL database. The database for now will hold email, full name and password.

I have no idea about AJAX and ASP.NET, I do however have very basic knowledge of PHP scripting.

I am looking for users to be able to sign up with the following information, full name, email address and a password. I then want a unique token sent to the email address they signed up with to confirm it is a legitimate and working email address. Once the email address is verified via a unique token that is emailed to them I then want the ability for a 'back end' system where an admin can log in and be able to see all the users that have signed up and have the ability to click on a name to either ban/kick a user.

If I could get any information on where to start with this, I have no idea how to program in ASP.NET, I did read somewhere that there are a bunch of supported languages for ASP.NET (JavaScript, C#, Visual Basic), I am happy to put the time in to learn this but just want to know where to start as most of the tutorials I've seen only cover this kind of subject for a website, I am looking to do this specifically for mobile devices.
B
9
S
3
Posts: 45
Reputation: 770

Post » Wed Sep 14, 2016 8:36 pm

You make a PHP script that receives the incoming HTTP AJAX requests from your C2 client and pass the username and password hash as parameters like:

http://yourdomain.com/login.php?usernam ... j2398KJdss

then you retrieve the parameters in PHP and pull the password hash associated username from the database and compare it to the hash received from the client. If they match, you create a session and manage it with PHP. You key the session cache using the public IP of the request and whatever other relevant info from the request you want to use.

I use the date up to the day in the session cache key to create an automatic session expiry, but you can just use the public IP if you want.

Every request that comes in to your PHP server will always check the session cache first for a session corresponding to that IP, if it exists and the session ID matches then it produces a page with all of the appropriate details.

We use the TextBox injection method to pass parameters directly from the HTML into the C2 js scripts. We also use a highly modified version of the 'index.html' file that C2 outputs. If you look at the HTML for our homepage, you will see a doIt() function that we added to inject parameters directly into our C2 application.

Code: Select all
<script type="text/javascript">
function doIt()
{
document.getElementById("getDisplayName").value = "";
document.getElementById("getUserID").value = "-1";
document.getElementById("getFT").value = "1";
document.getElementById("serverIP").value = "www.stormforgedproductions.com";
document.getElementById("saltBox").value = "eab5f675c24ebec8b745c8aa90096852f54ac10ce7f2f6638ccbf26248f480360fb8103977581838b28aa73b10f2ed731f7b544b736453e3bcf3a5446042d321";
document.getElementById("errorBox").value = "";
document.getElementById("playerServers").value = "{}";
document.getElementById("direct").value = "";
document.getElementById("tester").value = "false";
document.getElementById("playerCapId").value = "-1";
}
</script>
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,418
Reputation: 4,830


Return to How do I....?

Who is online

Users browsing this forum: Armench, beohs, farsen, insanesnake and 17 guests