ChatSimple (Test)

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Post Reply
scriptshow
Posts: 13
Joined: Tue Jan 03, 2012 8:06 pm
Location: Spain
Contact:

ChatSimple (Test)

Post by scriptshow » Wed Jan 04, 2012 7:14 pm

A very simple script of 795 bytes (795 bytes), less than 1Kb.! that can be used as a Chat, Channel announcements, Guestbook, Miniblog, etc.. real time at all. It can be adapted to any site, is compatible with any browser ...
Data is stored on a text file (chat.txt).

Code: Select all

<?php
$text = htmlspecialchars($_POST["text"], ENT_QUOTES);
$name = htmlspecialchars($_POST["name"], ENT_QUOTES);
$pass = htmlspecialchars($_POST["pass"], ENT_QUOTES);
$file = "chat.txt";
$date = date("Y/m/d");
$post = "$date <b>$name dice:</b> $text <hr noshade>";
if ($text !="" && $name !="" && $pass =="Test") file_put_contents($file, $post, FILE_APPEND | LOCK_EX);
$todo = file_get_contents($file);
echo "<html><font face='Arial' size='2'><h4>Mensajes:</h4>";
echo "$todo";
echo "<p><form method='POST' name='form'><textarea name='text' rows='4' cols='48'></textarea><p><input type='text' value='' name='name' size='24'> <input type='password' value='' name='pass' size='10'> <input type='Submit' value='Enviar'> <input type='reset' value='Borrar'></form></p></font></html>";
?>
The password is to prevent Spam: Test

http://www.scriptshow.murcia-region.com/test/?Chat
Last edited by scriptshow on Fri Feb 03, 2012 12:12 am, edited 5 times in total.
"Simplicity carried to the extreme becomes elegance" [ Jon Franklin ]

twc
Posts: 233
Joined: Fri Jun 18, 2010 12:25 am
Location: Netherlands

Re: ChatSimple (Test)

Post by twc » Fri Jan 06, 2012 1:31 pm

does not work here :lol:

scriptshow
Posts: 13
Joined: Tue Jan 03, 2012 8:06 pm
Location: Spain
Contact:

Re: ChatSimple (Test)

Post by scriptshow » Fri Jan 06, 2012 3:33 pm

Hi,
twc wrote:does not work here :lol:
Gotta try it on a Server with PHP 5.x
You need two files: "chat.php" and "chat.txt" writable.

Can be easily included in a page, for example:

Code: Select all

<?php
include('chat.php'); 
?>
And also:

Code: Select all

<iframe width="425" height="350" scrolling="auto" frameborder="0" marginheight="0" marginwidth="0" src="chat.php"></iframe>
Etc...
"Simplicity carried to the extreme becomes elegance" [ Jon Franklin ]

Post Reply