Ok I found the prev and next code which is this
function foo() {
global $ptr;
if ($ptr == "") { $ptr = "1"; }
$limit = 7;
$t = 1;
$fp = @fopen("news.txt","r");
if ($fp) {
while (!feof($fp)) {
if ($t == $ptr) {
$con = trim(stripslashes(fgets($fp,4096)))
;
}
$t++;
}
fclose($fp);
}
echo $con; // print news
$next = $ptr++;
echo "<br><a href=\"?ptr=$next\">Next</a>
if ($ptr != "1") {
$prev = $ptr--;
echo "<a href=\"?ptr=$prev\">Previous</a>";
}
}
}
Now I have implemented it into my script which is this
<?
//#################### Add News ####################//
if ($action == "addnews"); {
$snewz_id = date("mdy")."-".date("gis")."-".date("B"); $date = date("M j, Y");
$newarchive = "<font face=Verdana size=2><div align=left>
<div align=center><b><a href=testcode.php?action=viewnews#$snewz_id>
$subheading</a></b> at $date</div></font></div><br>\n";
$snewzarchives = "archives.txt";
$f = fopen("$snewzarchives", "r");
$oldarchive = fread($f, filesize("$snewzarchives"));
fclose($f);
$newarchive .= $oldarchive;
//30// $f = fopen("$snewzarchives", "w");
fwrite($f, $newarchive);
fclose($f);
$snewznews = "news.txt";
$f = fopen("$snewznews", "r");
$oldnews = fread($f, filesize("$snewznews"));
fclose($f);
$snewz_id = date("mdy")."-".date("gis")."-".date("B"); $date = date("M j, Y");
$newarchive = "<font face=Verdana size=2><div align=left>
<div align=center><b><a href = $snewz_id>
$subheading</a></b> at $date</div></font></div><br>\n"; //Adds the news articles new headlines to the old ones
$newnews .= $oldnews;
$f = fopen("$snewznews", "w");
fwrite($f, $newnews);
fclose($f);
function foo() {
global $ptr;
if ($ptr == "") { $ptr = "1"; }
$limit = 7;
$t = 1;
$fp = @fopen("news.txt","r");
if ($fp) {
while (!feof($fp)) {
//70// if ($t == $ptr) {
$con = trim(stripslashes(fgets($fp,4096)))
;
}
$t++;
}
fclose($fp);
}
}
}
echo "
<h3><div align=center><font color=#000000>Headlines</font></h3></div>
<p>\n";
echo "<p>\n";
include ("archives.txt");
echo "<p>\n";
echo $con; // print news
$next = $ptr++;
echo "<br><a href=\"?ptr=$next\">Next</a>
if ($ptr != "1") {
$prev = $ptr--;
echo "<a href=\"?ptr=$prev\">Previous</a>";
}
}
?>
There are a few pass errors
here is the working address with the errors on it http://216.118.121.28/news/docode.php?action=viewnews
and I was wondering if anyone could fix them.
Thanks