Every programmer wants to make a chat application once in his life, be any technology stack he/she might be using. Making a simple chat application...
For further actions, you may consider blocking this person and/or reporting abuse
This post is a good example of why PHP is bashed by the whole programming community.
I don't wanna sound rude but new programmers are going to see this and think this is OK. Please do not deploy this code to production.
Yeah we can use md5 and salt to make the password protected. This is just an experiment on how to make a chat application with PHP.
Please, don't use MD5 either. It's insecure. Don't try it in production.
Yeah that's why we can use md5 and salt which can generate an unique Id hence encrypting the password field.
No, seriously. Never use MD5 to encrypt a password. The are other methods more secure available php.net/manual/en/function.passwor...
Okay I will look into it. Thank you for the suggestion 😇
You can use sha256 joining the string with an application token or salt, or a cookie hash and it will be ok. If you want more security you can use 512-bit encrypt such whirlpool, sha-512 and so
I was going to use uniqid() in php and join it with the password string. I will try your approach too. Thank you for the suggestion 😇
Please do not create your own auth implementation, you will regret it eventually ( there's a big yellow box in uniqid manual that says you should never use it to salt passwords).
Use one of the many well-known, tested and audited auth libraries.
If you really wanna learn how to implement a custom authentication I suggest you to browse the source code of said libraries and see how they handle it.
There's nothing bad on implementing own auth if you're a senior dev and you know all about what it implies. Specially when working on a big company and being in need to create a self implemented auth to avoid extra costs of Auth APIs (Oauth, Oauth2, SSO ...), you just need to pass a security audit and the tests after building it and before linking your services to it on production
That is definitely a state-of-the-art PHP implementation of a chat API, however you might want to turn to other languages which have more structured approaches.
By example, Python + Django is a fantastic way to learn web development, with neatly separated concerns and it makes it hard/unnatural to turn to bad practices (although I've seen them done too).
I am unsure, if that is a state-of-the-art PHP implementation.
I guess such an implementation would more refer to an object oriented approach.
Using mysql_real_string_escape (there are also a lot of places, where those are missing.) is kind of outdated too. If you are writing raw querys, it is more common to use prepared statements these days.
The whole procedural programming approach, which was taken here, is in my eyes absolutely not state-of-the art.
There are quite modern PHP Frameworks like Symfony, wich could do the job well.
I don't know Django, but I guess the concepts are quite similar to frameworks like Symfony.
I would recommend staying with PHP for know. Just because it's more difficult to switch a language if someone is at the beginning of his programming carrier.
It's true that PHP is not that usable in some modern web-development scenarios (websockets, realtime-apps etc.), but it's relatively easy to use (like python) and still gets the job done in most classic web-dev scenarios.
I would also suggest Python as a good language to lern next, but maybe spend some more time to get to know modern programming concepts better, with a language you already know.
I would HIGHLY recommend to learn object oriented programming and concepts like Model-View-Controller.
Thank you for your suggestion😇. I will try this project again using Laravel or Symfony for sure.
Yeah sure I will try that out too. Thank you for the suggestion 😇
I understood the proposal of this post, but to make it clear for most of people that are starting in the programming world, that kind of stuff is for beginners only, in real life applications this way to do things like that is a bad practice;
This post is for beginners only.
As mentioned before, good efforts for practising PHP, but this isn’t something you want in production.
Reinventing the wheel for a lot of things as well. I suggest you try to use a framework next time, this is what’s mostly use din the industry as well. For example, try Symfony, which uses the doctrine dbal.
It also has a security component, and components for basically everything you’re doing here.
Okay I will work on it. Thanks!
Use reactphp or swoole to handle sockets, use redis to temporary save chats before saving to database?
I will make this again using react, this one is for beginners
how can i make the message sent from one mail to be moved to the person email address or that of the admin
Sorry I didn't get your question 😅
Can I make it into a website? I can’t find any web app hoster
Yeah sure!
That's true but the number of bad php examples out numbers every other language by many orders of magnitude.
What about Laravel? Some good practices baked in there :)
I will implement this chat api using Laravel too. Thanks for the suggestion 😇
It was awesome, keep it up ! more ideas and knowledge to do more .
Thank you