This simple PHP script displays html pages,
lets say that I have 10 html pages, from 1 to 10.
Now this script would displays those pages from 1 to 10 (ascending)
but I want it to display them from 10 to 1 (descending)
What should I change in this code to make it display pages descending???
---------------------------------------------------
<?php
$PAGE_START=0;
$PAGE_END=10;
$PAGES_PER_DAY=10;
$PAGE='./{num}.shtml';
$ITEMS_PER_PAGE=10;
$TEST_MODE=0; // (set between 1 and 999, or 0 for no test mode)
$p=intval($_GET['p']);
if($p>$PAGES_PER_DAY)
die("Error");
$day=round(time()/86400);
if($TEST_MODE)
$day=$TEST_MODE;
$d=($day%$PAGE_END);
$start=$d+($p-1)*$ITEMS_PER_PAGE+$PAGE_START;
$end=$start+$ITEMS_PER_PAGE;
for($i=$start;$i<$end;$i++)
{
$page=str_replace('{num}',sprintf("haha3d",x($i)), $PAGE);
if(file_exists($page))
include($page);
}
function x($z)
{
global $PAGE_END;
if($z>$PAGE_END)
while($z>$PAGE_END)
$z=$z-$PAGE_END;
return $z;
}
?>
-------------------------------------------------
