Ok, i struggled through...
The following code is working and tested!
You should be paying for this!!!
This is COMPLETE CODE.
change the $fileName to the name and path of your file. Then save this script as ignorelines.php or it wont work!
<?
if ($page==""){
$page=1;
}
//enter your filename (+ path if necessary) below
$fileName = "users.txt";
$file_pointer = fopen($fileName, "r");
$data = fread($file_pointer, filesize($fileName));
fclose($file_pointer);
$data = ereg_replace("\n", "#", $data);
$disp = ereg_replace("#", "<br>", $data);
$count=0;
$len=strlen($data);//get the length of the file in characters
for($i=0;$i<$len;$i++) {
$chrcheck=$data[$i];
if($chrcheck=="#") {
$count=($count+1);// $count is the number of LINES in the document
}
}
$count=$count+1;
$line=explode("#", $data);
$no = 0;
for($i=0;$i<$count;$i++) {
$echo = $line[$i];
$lenLine=strlen($line[$i]);
if($lenLine < 2) {
$lines=$i;
break;
}
else{
$detail[$no]=explode("|",$line[$i]);
$no = $no + 1;
}
}
$entriesPerPage = 5;
$to = ($page*$entriesPerPage);
$from = ($to - $entriesPerPage);
$from = $from + 1;
if($lines < $from){
echo"No More";
}
if($lines >= $from){
if($lines < $to) {
$to=($to-($to-$lines));
$to=$to+1;
for($i=$from;$i<$to;$i++) {
$j = $i - 1;
$name = $detail[$j][0];
$location = $detail[$j][1];
$comment = $detail[$j][2];
$mail = $detail[$j][3];
$site = $detail[$j][4];
$date = $detail[$j][5];
// THIS ECHO IS YOUR DISPLAY! MUST BE SAME AS BELOW
echo"Entry No. - ${i}<br>Name - ${name}<br>Location - ${location}<br>
Comment - ${comment}<br>E-Mail - ${mail}<br>Website - ${site}<br>
Date - ${date}<br><br>";
}
$prev = $page - 1;
if($prev > 0) {
echo"<a href='ignorelines.php?page=${prev}'>Previous</a> | Next";
}
else {
echo"Previous | Next";
}
}
}
if($lines >= $to){
$to=$from+5;
for($i=$from;$i<$to;$i++) {
$j = $i - 1;
$name = $detail[$j][0];
$location = $detail[$j][1];
$comment = $detail[$j][2];
$mail = $detail[$j][3];
$site = $detail[$j][4];
$date = $detail[$j][5];
// THIS ECHO IS YOUR DISPLAY! MUST BE SAME AS ABOVE
echo"Entry No. - ${i}<br>Name - ${name}<br>Location - ${location}<br>
Comment - ${comment}<br>E-Mail - ${mail}<br>Website - ${site}<br>
Date - ${date}<br><br>";
}
$prev = $page - 1;
$next = $page +1;
if($prev > 0) {
if($next <= $lines){
echo"<a href='ignorelines.php?page=${prev}'>Previous</a> | <a href='ignorelines.php?page=${next}'>Next</a>";
}
}
if($prev > 0){
$n = ($next*$entriesPerPage)-$entriesPerPage;
if($lines < $n) {
echo"<a href='ignorelines.php?page=${prev}'>Previous</a> | Next";
}
}
if($prev < 1){
$n = ($next*$entriesPerPage)-$entriesPerPage;
if($n < $lines) {
echo"Previous | <a href='ignorelines.php?page=${next}'>Next</a>";
}
}
if($prev < 1){
$n = ($next*$entriesPerPage)-$entriesPerPage;
if($n > $lines){
echo"Previous | Next";
}
}
}
?>
You have to give me a good Vote Now!
If you have any problems with this code mail me at skript_kiddie@hotmail.com.