how to build a simple Chat room

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

first off, the jenChat DOESN'T refresh, that's one of it's features. And second off using a metarefresh every half second would be extremely useless on bandwidth (even though it's text, it's still alot), and on visual aid, it would blink so much nobody would be able to use it. The jenChat fixes both of those problems, but I couldn't get the sessions to last long enough.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

although i'm really pro a java/flash based applet to talk with an IRC server....
you could also have a look at xmlhttp requests to check if there is new data to display.... (could reduce bandwith issues... )
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

ok, i was a little bored. so i thought i would play with http://jpspan.sf.net

i created a little chatbox :) but i'm not a javascript hero, so that still needs some updating (keeping track of last recieved message_id to recude downloads)

you can test it at http://timvw.madoka.be/chatbox

and sources are here:
http://timvw.madoka.be/programming/php/chat_client.txt
http://timvw.madoka.be/programming/php/chat_server.txt
http://timvw.madoka.be/programming/php/chat_dump.sql


edit
(for some odd reason it doesn't seem to work in IE. Booooooo)


edit2
ah, now it works with IE6 too :)
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

Thank you thats about what i was looking for in a chat room now ill just mess around with some codes and make a admin account and make it where people log on thank you
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

hey it keeps giving me [CLIENT_ERROR] [OBJECT ERROR]??? how do you fix that??
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

alright i fixed that problem but now i have a new problem when you type in like your id and message and press enter it refreshes but you dont get any text or anything else except the place for your id and message?? oh do i fix this one?
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

what browser are you using? because i can't reproduce it with ie6 or firefox1.

when i was writing it, i noticed that it goes foobar if the php code outputs errors...
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

maybe a dumb question, but what is JPSpan?

edit:

Feyding Moon says:
haha
Feyding Moon says:
not sure why you asked that question..
Feyding Moon says:
(your newest post)
ßµяяiτö says:
ummm...cause I don't know maybe
Feyding Moon says:
did you see the site link for it?
ßµяяiτö says:
neg
ßµяяiτö says:
was it in that thread
Feyding Moon says:
yes.
Feyding Moon says:
:P
ßµяяiτö says:
doh!
Feyding Moon says:
you blind
ßµяяiτö says:
semi

doh! doh! doh!

I need a doughnut
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

i think im running ie 5 or 6 im not for sure but see i get the username and the message boxes but when i try typing something in and pressing return it just stays the same no messages will go on to the board for some reason...
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

alright i got it working i had to do alittle work to it i just made a new page and done a table and stuff and created it.. here is a link if you want to look at it..
http://www.hauntedgraveyard.southsidede ... client.php
only thing is i need is to make it refresh on its own :S
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

With IE6, following errors have reared their ugly heads
> Line 1 : Syntax Error
> Line 35 : 'chatbox' is undefined

for auto-refresh you can use meta-tag
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

i dont see any errors :?: and it seems to work but i dont get is why it gives you the errors what ie are you using?
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

Smackie wrote:i dont see any errors :?: and it seems to work but i dont get is why it gives you the errors what ie are you using?
As I told you on the chat, here above and now again that I am using IE 6 and I do get aforementioned errors evrytime page is loaded/refreshed.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Who thinks shiz's avatar is cool?

Image
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

mmkay... that's a bit off topic..
Post Reply