Re: Problem with flush() on win machine
| From: | Toby Miller | Date: | Fri, 02 Feb 2001 15:36:37 +0000 |
| Subject: | Re: Problem with flush() on win machine | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-5349@lists.php.net to get a copy of this message | ||
Jonat,
I'm not sure what the flush problem could be, but you have an endless while
loop in your code. $trexxRulez never exits out. This shouldn't work in Linux
or Windows. Can you give us a URL where this is actually working?
Toby
----- Original Message -----
From: "Jonat Brander" <brander@onlineshop.ch>
To: <php-windows@lists.php.net>
Sent: Friday, February 02, 2001 6:16 AM
Subject: [PHP-WIN] Problem with flush() on win machine
> Hi,
>
> i have wrote a script that read a textfile and output the stuff via
> flush() on the browser (is for a chat).
>
> is works on linux php4, but on php4 for windows not correct. flush()
> are not work. can anyone help me?
>
> -------------------------------- code here.... -----------------------
>
> <?
> # Initialize
> $trexxRulez = true;
> $oldMaxLines = 0;
> $maxLines = 0;
> $firstLoop = true;
>
> # modify these values
> $fileLocation = "jobra.txt"; /* file location */
> $howMany = 5; /* how many messages on first loop */
> $autoScroll = false; /* set true/false to enable/disable
> Auto-Scroll */
> ?>
>
> <html>
> <head>
> <title>:: jobra.com : chat / content ::</title>
>
> <? if( $autoScroll ) { ?>
> <script language="javascript" type="text/javascript">
> <!--
>
> function scrollDown() {
> scrollBy(0,15);
> setTimeout( "scrollDown()", 20 );
> }
> //-->
> </script>
> <? } ?>
> </head>
>
> <body bgcolor="#211818" text="#808080" link="#00FF00"
> vlink="#008000"
> alink="#00FF00" topmargin="0" leftmargin="0"
> marginwith="0"
> marginheight="0" background="/designimages/backgrounds/content_bg.gif">
>
> <?
> # Activate Autoscroll?
> if( $autoScroll )
> print "<script> scrollDown(); </script>\n";
>
> # Loop 'til dooms-day
> while( $trexxRulez ) {
>
> # Read file & count of lines
> $chatData = file( $fileLocation );
> $maxLines = count( $chatData );
>
> # ERROR-Check
> if( !is_array( $chatData ) ) {
> print( "couldn't open required file. Abort... " );
> exit();
> }
>
> # display only $howMany Messages on first Loop
> if( $firstLoop ) {
> $firstLoop = false;
> if( ( $oldMaxLines = $maxLines - $howMany ) < 0 ) {
> $oldMaxLines = 0;
> }
> }
>
> # if there are new lines
> if( $maxLines > $oldMaxLines ) {
>
> $lineCount = 0;
> while( list( $key, $chatOutput ) = each( $chatData ) ) {
>
> # begin output if there is a new line
> if( $lineCount > $oldMaxLines ) {
> $chatOutput = str_replace( "Server:", " ", $chatOutput );
> $chatOutput = trim( str_replace( "Client:", '<b
> style="color:#ffffff;">Jobra um '.date("H:i:s")."
> Uhr:</b><br>",
> $chatOutput ) );
> print "$chatOutput<br><br>\n";
> flush();
> }
> $lineCount++;
> }
> $oldMaxLines = $maxLines;
> }
> sleep(2);
> }
> ?>
>
> -------------------------------- code here.... -----------------------
>
> what are the problem? have you a idea? is possibel, that must some stuff
> add in the php.ini?
>
> thnx & bye from switzerland
>
> --
> Jonat Brander
> mailto:brander@onlineshop.ch
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>