Simple Text Chat Box Learn how to use a simple idea to make text chat web application
#31 Guest_KHURRAM SHAHZAD*
Posted 07 July 2010 - 03:07 AM
THANKS its great example ...
But i want little changes in recieving of mesages update ... here you used request to server after every 3-seconds using AJAX ... is it possible that server it self send update to clients/users when any update occurs without making request to server from client('chatbox.js' in this example).
if possible then plz atleast give mean idea / mechanism.
..THANKS..
But i want little changes in recieving of mesages update ... here you used request to server after every 3-seconds using AJAX ... is it possible that server it self send update to clients/users when any update occurs without making request to server from client('chatbox.js' in this example).
if possible then plz atleast give mean idea / mechanism.
..THANKS..
#32
Posted 10 July 2010 - 06:08 PM
Well, That's one of the HTTP-based data request problems,
the Server can not request or connect to the client's javascript, javascript works independently on the client's machines whilst php works on the server side.
that's why we request the server and get the information back to the client through http request.
maybe something like XML Socket (I might be wrong) can do this but unfortunately it's not available for javascript
Thanks,
the Server can not request or connect to the client's javascript, javascript works independently on the client's machines whilst php works on the server side.
that's why we request the server and get the information back to the client through http request.
maybe something like XML Socket (I might be wrong) can do this but unfortunately it's not available for javascript
Thanks,
#33
Posted 14 July 2010 - 11:16 PM
Hey, thanks for putting your time and effort into this.
Unfortunately I wasnt able to get it working. It just gave me a JS error on the bottom of my browser.
Not too worried about it though, just letting you know.
Thanks anyway.
Unfortunately I wasnt able to get it working. It just gave me a JS error on the bottom of my browser.
Not too worried about it though, just letting you know.
Thanks anyway.
#34
Posted 15 July 2010 - 11:11 AM
Quote
Unfortunately I wasnt able to get it working. It just gave me a JS error on the bottom of my browser.
What kind of error,
can you please provide the error message you got and the code you're testing.
Thanks to let me know
#35
Posted 15 July 2010 - 07:16 PM
ahmad_511, on 15 July 2010 - 10:11 AM, said:
Quote
Unfortunately I wasnt able to get it working. It just gave me a JS error on the bottom of my browser.
What kind of error,
can you please provide the error message you got and the code you're testing.
Thanks to let me know
Hey, I just deleted everything and tried all over again. It's working just fine now.
Thanks!
#36
Posted 16 July 2010 - 06:18 AM
Blueorb, on 15 July 2010 - 06:16 PM, said:
ahmad_511, on 15 July 2010 - 10:11 AM, said:
Quote
Unfortunately I wasnt able to get it working. It just gave me a JS error on the bottom of my browser.
What kind of error,
can you please provide the error message you got and the code you're testing.
Thanks to let me know
Hey, I just deleted everything and tried all over again. It's working just fine now.
Thanks!
Hi Ahmad,
may i request can you please help with how to put time against a user, that is the time the user logs in and the time the user leaves the room. thanks you. or just record time-in and time-out in file.
#37
Posted 16 July 2010 - 09:27 AM
@Blueorb, Good to know 
@AjusJudy, please follow these steps:
1- open the users.php file in your favorite text editor.
2- add the following function before or after the function saveUsers() :
this function accepts two arguments:
$event: is the string you want to log
$showAsMessage: is a boolean controls whether you want to make the legged event appears for everybody as a message on the chat box or not, (it will be saved in the log.txt file in both ways)
3- search for the sign in confirmation:
and add call the logEvent() fucntion directly after it, you'll have something like this:
4- do the same for the sign out confirmation with a little change to the event message:
search this time for "signout" and call the logEvent():
5- create a new text file "logs.txt" in the same directory where you have the php scripts and make sure it's writable.
BTW AjusJudy, I didn't forget your previous request about the database version of the chatbox, but I'm really having none stable days and barely can focus on my job.
@AjusJudy, please follow these steps:
1- open the users.php file in your favorite text editor.
2- add the following function before or after the function saveUsers() :
function logEvent($event,$showAsMessage){
$logs=fopen("logs.txt","a+");
fputs($logs,"<".date("Y-m-d H:i:s")."> ".$event."\n");
fclose($logs);
if($showAsMessage){
$room=fopen("room_".$_POST['room'].".txt","a+");
fputs($room,time()."<!@!>BOT<!@!><!@!>".$event." @ ".date("Y-m-d H.i.s")."\n");
fclose($room);
}
}
this function accepts two arguments:
$event: is the string you want to log
$showAsMessage: is a boolean controls whether you want to make the legged event appears for everybody as a message on the chat box or not, (it will be saved in the log.txt file in both ways)
3- search for the sign in confirmation:
echo "signin";
and add call the logEvent() fucntion directly after it, you'll have something like this:
echo "signin"; logEvent($user." join the '".$_POST['room']."' room",true); exit();
4- do the same for the sign out confirmation with a little change to the event message:
search this time for "signout" and call the logEvent():
echo "signout"; logEvent($user." exit the '".$_POST['room']."' room",true); exit();
5- create a new text file "logs.txt" in the same directory where you have the php scripts and make sure it's writable.
BTW AjusJudy, I didn't forget your previous request about the database version of the chatbox, but I'm really having none stable days and barely can focus on my job.
#38 Guest_chris*
Posted 18 September 2010 - 05:14 AM
helo, can u tell me, how about the onlineuser.txt connect to database..can you show me the example...
#39 Guest_chris*
Posted 18 September 2010 - 05:24 AM
helo, your chat is great i think, but, can you show & add login.php and how to connect with database for the name and password, and show his/her name in <div id="usersOnLine"></div> thanks for spend this time on this...
#40 Guest_Anony-Mouse*
Posted 28 October 2010 - 06:39 AM
Nothing happens when I try to sign in.
#41 Guest_Anony-Mouse*
Posted 28 October 2010 - 06:43 AM
#42 Guest_Anony-Mouse*
Posted 28 October 2010 - 06:47 AM
sorry that was an accidental post above
someone plz help me i downloaded the files but i cant sign in to the chat.
someone plz help me i downloaded the files but i cant sign in to the chat.
#43 Guest_David*
Posted 28 October 2010 - 09:09 AM
#44
Posted 28 October 2010 - 03:46 PM
Hello there,
first of, I would like to thank you for the comments, and sorry for any inconvenience.
second of, I've uploaded the chatbox files with all suggested updates to my website so you can try it in action(it works fine for me as is but I updated the ajax.js to the one I already use)
http://zaksdg.com/lab/chat/
Note for Admins/Mods: please remove the link above if you see it's not appropriate to link to external site
and here is the files
chat.zip (35.4K)
Number of downloads: 302
if the live one works for you, that means there might be something with your code.
anyways, try the attached files.
Notes:
emotion codes:
3i,angr,cry,dip,lol,sad,sarc,sweet (ex :sad: or :lol:)
Tested on IE7+IE8 quirk and standard mods, FF 4.0b2, Chrome 7.0.517.8, Safari 5.0.2(7533.18.5)
if nothing helps, please add more information about error message may occurred or a link to a live version where we can see what's happening there.
Regards
first of, I would like to thank you for the comments, and sorry for any inconvenience.
second of, I've uploaded the chatbox files with all suggested updates to my website so you can try it in action(it works fine for me as is but I updated the ajax.js to the one I already use)
http://zaksdg.com/lab/chat/
Note for Admins/Mods: please remove the link above if you see it's not appropriate to link to external site
and here is the files
chat.zip (35.4K)
Number of downloads: 302
if the live one works for you, that means there might be something with your code.
anyways, try the attached files.
Notes:
emotion codes:
3i,angr,cry,dip,lol,sad,sarc,sweet (ex :sad: or :lol:)
Tested on IE7+IE8 quirk and standard mods, FF 4.0b2, Chrome 7.0.517.8, Safari 5.0.2(7533.18.5)
if nothing helps, please add more information about error message may occurred or a link to a live version where we can see what's happening there.
Regards
#45 Guest_bridge*
Posted 23 February 2011 - 05:37 AM
i've uploaded all file that i downloaded from this site and give the permission into 777 but i still cant sign into the site...can you please help me??? here the link: *** REMOVED EMAIL ADDRESS ***
This post has been edited by JackOfAllTrades: 23 February 2011 - 06:08 AM
|
|



MultiQuote








|