In this chat app, when you open it first on your browser, there is shown a signup form where you have to signup with your details like name, email, password, and image. Email and image field is fully validated which means you've to enter a valid email and an image file only. Once you signed up successfully, you'll be redirected to the user's page where you can see your full name, image, status, and logout button to the top, and users, like you, appear on the bottom if someone has signed up. On this page, you can see their image, name, status, and the last message if they sent to you. You have to click on the particular user or you can also search any existing user with their name then you'll be redirected to the chat page and there you can see the image, name, status of that user who is going to chat.
Once you send a message to another user then immediately that message appears in your chat box and another user chatbox too which you've sent the message. On the message receiver chatbox, this user received the message with the sender image. Remember chatbox will be automatically scrolled to the bottom once the chatbox starts scrolling. You can logout from the chat application at any time and once you logout, immediately all other users will know that you've been log out or offline.
Once you logout, you can again login and with your email and password that you used to when signing up for the form. If you entered the correct credentials then you'll be redirected to the user's page and all other users will immediately know that you've logged on and now active.
Did you write this code? You have included it in a C++ repl. This seems strange. For the code to run you would need to have a webserver, and an installation of PHP and MySql. XAMPP or WAMP can give you this.