Reply to Re: News script in flat file

Your name:

Reply:


Posted by samudasu on 02/19/06 11:20

This code will delete your messages. It's coded for php5. If you're
running php4 then you'll have to substitute fopen, fwrite, and fclose
for file_put_contents.

shownews.php..........
<?php
$data = file('news.txt');
foreach ($data as $key => $value) {
print "$value: <a href=\"delnews.php?del=$key\">delete</a><br
/>\n";
}
?>

delnews.php.............
<?php
$file = 'news.txt';
$data = file($file);
unset($data[$_GET['del']]);
print "<pre>";
print_r($data);
print "</pre>";
file_put_contents($file, $data);
?>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация