file() function

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: file() function
Groups: php.general 
Request: Send a blank email to php-general+get-42515@lists.php.net to get a copy of this message
I found this script on the internet...It's a script of a message board...My problem is that I just want to display the 30 newer messages stead of all messages...What do I have to change??? I tried to use the file() function...I know it's possible to do what I want to with that function, but I don't know how. Please, help me!!!!! ............................................................... script: <? if ($message) { $message = strip_tags($message); $message = ereg_replace("\r\n\r\n", "\n<P>", $message); if (get_magic_quotes_gpc()) { $message = stripslashes($message); } $date = date("d/m/Y - h:i a"); $message = "<B>$user </B> -- $date<P> $message <BR><HR>\r\n"; // first read the file into a buffer, if it exists $textfile = basename($PHP_SELF) . ".comment"; if ($fp = @fopen ($textfile, "r")) // open without complaining { $oldmessages = @fread($fp,filesize($textfile)); @fclose(fp); } // now reopen the file in write mode, with the // pointer at the head of the file $fp = fopen ($textfile, "w"); fwrite ($fp, $message); fwrite ($fp, $oldmessages); // adding back the old messages fclose ($fp); } @readfile(basename(($PHP_SELF . ".comment"))); ?> ................................................................... Thank you Felipe Lopes MailBR - O e-mail do Brasil -- http://www.mailbr.com.br Faça já o seu. É gratuito!!!

« previous php.general (#42515) next »