![]() |
|
[PHP] [updated]Small CLI Chat - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183) +---- Thread: [PHP] [updated]Small CLI Chat (/showthread.php?tid=5460643) |
[updated]Small CLI Chat - Prof. Farnsworth - Nov 11, 2016 Before we get into the code itself please note the following: - I just started learning about JMS and Stomp - I made it to learn more about JMS and Stomp - I didn't spend much time to make it perfect, look nice or be fast It requires ActiveMQ to work and it only works from CLI (terminal), but it does not require a database. That being said, don't hate on me if the code is nasty. I also commented the code so it's easier for beginners to understand what's going on. Feel free to let me know what you think and if there is a way to make it better. Image (underlined is user input): Spoiler (Click to View) Code: Pastebin link: http://pastebin.com/bcQZvC7L Taking Yani's advice I've decided to try to make it OOP. This is what came out of that: http://pastebin.com/8Dmia7nW * - Prof. Farnsworth - Nov 11, 2016 @Yani, care to get into more details? If you have time of course. I made this while I was at work to make time go by faster, hence I didn't spend that much time thinking about the logical structure, just wanted to make it work pretty much. About the $chosen variable, I know it wasn't necesary, it was just easier for me to work with it. * - Prof. Farnsworth - Nov 14, 2016 (Nov 11, 2016 11:56 AM)Yani Wrote: There's lots of stuff that could have been better. I re-made it. Updated the main thread with the pastebin link. Also going to post it here if somebody missed it : http://pastebin.com/8Dmia7nW * - k0dez - Nov 15, 2016 Cool thanks, this looks interesting. Good share mate. * - Hexurp - Nov 28, 2016 How would I go about using this on a website with shared hosting? * - Prof. Farnsworth - Nov 28, 2016 (Nov 28, 2016 12:53 AM)Hexurp Wrote: How would I go about using this on a website with shared hosting? If you have the ability to add services you need to add PHP Stomp. And regarding ActiveMQ, I think you need to talk to them about it. I had some problems while trying to run ActiveMQ on my localhost, had to create a new user and change the owner permissions of ActiveMQ. I also had to install other dependencies with pecl. Unless you have sudo access to the server (which I doubt) you need to send a ticket asking them to install ActiveMQ for you or at least tell you how you should go about it. |