require("../includes/config.inc.php");
function PageName($id) {
while(strlen($id) < 3) {
$id = "0" . $id;
}
$pagename = $id . ".htm";
return $pagename;
}
$dir = "./attractions/".$_GET['main']."/".$_GET['subcat']."/";
$res4 = mysql_query("SELECT * FROM Categories WHERE DirName = '".mysql_real_escape_string($_GET['main'])."' AND Type = 'Main'");
$rij4 = mysql_fetch_object($res4);
$main_name = $rij4->Name;
$main_id = $rij4->CategoryID;
$res3 = mysql_query("SELECT * FROM Categories WHERE DirName = '".mysql_real_escape_string($_GET['subcat'])."' AND Type = 'SubCat' AND CategoryLink = '$main_id'");
$rij3 = mysql_fetch_object($res3);
$subcat_name = $rij3->Name;
$link_id = $rij3->CategoryID;
$title = "$subcat_name";
$titlelinks = "$main_name";
if($subcat_name == "" && $_GET['main'] != "") {
header("Location: http://www.attractionsindex.com/attractions/".$_GET['main']);
exit;
}
if($id == "") {
$id = 1;
}
$start = ($id - 1) * 10;
$res5 = mysql_query("SELECT * FROM Objects WHERE CategoryLink = '$link_id' ORDER BY AVRrate DESC LIMIT $start, 10");
$ant5 = mysql_num_rows($res5);
$res2 = mysql_query("SELECT * FROM Objects WHERE CategoryLink = '$link_id' ORDER BY AVRrate DESC");
$ant2 = mysql_num_rows($res2);
$content = "";
if($ant5 == 0) {
$content = "No attractions available yet.";
}
else {
if($ant5 == 10) {
$end = $start + 10;
}
else {
$end = $start + $ant5;
}
$start = $start + 1;
$thispage = ($id + 1) - 1;
$firstpage = 1;
$lastpage = ceil($ant2 / 10);
$prevpage = $thispage - 1;
$nextpage = $thispage + 1;
if($lastpage == 1) {
$content = $ant2 . " attraction(s) found, showing results " . $start . " - " . $end . "
";
}
else {
if($prevpage > 0) {
$toev1 = "$prevpage ";
}
else {
$toev1 = "";
}
if($nextpage < $lastpage OR $nextpage == $lastpage) {
$toev2 = "$nextpage ";
}
else {
$toev2 = "";
}
if($thispage == $firstpage) {
$pag = "$thispage $toev2►";
}
if($thispage == $lastpage) {
$pag = "◄ $toev1$thispage";
}
if($thispage != $firstpage && $thispage != $lastpage) {
$pag = "◄ $toev1$thispage $toev2►";
}
$content = $ant2 . " attraction(s) found, showing results " . $start . " - " . $end . "