I am looking at making an idle game that stores data server side(instead of cookies) and would like a simple way (no mysql or php preferably) to register and login using html5 and/or javascript. I am VERY new to programming and therefore have no example to show sorry. any help would be greatly appreciated!
Disclaimer: I know it is stupid or a sin to answer this kind of question, but it is okay for an absolute beginner.
You have a lot of contradictory statements. First you said you wanna store it in the server side, but not PHP or MySQL (which is basically one of server side programs).
You are confusing Java and JavaScript. This is like equating Hamburger and Hamburg or Ham? Whatever. Java is not JavaScript. Please understand.
A solution for you is localStorage
and using it, you can store and retrieve data for the particular session, the more or less almost same way how a server session works. You can use the following snippet to check if the user is logged in:
if (typeof Storage !== "undefined") {
if (localStorage.getItem("user") != null)
// User is logged in
else
// Redirect to login.
}
Please have a look about how to work with localStorage
. This is ideal for Games, as they might need to go in and around pages and share information between them.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments