I have a chat script that I downloaded and according to the license I
can modify it as much as I want, and I'm a little stuck on a simple
modification I want to make. When you type in a message it stores in in
a file called text.php and then the chat page does an include call for
the text.php file. Currently, the writer of this script has it setup so
all new text added is placed at the begining of the file using the "w+"
command, according to php.net with fopen if I switch the "w+" to "a+" it
shoudl place the new data at the end of the file. However, when I make
this switch, the data is still being placed at the begining of the
text.php file. I've including the portion of the script that writes to
text.php can someone help me find what I'm not seeing?
$filename = "text.php";
$fileAr= file($filename);
exec("cat /dev/null > '$filename'");
$fd = fopen( $filename, "w+" );
$filemessage = "<a
href=\"javascript:launcher('profile.php?username=$username');\"><B>$username</B></a>:
";
$filemessage .="<font color=\"$fcolor\">$chat</font><BR>\n";
fputs($fd,$filemessage);
$numLines = 20;
for ($i=0;$i<$numLines;$i++) {
fputs($fd,$fileAr[$i]);
}
fclose( $fd );
TIA!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php