A simple chat in about 50 lines of code - Arkanis DevelopmentStuff about programming, technology, life… err… how about the universe?http://arkanis.de/weblog.xml2023-05-09T18:30:15+02:00Comment by StephanStephanhttp://arkanis.de/weblog/2010-09-04-a-simple-chat-in-about-50-lines-of-code#comment-2023-05-09-18-30-15-stephan2023-05-09T18:30:15+02:00
<p>The log file is just a text file where each message is appended as a new line at the end. There is no upper limit here so the log file will grow as long as you let it. Useful if you want to review longer discussions since without the log file the chat will only remember the last 10 messages.</p>
Comment by AndreaAndreahttp://arkanis.de/weblog/2010-09-04-a-simple-chat-in-about-50-lines-of-code#comment-2023-05-07-02-49-03-andrea2023-05-07T02:49:03+02:00
<p>Just put Simple Chat up on my website so I can chat with my friend in the Netherlands. I was in the process of changing the layout a little and ran across something called the log file… chating.txt. It is commented out and says it is optional. I was wonder what that is and what one would use it for.
Thanks.</p>
Comment by MichaelMichaelhttp://arkanis.de/weblog/2010-09-04-a-simple-chat-in-about-50-lines-of-code#comment-2021-04-29-22-45-45-michael2021-04-29T22:45:45+02:00
<p>Watching this blog for help but if you are ok to write me I am Michael@kyak106.com</p>
Comment by MichaelMichaelhttp://arkanis.de/weblog/2010-09-04-a-simple-chat-in-about-50-lines-of-code#comment-2021-04-29-22-13-50-michael2021-04-29T22:13:50+02:00
<p>Good job but I'm hardware fellow and a html cut and paste thief
I had for many years "a very simple ajax chat" running fine on my web site until
I changed hosts. after many tries gave up and am now attempting to get this working
first I use chat.kyak106.com that ends up in a box in my main web kyak106.com/lounge ..always done it this way so I could change chat without messing with the lounge. In chat.kyak106.com I uploaded (example.php) , (jquery1.4.2.min.js) and (setup.sh) just those 3 files or do I need messages.json also? Please help</p>
Comment by Tim17049Tim17049http://arkanis.de/weblog/2010-09-04-a-simple-chat-in-about-50-lines-of-code#comment-2020-12-23-16-20-23-tim170492020-12-23T16:20:23+01:00
<p>Ich habe ein kleines Problem ich kann mit Simpel Chat nicht anfangen weil die Nachrichten bei niemanden an könnten sie mir bitte Helfen?</p>
Comment by GenesisGenesishttp://arkanis.de/weblog/2010-09-04-a-simple-chat-in-about-50-lines-of-code#comment-2020-11-04-14-16-18-genesis2020-11-04T14:16:18+01:00
<p>Hi Stephen,</p>
<p>Great day! You did great! I copied your folder with the 3 files and put it in my server online then opened the example.php on Google Chrome. I typed in it and sent it. But my other browser could not see the sent chat from the 1st browser. What is wrong with what I did? Please help me.</p>
Comment by PeeterCZPeeterCZhttp://arkanis.de/weblog/2010-09-04-a-simple-chat-in-about-50-lines-of-code#comment-2019-10-11-10-41-13-peetercz2019-10-11T10:41:13+02:00
<p>Dobrý den.
Pocházím z České Republiky.
Programovat neumím ale chystám vlastní web ve webnode. Zkopíroval jsem tam do odstavce html celý zdrojový kod. A nefunguje mi to.</p>
Comment by StephanStephanhttp://arkanis.de/weblog/2010-09-04-a-simple-chat-in-about-50-lines-of-code#comment-2019-08-04-02-59-29-stephan2019-08-04T02:59:29+02:00
<p>Oh, thanks for the heads up. Didn't know the default settings had this restriction.</p>
Comment by MyOptionalNameMyOptionalNamehttp://arkanis.de/weblog/2010-09-04-a-simple-chat-in-about-50-lines-of-code#comment-2019-08-01-04-39-28-myoptionalname2019-08-01T04:39:28+02:00
<p>First, thank you for making this.</p>
<p>Second, people may run into the same problem I did getting php to work. After setting up the php for apache, I discovered this piece of code in mods-enabled/php*.conf:</p>
<pre><code># Running PHP scripts in user directories is disabled by default
#
# To re-enable PHP in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_flag engine Off
</Directory>
</IfModule></code></pre>
<p>I AM running in my userdir directory, and this threw me for a loop. So if anybody else runs into the problem where you just get the PHP code instead of actually executing it, that may be why - you have to disable that block if you are running in your user directory (i.e. your access is something like <a href="http://127.0.0.1/~USER/script.php">http://127.0.0.1/~USER/script.php</a>)</p>
Comment by StephanStephanhttp://arkanis.de/weblog/2010-09-04-a-simple-chat-in-about-50-lines-of-code#comment-2019-04-09-09-36-36-stephan2019-04-09T09:36:36+02:00
<p>Hi Franz,</p>
<p>sorry for the late reply. I had some quite busy days setting up my own business as a freelance programmer.</p>
<p>About 1): The chat itself doesn't care about the message length. I did a quick test with messages up to 256 KByte and had no trouble. But the environment where you run the chat might impose limits, e.g. in the webserver configuration. Also maybe some overzealous security system inspected the message content and filtered something it wasn't supposed to filter. I haven't encountered these things but from reading the docs it's possible. If you want you can send me a mail with some details about the messages you were trying to send. Then we might be able to debug it further.</p>
<p>About 2): The chat is very simple and by default it can't do that. But adding it doesn't require big changes. The easiest way I can thing of is by changing line 157 of the example (<a href="http://arkanis.de/projects/simple-chat/example.php">http://arkanis.de/projects/simple-chat/example.php</a>):</p>
<pre><code><input type="text" name="name" id="name" value="Anonymous" /></code></pre>
<p>to</p>
<pre><code><input type="text" name="name" id="name" value="" required /></code></pre>
<p>With that change the default name is empty (value="") but the user is required to enter something before sending a message (required). The browser itself will show a corresponding error message in the users language.</p>
<p>Hope that helps
Stephan</p>