Game Account with User's IP, is this a good idea? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Game Account with User's IP, is this a good idea?

So I want to implement something called "Guest Account" as the alternative for users who won't create an account. Basically the system will recognize a user by seeing their IP address. I'll tell you how's it work. First of all, AJAX will send a request to my PHP script, which will detect user's IP address and then it will be read. Let's say my IP address is 127.0.0.1 The system will check is 127.0.0.1 exist or not in the database. If it is not exist, an account called 127.0.0.1 will be created and the game progress (like money, level, etc) would be stored there. If 127.0.0.1 is exist in the database, it will read and load the game progress. But, lately I realize that IP addresses are dynamic. It means user will lose their game progress every time their IP changed. So I need your opinion, should I implement this in my game, or should I use local storage or cookies instead? Or you got a better idea? Please tell me! Thank you and sorry for my bad English.

22nd Aug 2018, 10:04 AM
Keanu Taufan
Keanu Taufan - avatar
2 Answers
+ 6
I think that local storage its the right choice
22nd Aug 2018, 10:08 AM
KrOW
KrOW - avatar
+ 3
You can Generate Tokens on User background and store as cookie on user's browser. But Local storage is also cool and the IP address is still Ok
23rd Aug 2018, 1:17 AM
Femi
Femi - avatar