Quote:
Originally Posted by roly
yes that's the sort of thing.
|
links.txt
Code:
http://www.bing.com|very unpopular search engine
http://www.google.com|search engine
http://www.gfy.com|gfy forum
to show the links
Code:
<?
$show = 30;
$linkfile = dirname(__FILE__). "/links.txt";
$links = file($linkfile);
$result = array();
for ($i=0; (($i<$show) && ($i<count($links))); $i++) {
$link = explode("|", $links[$i]);
$result[] = '<a href="' . $link[0] . '">' . $link[1] . '</a><br/>';
echo $result[$i];
}
?>
script to run in crontab once every 24 hours
Code:
<?
$linkfile = dirname(__FILE__). "/links.txt";
$tmp = file($linkfile);
$result = array();
$result[] = trim($tmp[(count($tmp)-1)]);
unset($tmp[(count($tmp)-1)]);
foreach ($tmp as $idx => $t) {
$result[] = trim($t);
}
$s = implode("\n", $result);
$fp = fopen($linkfile, "w+");
fwrite($fp, $s);
fclose($fp);
?>