![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Industry Role:
Join Date: Jan 2004
Posts: 2,169
|
PHP gurus PLEASE help! (woj where are u? :-)
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; } ?> ------------------------------------------------- ![]()
__________________
Fuck it dude, lets go bowling ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Registered User
Join Date: Jan 2005
Posts: 34
|
This line should be changed:
for($i=$start;$i<$end;$i++) Something like: for($i=$end;$<$end;$i--) You should test it etcetera.. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: Jun 2002
Location: Seattle
Posts: 1,062
|
Code:
for($i=$end;$i>=$start;$i--) |
![]() |
![]() ![]() ![]() ![]() ![]() |