I built an account system with PHP a while back.
Here are some features that you can do on the website:
- Sign up / Log in
- Create comments (if logged in), and delete them
- Have an avatar
- Change your profile description
- Change your username
- Change your password
- Report other users comments
- Report other users
- Delete your account
- Suspend your account (this will prevent your account from being accessible)
I would really appreciate feedback about it!
@VulcanWM It's not really that hard to make.
I started with just allowing people to make comments, then later allowed them to create accounts, which are encrypted.
This is how my account system works:
I have a user file, containing info about all users.
The user file contains a JSON object, like this:
That is an array, with two objects inside of it.
The first array item in the top-level array contains properties with titles such as "19571" (note that this ID shall be random and not already existing in the database when creating the account), which is an ID for a user.
Above you can see that the "19571" property is an array.
The first array item contains another array with encryption details for the private user object (when logging in, the system will try to decrypt that message, and if successful, logging in).
The second array item in the "19571" array is a "public object", which I use for public stuff such as your profile description, or the date that your account was created.
Now, with the first array item of the top-level array explained...
The second array item in the top-level array contains pointers to your ID by usernames, for example:
Where "joe_1986" is a username.
Upon user creation, both the UID ("19571") array (with its contents) and the username pointer ("joe_1986") should be created.
Giving the user a UID instead of just using the username for the private and public object lets you, for example, change your username easily, because in that case you would use the UID in e.g. comment files, to then point to the user, which makes the username editing really easy, without having username left in the system.
I hope that I explained the architecture as simple as possible, and good luck with your projects!
Here are some links to help you build a backend system like this:
Specific link to learn PHP encrypting: (LEARN PHP BEFORE YOU DO THIS) https://www.php.net/manual/en/function.openssl-encrypt.php
Please note, that to build an account-system like this, you must learn PHP for a while, and know things such as:
- Server response