[PHP] CHAT about PHP
www.phpexpert.org Programming Help and General Programming Topics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CHAT about PHP
* Thus wrote Damian Brown ([EMAIL PROTECTED]): www.phpexpert.org Programming Help and General Programming Topics Is this a joke? Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CHAT about PHP
no Curt it is quite serious Curt Zirzow [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] * Thus wrote Damian Brown ([EMAIL PROTECTED]): www.phpexpert.org Programming Help and General Programming Topics Is this a joke? Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CHAT about PHP
On Wed, 2003-08-20 at 11:11, Curt Zirzow wrote: * Thus wrote Damian Brown ([EMAIL PROTECTED]): www.phpexpert.org Programming Help and General Programming Topics Is this a joke? Looks like an email harvester. Why does it need an email address? Cheers, Rob. -- .-. | Worlds of Carnage - http://www.wocmud.org | :-: | Come visit a world of myth and legend where | | fantastical creatures come to life and the | | stuff of nightmares grasp for your soul.| `-' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CHAT about PHP
On 20 Aug 2003 11:31:02 -0400, you wrote: On Wed, 2003-08-20 at 11:11, Curt Zirzow wrote: * Thus wrote Damian Brown ([EMAIL PROTECTED]): www.phpexpert.org Programming Help and General Programming Topics Is this a joke? Looks like an email harvester. Why does it need an email address? Search-engine spammer and an onClose popup ad, too. And multiple!!! exclamation!!! marks!!! Yeah, that's someone I'd do business with. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CHAT about PHP
Sites like these will drive me to ASP... On Wed, 2003-08-20 at 17:39, David Otton wrote: On 20 Aug 2003 11:31:02 -0400, you wrote: On Wed, 2003-08-20 at 11:11, Curt Zirzow wrote: * Thus wrote Damian Brown ([EMAIL PROTECTED]): www.phpexpert.org Programming Help and General Programming Topics Is this a joke? Looks like an email harvester. Why does it need an email address? Search-engine spammer and an onClose popup ad, too. And multiple!!! exclamation!!! marks!!! Yeah, that's someone I'd do business with. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CHAT about PHP
You can program a site as complicated as this in ASP as well *g* At 18:19 20.08.2003, P.Agenbag said: [snip] Sites like these will drive me to ASP... On Wed, 2003-08-20 at 17:39, David Otton wrote: On 20 Aug 2003 11:31:02 -0400, you wrote: On Wed, 2003-08-20 at 11:11, Curt Zirzow wrote: * Thus wrote Damian Brown ([EMAIL PROTECTED]): www.phpexpert.org Programming Help and General Programming Topics Is this a joke? Looks like an email harvester. Why does it need an email address? Search-engine spammer and an onClose popup ad, too. And multiple!!! exclamation!!! marks!!! Yeah, that's someone I'd do business with. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php [snip] -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Chat with php
Thomas Weber schrieb: Hi, i'm running a selfmade PHP-chat since one and a half year, currently version 3. Maybe we can share some ideas The image-idea is interesting, but would take heavy bandwith i think. My chat runs over a simple dsl-line with 256kbit upstream, there are up to 50 users at the same time (slow but okay). It's very good at 30 users, but there is a whole community with galleries etc. on the same server. What i know: To avoid reloads, you must use a stream. That's the flush()'n'sleep()-thing. This is my main-loop: 01 ini_set(max_execution_time, 0); 02 for(;;) 03 { 04 $newline = get_newline($last_row);// fetch a new line (out of an database for example, returns time, alias, text as array, or false if no new line is found) 05 if(is_array($newline)) 06 { 07 $newtext = format($newline);// format line for output (text bla could be (01:01) Alias: bla and /me bla could be Alias bla, returns the string to be outputtet to the browser) 08 if($newtext AND $newtext != $oldtext) echo $newtext;// if it's new text (avoids flooding), output the line! 09 $last_row = $newline[id];// next time fetch another id 10 flush();// sends buffer to browser 11 echo \n!-- for Opera --\n;// Opera seems to use a strange buffer and does not display the last line, so send another one, invincible 12 flush();// flush again, opera should now display the line 13 } 14 unset($newline); 15 16 usleep(20);// sleep some time, otherwise the script would eat 100% CPU. Usuable on my server (p3-550) are 10 to 50 msec 17 18 $loop++; 19 if($loop 600) 20 { 21 echo !-- TOK --\n;// some browsers kill the connection if it is dead for some time, so send a time out kill, some minutes are enaugh 22 $loop = 0;// reset 23 } 24 } Okay, tha's the deal.. max_execution_time is set to unlimited, I had streams running several days. Fortunately PHP kills the scripts automatically if no brower is listening. To fetch a line there are some ways the most simple is to query a database for a line with an higher id, but this eats up loads of cpu-usage in bigger chats. Currently i use shared memory. I've an php-console-script running wich fetches newline out of the database and writes 'em into shared memory. This is MUCH faster than have every stream-script connecting to the db. What i don't know: I'm searching for an better idea to interchange data between the scripts wich enter data, the server and the stream-scripts. Shared memory is good enaugh for the last two one, but it ever takes min. the 20 ms sleep-time for a new line. I need something to awaik the script exactly when a new line is in memory. Synchronisation between enter and server is more difficult, because there is the posibillity for two scripts entering a new line at the same time don't know how to avoid this. I hope this helps. Hey cool, That's working. The only problem I have now is that I want the most recent text at the top. But that script adds it on the bottom. Any way to change that? At least a way to always scroll automatically to the bottom? Cya, Olli -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Chat with php
I've thought about adding the text on the top, but never found a good way to make that (not with plain HTML, it would require a java-applet to display the stream). Scrolling is quite simple, i use this: head SCRIPT language=JavaScript !-- doscroll = true; function Scroller() { if (doscroll != false) { window.scrollBy(0,15); } window.setTimeout(Scroller(),15) } Scroller(); parent.atok = 'CCOFs'; function atok(p1) { parent.atok = p1; } //-- /SCRIPT /head body onFocus=doscroll=false onBlur=doscroll=true onMouseOver=doscroll=false onMouseOut=doscroll=true ... It scrolls down whenever the mouse is outside the frame with the stream. Cya, Thomas 'Neo' Weber --- [EMAIL PROTECTED] [EMAIL PROTECTED] - Original Message - From: Oliver Witt [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Thomas Weber [EMAIL PROTECTED] Sent: Tuesday, October 08, 2002 10:51 AM Subject: Re: [PHP] Chat with php Hey cool, That's working. The only problem I have now is that I want the most recent text at the top. But that script adds it on the bottom. Any way to change that? At least a way to always scroll automatically to the bottom? Cya, Olli -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Chat with php
Thomas Weber schrieb: I've thought about adding the text on the top, but never found a good way to make that (not with plain HTML, it would require a java-applet to display the stream). Scrolling is quite simple, i use this: head SCRIPT language=JavaScript !-- doscroll = true; function Scroller() { if (doscroll != false) { window.scrollBy(0,15); } window.setTimeout(Scroller(),15) } Scroller(); parent.atok = 'CCOFs'; function atok(p1) { parent.atok = p1; } //-- /SCRIPT /head body onFocus=doscroll=false onBlur=doscroll=true onMouseOver=doscroll=false onMouseOut=doscroll=true ... It scrolls down whenever the mouse is outside the frame with the stream. Cya, Thomas 'Neo' Weber Cool, the scroll script is working well. Now, I'm working on a list that shows who's in the chat. The problem is that people who log in don't always log out. I've thought about some time out and automatical log out, but isn't there a way to determine who is on what page, at least how many are on it? Greetings, Olli -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Chat with php
I attempted to write a oage that you can chat on with php. It ended up being a page that reloads itself all the time which isn't really what I wanted. But I didn't know how to do it differently. Is there another way? I heard something about flush()? Kind regards, Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Chat with php
You can have your script enter a loop to check for data in a database. If data output it then calls the flush() function to output to the browser. Then sleep for some time, then wakeup and repeat. You may have issues with some browsers using this technique, but generally it does work. The key is that you never close the connection to the browser. You'll also want to occasionally output some invisible content, otherwise the connection_status() stuff never give the right value (at least not in 4.1.2) It struck me that these functions update their flags on output only. Which means you need to output something to the browser to detect that the user has hit stop, or has disconnected. Cheers, Rob. Oliver Witt wrote: I attempted to write a oage that you can chat on with php. It ended up being a page that reloads itself all the time which isn't really what I wanted. But I didn't know how to do it differently. Is there another way? I heard something about flush()? Kind regards, -- .-. | Robert Cummings | :-`. | Webdeployer - Chief PHP and Java Programmer | :--: | Mail : mailto:[EMAIL PROTECTED] | | Phone : (613) 731-4046 x.109 | :--: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `--' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Chat with php
But, Robert, doesn't this technique leave a connection open on the server--and, won't it cause the server to run out of resources after a very finite number of connections has been established? Marco On Mon, 2002-10-07 at 14:07, Robert Cummings wrote: You can have your script enter a loop to check for data in a database. If data output it then calls the flush() function to output to the browser. Then sleep for some time, then wakeup and repeat. You may have issues with some browsers using this technique, but generally it does work. The key is that you never close the connection to the browser. You'll also want to occasionally output some invisible content, otherwise the connection_status() stuff never give the right value (at least not in 4.1.2) It struck me that these functions update their flags on output only. Which means you need to output something to the browser to detect that the user has hit stop, or has disconnected. Cheers, Rob. Oliver Witt wrote: I attempted to write a oage that you can chat on with php. It ended up being a page that reloads itself all the time which isn't really what I wanted. But I didn't know how to do it differently. Is there another way? I heard something about flush()? Kind regards, -- .-. | Robert Cummings | :-`. | Webdeployer - Chief PHP and Java Programmer | :--: | Mail : mailto:[EMAIL PROTECTED] | | Phone : (613) 731-4046 x.109 | :--: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `--' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Chat with php
Another way is to use javascript with PHP to pull the database every so many seconds. I have seen this in I think it was PHPChat. Been a long time however. --- Brad Dameron Network Account Executive TSCNet Inc. www.tscnet.com Silverdale, WA. 1-888-8TSCNET -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, October 07, 2002 11:07 AM To: Oliver Witt Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Chat with php You can have your script enter a loop to check for data in a database. If data output it then calls the flush() function to output to the browser. Then sleep for some time, then wakeup and repeat. You may have issues with some browsers using this technique, but generally it does work. The key is that you never close the connection to the browser. You'll also want to occasionally output some invisible content, otherwise the connection_status() stuff never give the right value (at least not in 4.1.2) It struck me that these functions update their flags on output only. Which means you need to output something to the browser to detect that the user has hit stop, or has disconnected. Cheers, Rob. Oliver Witt wrote: I attempted to write a oage that you can chat on with php. It ended up being a page that reloads itself all the time which isn't really what I wanted. But I didn't know how to do it differently. Is there another way? I heard something about flush()? Kind regards, -- .-. | Robert Cummings | :-`. | Webdeployer - Chief PHP and Java Programmer | :--: | Mail : mailto:[EMAIL PROTECTED] | | Phone : (613) 731-4046 x.109 | :--: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `--' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Chat with php
Simple trick (well, not so simple, but kind of a Columbus' Egg): 1) Create an img tag in your web page that is hidden 2) Point the img tag to a php script that returns: 1) An image with a pixel width of 1 if there is new data to pick up from the server 2) An image with a pixel width of 0 otherwise 3) Create a javascript that refreshes the image every second (or every two seconds, or however often you feel necessary--the more often, the more responsive and real time your chat system will be). 4) Add an OnLoad event to the img tag that points to a Javascript that checks the width of the newly reloaded image. If the width is one, then you reload your chat text content (which you may want to put in an iframe to avoid having to reload the whole page). I don't have a script to show unfortunately, as it would probably be too complicated and long for the list (and I have no time to write it...sigh), but hopefully, this will give you the gist of it. Cheers, Marco On Mon, 2002-10-07 at 13:43, Oliver Witt wrote: I attempted to write a oage that you can chat on with php. It ended up being a page that reloads itself all the time which isn't really what I wanted. But I didn't know how to do it differently. Is there another way? I heard something about flush()? Kind regards, Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Chat with php
Brad Dameron schrieb: Another way is to use javascript with PHP to pull the database every so many seconds. I have seen this in I think it was PHPChat. Been a long time however. Well, that's pretty much how I've done it. And it is pretty crappy... Olli -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Chat with php
Oliver-- I'm afraid I wasn't too clear! If you do it the way I'm suggesting, your page will look like it's reloading ONLY when there is new data available, and not continuously. PHPChat is an example--it looks really good and doesn't do any of the annoying things that reloading the page usually does (like the stupid click click click in IE). Marco On Mon, 2002-10-07 at 14:25, Oliver Witt wrote: Brad Dameron schrieb: Another way is to use javascript with PHP to pull the database every so many seconds. I have seen this in I think it was PHPChat. Been a long time however. Well, that's pretty much how I've done it. And it is pretty crappy... Olli -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Chat with php
Marco Tabini schrieb: Simple trick (well, not so simple, but kind of a Columbus' Egg): 1) Create an img tag in your web page that is hidden 2) Point the img tag to a php script that returns: 1) An image with a pixel width of 1 if there is new data to pick up from the server 2) An image with a pixel width of 0 otherwise 3) Create a javascript that refreshes the image every second (or every two seconds, or however often you feel necessary--the more often, the more responsive and real time your chat system will be). 4) Add an OnLoad event to the img tag that points to a Javascript that checks the width of the newly reloaded image. If the width is one, then you reload your chat text content (which you may want to put in an iframe to avoid having to reload the whole page). I don't have a script to show unfortunately, as it would probably be too complicated and long for the list (and I have no time to write it...sigh), but hopefully, this will give you the gist of it. Cheers, Marco Okay, that sounds like something i can do, i just need to know how to hide and how to point the img tag at something. Olli -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [Fwd: Re: [PHP] Chat with php]
Marco Tabini schrieb: Ok, off the top of my head (please don't be upset if it doesn't work right off, because I'm doing this from memory): Web page: script language=javascript function checkimage() { if (document.all.image1.width == 1) { document.all.fr1.src=http://www.mysite.com/chat.php;; } } function reloadimg() { document.all.image1.src=http://www.mysite.com/img.php;; setInterval (reloadimg(), 2000); // every 2 secs } /script body iframe name=fr1 src=chat.php img style=display=none src=http://www.mysite.com/chat.php; onLoad=javascript:checkimage(); /body In chat.php you simply push out whatever is in the database (the whole thing--or you come up with some method of just printing out what has changed since the last poll, which is trivial and beyond the point here). In img.php: ? function checkdb() { // This returns true if new data is available } $filename = (checkdb() ? '1pixel.gif' : '2pixel.gif'); header (Content-type: image/gif); readfile ($filename); ? 1pixel.gif is a one-pixel wide image, while 2pixel.gif is two pixels wide (it just occurred to me that you can't have a zero-pixels wide image, which would be quite pointless). The script basically reads in either file and spits it out after setting the content type. Once more, this script, as is, probably won't work because it was programmed in my messy head rather than in a proper PHP environment, but it should give you an idea of what needs to be done. In particular, remember to use the display CSS attribute rather than visibility so that the image will not take up any space on your page. Also, an apology--I seem to have mailed some messages twice by mistake. I was checking e-mail between eating my lunch and trying to get a tie on and things might have gotten a bit out of hand ;-) Let me know how it turns out! Thanks, I will try that script as soon as I find some time, probably tomorrow. But it seems to do the same thing as reloading would do: clicking all the time. But I'll try it tomorrow. Kind regards, Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] chat with php
HI. Anyone have a chat with php? tks
Re: [PHP] chat with php
Edney Marcel Imm wrote: HI. Anyone have a chat with php? tks ME: Hello PHP PHP: Hello M: How are you? P: Tell me more about you. M: I'm just a guy living in Michigan P: Are you sure? M: Yes P: How does that make you feel? M: I dunno... Sorry - I couldn't resist. Visions of old ELIZA popped into my head when I read your question. There's a list of some chat software at http://www.zend.com/search_app.php?key=chatCID=9 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Chat with PHP and MySQL - come and chat about Linux problems...
The problem I have it's an entire story. First of all, I will tell you that knows a little more about Linux. I created a chat software with couple php scripts. The chat it's using MySQL. I think the chat software is good (not the best one) but first of all is easier to use than what I saw on the net. I still have to do couple major improvments to make, that it will make, definitelly the best chat ever written in php and mysql. I'm so proud about this chat because till now I tested a lot of chat's written in php but not even one is like the one I written. The main problem I have with my chat is that after some use of it, the server is going very very slowly. Someone with (256Mb, 800Mhz and just my chat running (Linux also)) told me that the chat is still doing this stuff. The problem he told me about it, it's that the httpd (apache) connections don't close. I intend to make this chat free like a bird, and also to be improved by anyone, anyhow but first of all I need to change my chat to work more than 2 days :o). Can you put my chat on your server and tell me what exactly it's not working correctly ? I attached the rar archive. I would like to anyone who will take 30 min. from his time and test my chat, and also I will promise him that I will give every version of it if he will help with his PRECIOUS advice.. :-) PS: in the tables.txt you have the structure of tables. In chat_intern you have to set-up the database name, server etc. (In the future I will create a setup.oho with all the setup infos) Yours, Marian Vasile IT Manager Schnecker van Wyk Pearson www.investments.ro chat.rar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]