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:[EMAIL PROTECTED]
--
PHP Windows 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]