Hey guys, I broke down my PDO Login system in PHP (Includes Unity Scripts as well).
So it’s just bare bones of what my system is. Figured this would be really helpful as most things I’ve seen around for Unity is using depreciated mysqli stuff. And being it’s PDO with Prepared Statements, I believe this makes it SQL Injection proof, at least from my understanding from research.
(You can either download it at the bottom of this message) or you can get it directly from GitHub
GitHub - WarheadDesignz/UnityPDO: A basic bare-bones C# and PHP PDO Login/Registration System for Unity and MySQL. to get any new changes users may make to it.
What it offers is:
- Unique Guest Account Creation/Generator
- Register Real Account
- Login
- Transfer Guest Data To Register Account.
- BCRYPT Hashing.
Guest Account Creation might not make sense to some, but what it does is, allow users to play your game(s) online without first registering for an account with their info, so what it does is, creates a unique Username/Password and then stores this info into a database while saving the login details in PlayerPrefs (can be whatever you want, just used that). (JUST TO MAKE IT CLEAR: IT does save the info into the database on the server) ONLY the Username and Password is stored locally so you don’t have to type in any credentials while playing as guest… Think of the game “Mobile Strike”, you can play without signing up, register later and all the stuff you’ve done is then transferred to your official account when you register.
So then you can either Register for a real account (Username, Password and Email).
OR you can initiate the Transfer from guest to real registered account, when transfer is done, will clean out the old guest account sense it is no longer needed.
I am giving it out for free, it should work as long as you follow the directions then it’s rather simple to use with no editing other than setting up the proper links to the PHP Files and setting up the two tables inside your database, of course you gotta have UI an stuff in Unity. But hey it’s free, and you are free to change it as you wish.
But keep in mind, when I said this is bare bones, I meant just that. I mean it’s a complete system, but it doesn’t have score boards, or in game money. That stuff shouldn’t be hard to add after looking at the PHP Code, every game is different so no sense in putting a million things.
But please let me know what you think!
(this is tested and works on - Windows & Android.) (don’t have a Mac or anything) don’t see why it wouldn’t work when it’s just PHP and Unity scripts.
2886485–212083–UnityPDOLogin.zip (10.6 KB)
