Guestbook Question

liunx

Guest
I am asking this for my friend. he has a guestbook on his site where each entry is saved as an .html file. He wants to know how he can delete the last 5 lines of entry that is made. We found a script that deletes a particular line, and i was wondering if we could do it by somehow subtracting a number of lines from the feof. do you guys know how to do this?you could do soemthing like

$file = file("filename.html"); //split it into an array by each line
for ($num = 1; $num <= 5; $num++) {
$file[ count($file) - $num ] = "";
}

then write the info back to the file

theres probably a better way, i jsut cant think of anything else at the moment :Pit would all depend on what is in that html file. is it just text? or html tags as well?it is just textthan not sure why it i s called a .html file then. .txt files are best for that. so, n8thegreat code will work just fine.ra..ra..XML..ra..ra..XML (sorry)okay then, thanks. btw, shouldnt they add an XHTML and XML section to the forum?
 
Back
Top