templatedir/header.php"); /* Determine the parameters for the pagenav() function */ if(!isset($_REQUEST['limit'])) { setdefault($limit, 12); } else { $limit = $_REQUEST['limit']; } $columns = 4; $numpage=ceil($resultsnumber/$limit); if(!isset($_REQUEST['offset'])) { setdefault($offset, 0); } elseif(isset($_REQUEST['offset']) && isset($_REQUEST['gotopage'])) { if(!ereg("^[0-9]+$",$_REQUEST['offset'])) { $_REQUEST['offset'] = 1;} //Must be an integer if($_REQUEST['offset'] > $numpage) { $_REQUEST['offset'] = $numpage;} //Must be inferior or equal to page number if($_REQUEST['offset'] <= 0) { $_REQUEST['offset'] = 1;} //Must be sup to 0 $offset = ($_REQUEST['offset'] * $limit) - $limit; } elseif(isset($_REQUEST['offset']) && !isset($_REQUEST['gotopage'])) { $offset = $_REQUEST['offset']; } /* Run the query */ $new_products = mysql_query("SELECT id, picture, description, price_range FROM products WHERE on_special='1' LIMIT ".$offset.",".$limit); $num_new_pics = mysql_num_rows($new_products); if(!$new_products) { echo("

Un problème de serveur est survenu. Veuillez nous en excuser.
Error: " . mysql_error()); exit(); } $real_url = $_SERVER['PHP_SELF'] . "?PHPSESSID=".session_id(); $where = ''; //Feel lazy, dont wanna rework the pagenav function /* Include template */ include("templates/new_pics.php"); /* Include footer */ include("$CFG->templatedir/footer.php"); /* For the stats */ $nom_page = "NEW"; require("../visiteur.php"); /********************************************************* * FUNCTIONS * *********************************************************/ /* The pagenav functions enables to limit the number of search results per page * and to display the results on several pages */ /* function pagenav($limit,$numpage,$where,$real_url,$offset,$photosud) { if ($where) { $safewhere=urlencode($where); } echo ""; //Display previous page button if needed if ($offset>=$limit) { $newoff=$offset-$limit; echo(""); } else { echo(""); } //If amount of pages <=10, display all page numbers if($numpage <= 10) { for ($i=1;$i<=$numpage;$i++) { if ((($i-1)*$limit)==$offset) { print ""; } else { $newoff=($i-1)*$limit; echo ""; } } //If amount of pages >10, display first 5 and last 5 page numbers } else { for ($i=1;$i<=5;$i++) { if ((($i-1)*$limit)==$offset) { print ""; } else { $newoff=($i-1)*$limit; echo ""; } } echo ""; for($j=($numpage-4);$j<=$numpage;$j++) { if ((($j-1)*$limit)==$offset) { print ""; } else { $newoff=($j-1)*$limit; echo ""; } } } //echo ""; //Display next page button if needed if ($offset!=$limit*($numpage-1)) { $newoff=$offset+$limit; echo(""); } else { echo(""); } echo "
"); echo("\"Page "); echo("  $i $i $i $i  ...  $j $j    \"Page  "); echo(" 
"; } */ ?>