• (12 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • 5
  • Last »

Simple Text Chat Box Learn how to use a simple idea to make text chat web application Rate Topic: ****- 3 Votes

#31 Guest_KHURRAM SHAHZAD*


Reputation:

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..
Was This Post Helpful? 0

#32 ahmad_511  Icon User is offline

  • MSX
  • member icon

Reputation: 131
  • View blog
  • Posts: 722
  • Joined: 28-April 07

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,
Was This Post Helpful? 0
  • +
  • -

#33 Blueorb  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 17
  • Joined: 03-July 10

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.
Was This Post Helpful? 0
  • +
  • -

#34 ahmad_511  Icon User is offline

  • MSX
  • member icon

Reputation: 131
  • View blog
  • Posts: 722
  • Joined: 28-April 07

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 :)
Was This Post Helpful? 0
  • +
  • -

#35 Blueorb  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 17
  • Joined: 03-July 10

Posted 15 July 2010 - 07:16 PM

View Postahmad_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!
Was This Post Helpful? 0
  • +
  • -

#36 AjusJudy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 20-February 08

Posted 16 July 2010 - 06:18 AM

View PostBlueorb, on 15 July 2010 - 06:16 PM, said:

View Postahmad_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.
Was This Post Helpful? 0
  • +
  • -

#37 ahmad_511  Icon User is offline

  • MSX
  • member icon

Reputation: 131
  • View blog
  • Posts: 722
  • Joined: 28-April 07

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() :
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.
Was This Post Helpful? 0
  • +
  • -

#38 Guest_chris*


Reputation:

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...
Was This Post Helpful? 0

#39 Guest_chris*


Reputation:

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...
Was This Post Helpful? 0

#40 Guest_Anony-Mouse*


Reputation:

Posted 28 October 2010 - 06:39 AM

Nothing happens when I try to sign in. :blink:
Was This Post Helpful? 0

#41 Guest_Anony-Mouse*


Reputation:

Posted 28 October 2010 - 06:43 AM

View PostAnony-Mouse, on 28 October 2010 - 05:39 AM, said:

Nothing happens when I try to sign in. :blink:

Was This Post Helpful? 0

#42 Guest_Anony-Mouse*


Reputation:

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. :helpsmilie:




:stupid:
:withstupid:
Was This Post Helpful? 0

#43 Guest_David*


Reputation:

Posted 28 October 2010 - 09:09 AM

View PostAnony-Mouse, on 28 October 2010 - 05:47 AM, said:

sorry that was an accidental post above
someone plz help me i downloaded the files but i cant sign in to the chat. :helpsmilie:




:stupid:
:withstupid:


same with me :(
Was This Post Helpful? 0

#44 ahmad_511  Icon User is offline

  • MSX
  • member icon

Reputation: 131
  • View blog
  • Posts: 722
  • Joined: 28-April 07

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 Attached File  chat.zip (35.4K)
Number of downloads: 442

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
Was This Post Helpful? 0
  • +
  • -

#45 Guest_bridge*


Reputation:

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

Was This Post Helpful? 0

  • (12 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • 5
  • Last »