Web Analytics Made Easy -
StatCounter post message function (Chat) - CodingForum


No announcement yet.

post message function (Chat)

  • Filter
  • Time
  • Show
Clear All
new posts

  • post message function (Chat)

    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:


    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:


    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.

    Last edited by webb415; Aug 28, 2011, 09:04 AM.

  • #2
    Yeah its fine and running now. Guys anyone?


    • #3
      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 },
      Be yourself. No one else is as qualified.


      • #4
        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?



        • #5
          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.
          Be yourself. No one else is as qualified.