...

View Full Version : post message function (Chat)



webb415
08-28-2011, 03:37 AM
I have got a script for chat room from hotscripts however the author has left the site and I am not able to contact him. So if anyone here can guide me a bit? It is basically a php/ajax chat room script using javascript. It runs fine here is a demo:



http://sharinganuser.freeiz.com/Test/chat/


i have set it up properly and it is even using mysql database. My question is that I want to make log of what ever the chat is happening (even the private ones) as I am admin. I am very good at php and understand what he has done in php but I when it comes to javascript i am not a person for it. So if anyone can help me with javascript? Cause when I see the msg send button source code it shows onclick is javascript:void(0) means it is using a java script. And there are total of 4 js files used:



http://sharinganuser.freeiz.com/Test/chat/js/


Note: log saved in database only remains for 15 minutes or somewhat like that cause i checked the data the old conversation was gone so I am now trying to use PHP fwrite code. i know how to write and implement it but again it has to go in some js file where the send button is related and I am not sure which file and exactly where. So any help would be appreciated.

Regards,

webb415
08-28-2011, 03:04 PM
Yeah its fine and running now. Guys anyone?

Old Pedant
08-29-2011, 12:59 AM
So this entire page is actually created by and using YAHOO's chat system, is that right?

And now you want to add in code that will hit your own site to save the chat in your MySQL DB via PHP?

So that means that every time posts something, you will be sending it *twice*? Once to YAHOO and once to your server?

For what it's worth, the page consistently gets an error on this line

var is = i.split('______');
Apparently, the variable i *should* be a string, but it's not, at that point. It's simply the number, 1. It would be easy to fix that:

var is = ('' + i).split('______');
or any other variation, to force the value to be a string.

ANYWAY... I can't see why you could put in another AJAX call to your PHP page. Finding exactly the right place to put it in all that overly complex code will take a bit of work, but far from impossible.





332 },

webb415
08-29-2011, 05:51 AM
Thank you for replying.

Well the main purpose is that when anyone is chating in chat room or private. I want that chat to be saved in txt file rather than database. So I am not sure how to do that with js. I can do that with php though but unfortunately the messaging script is based on js/ajax.

and can you also tell me the code you posted. Which file you are talking about?

Regards :)

Old Pedant
08-29-2011, 10:33 AM
If I recall correctly, that code is in kernel.js.

If you run with Firefox browser and with Firebug enabled, you'll hit it.

Anyway, you can't do this all with JS. I'm suggesting you would *ADD* another AJAX call (the entire chat system is based on AJAX, as you said) each time a message is posted the would hit your PHP server with a request to save the current message.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum