View Full Version : Php Chat With Swishmax
sawyer1370
09-05-2003, 09:25 PM
Ok, I don't really get into the backend said of things. I know there is a app out there that allows a chat room. How would this be done, what would be needed, and how hard would it be to do?
Any pro's out there willing to lend some advice and maybe a hand.
ratkat
09-05-2003, 09:42 PM
Heya sawyer
1st of all as long as you have mySQL and php avail on your server, chat rooms are a breeze...These days you can get one that you upload and click install
Now the best place I would ask is the maker of the swish chat room that was posted here not long ago...I saw it posted and went and looked. Was a nice job.
If you can trace this link to the maker, they will probably tell you how it was done
Les
Chat Room (http://www.swish-tutorials.com/forum/index.php?showtopic=19313&hl=chat)
Vincent26381
09-05-2003, 09:55 PM
I made one. It's not really done yet but it works, kind of. :)
The start for me was a small php script that just adds text to a textfile. Then I loaded that back in flash every two seconds or so.
That works but makes giant traffic. Then I thought of the idea to only keep the last 20 lines and make two PHP scripts. One that reads the whole textfile for reading it in the movie the first time and one script that only reads the last entry and displays that.
If you make an inputtextfield and give it the name 'myText' and create a button with that action:
loadVariablesNum("writeToText.php",0,'POST');
you can post the data that's inputted in the textfield to a PHP script:
writeToText.php:
<?php
$filename = 'test.txt';
$myText = $_POST['myText'];
// First let's check if the textfile is Chmodded:
if (is_writable($filename)) {
* *// Opening the textfile and adding the text ('a')
* * if (!$handle = fopen($filename, 'a')) {
* * * * echo "'&textBox=Can't open " . $filename . *"&";
* * * * exit;
* *}
* *// add $myText to the textfile
* *if (!fwrite($handle, $myText)) {
* * * *echo "&textBox=Can't write to " . $filename . "&";
* * * *exit;
* *}
* *print "&textBox=Written to textfile!";
* *fclose($handle);
} else {
* *echo "&textBox=Can't write to " . $filename . "&";
}
?>
This script writes to the textfile and prints if it has succeeded or not. To display this in your movie you need a dynamic textfield with the name 'textBox'.
If you make the textfields a target those names are the 'var' names.
Hope that helps you to get started. :)
that was me Les :)
vBulletin® v3.6.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.