I want to create an universal system for my online gaming portal and want a template from a programmer which will work for all of my games. Note that I'm a game developer myself but not very familiar with php and mysql databases. So that's why I need help. If you're not expert at php , mysql and AJAX please ignore this post.
Here's the pseudocode I wanna execute for each of my game,
on every game the an AJAX request will be sent to a certain php page which will tell us if the user is logged in or not . If logged in then it'll send the username in ajax lastdata. If not logged in it'll send an error message or something. Based upon this status we'll set a variable true or false. You'll understand the significance of this boolean later. Okay, now we have the login status. Then after finishing the game the user has highscore which I'm storing in localstorage. The user is given an option to a submit the highscore via a submit button obviously. When he/she presses the button it'll first compare if our boolean is true or false. If false we'll simply give the user option to register on our website. If true we'll post the score to another .php page which will submit the highscore to our database. And we'll have different row for different games. So, it'll just store the highscore value for every specific game. We'll create leaderboard for each game based upon the players who stored the highscore values. If you think you can make a template that'll work for all of the games please let me know. TIA.