Share your repls and programming experiences

← Back to all posts
I built an account system with PHP
tamkerl (5)

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!

https://software.tamkerl.repl.co

Commentshotnewtop
ROCKINGRAYQUAZA (78)

And I think this is vulcan came to know about you!!An upvote from me too ^_^

ROCKINGRAYQUAZA (78)

Awesome bro!! I will also learn php someday

frostedbutton75 (36)

Np! I didn’t know people code do this with PHP, so this is inspiring! @tamkerl

VulcanWM (2174)

Amazing man! You are an excellent coder!

VulcanWM (2174)

Your welcome. Hey I need a website like this, but I don't know how to make one. Can you make one for me? @tamkerl

tamkerl (5)

@VulcanWM Do you mean regarding the backend or layout?

tamkerl (5)

@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.

Example:

[
{
"19571":[]
},

{}
]

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:

[
{
"19571":[...]
},

{
"joe_1986":"19571"
}
]

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:

Please note, that to build an account-system like this, you must learn PHP for a while, and know things such as:

  • Variables
  • Objects
  • Encryption
  • Server response
  • HTML
VulcanWM (2174)

ok. I don't feel like learning a new language, can you make something like this for me? I'll credit you @tamkerl

tamkerl (5)

@VulcanWM Oh, I'm quite busy, but cannot you copy those parts to your project?

tamkerl (5)

@VulcanWM I didn't build the account system to be adaptable for other websites, but if you use the same code as me and then adjust the CSS etc. I may be able to help you with that later if you want.