Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 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:


    Code:
    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:


    Code:
    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,
    Last edited by webb415; 08-28-2011 at 02:04 PM.

  • #2
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Yeah its fine and running now. Guys anyone?

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,155
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    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
    Code:
    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:
    Code:
    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 },
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    webb415 (08-29-2011)

  • #4
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,155
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    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.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •