#
|
#
include("left_side.php"); ?>
#
|
#
#

#
#
#
 |
#
|
#
 |
#
#
#
#
#
 |
#
#
#
$db_data['all_entries'] = mysql_query("SELECT * FROM $db_accom ORDER BY rating, title;");
#
$db_data['categories'] = array();
#
for ($x = 0; $x < mysql_numrows($db_data['all_entries']); $x++)
#
if (!in_array(mysql_result($db_data['all_entries'], $x, "title"), $db_data['categories'])) $db_data['categories'][] = mysql_result($db_data['all_entries'], $x, "title");
#
$found = 0;
#
$os_data['maxresults']=500;
#
$os_data['maxhits']=20;
#
$cats = $c;
#
$is_query=$c . " " . $term;
#
$allKeys = preg_replace("/(^\s+|\s+$)/", "", $is_query);
#
$stht = (int)($s - 1) * $os_data['maxhits'];
#
if ($allKeys != "" || $c != "") {
#
$keys = explode(" ", strtolower($allKeys));
#
if ($cats == "" or count($db_data['categories']) < 2) $cats = "All";
#
$pnts = array();
#
for ($z = 0; $z < mysql_numrows($db_data['all_entries']); $z++) $pnts[$z] = array($z, 0);
#
for ($x = 0; $x < count($keys); $x++) {
#
for ($y = 0; $y < mysql_numrows($db_data['all_entries']); $y++) {
#
if ($allKeys == ""){
#
if (strpos(mysql_result($db_data['all_entries'], $y, "category"), $cats) !== false) $pnts[$y][1] += 1;
#
if (mysql_result($db_data['all_entries'], $y, "title") == "") $pnts[$y][1] -= 1;
#
}
#
elseif ($cats == "All" || $cats == mysql_result($db_data['all_entries'], $y, "title")) {
#
if (mysql_result($db_data['all_entries'], $y, "title") == "") $pnts[$y][1] -= 1;
#
if (strpos(mysql_result($db_data['all_entries'], $y, "title"), $cats) !== false) $pnts[$y][1] += 1;
#
if (strpos(strtolower(mysql_result($db_data['all_entries'], $y, "title")), $keys[$x]) !== false) $pnts[$y][1] += 2;
#
if (strpos(strtolower(mysql_result($db_data['all_entries'], $y, "hometxt")), $keys[$x]) !== false) $pnts[$y][1] += 1;
#
if (strpos(strtolower(mysql_result($db_data['all_entries'], $y, "category")), $keys[$x]) !== false) $pnts[$y][1] += 1;
#
if (strpos(strtolower(mysql_result($db_data['all_entries'], $y, "contactname")), $keys[$x]) !== false) $pnts[$y][1] += .5;
#
if (strpos(strtolower(mysql_result($db_data['all_entries'], $y, "contactemail")), $keys[$x]) !== false) $pnts[$y][1] += .5;
#
if (strpos(strtolower(mysql_result($db_data['all_entries'], $y, "contactstreet")), $keys[$x]) !== false) $pnts[$y][1] += .5;
#
if (strpos(strtolower(mysql_result($db_data['all_entries'], $y, "contactsuburb")), $keys[$x]) !== false) $pnts[$y][1] += 1.5;
#
if (strpos(strtolower(mysql_result($db_data['all_entries'], $y, "contactcity")), $keys[$x]) !== false) $pnts[$y][1] += 1.5;
#
if (strpos(strtolower(mysql_result($db_data['all_entries'], $y, "type")), $keys[$x]) !== false) $pnts[$y][1] += 1.5;
#
if (strpos(strtolower(mysql_result($db_data['all_entries'], $y, "food")), $keys[$x]) !== false) $pnts[$y][1] += .5;
#
if (strpos(strtolower(mysql_result($db_data['all_entries'], $y, "price1")), $keys[$x]) !== false) $pnts[$y][1] += .5;
#
if (strpos(strtolower(mysql_result($db_data['all_entries'], $y, "price2")), $keys[$x]) !== false) $pnts[$y][1] += .5;
#
}
#
}
#
}
#
for ($z = 0; $z < count($pnts); $z++) {
#
for ($a = $z + 1; $a < count($pnts); $a++) {
#
if ($pnts[$a][1] > $pnts[$z][1]) {
#
$dummy = $pnts[$a];
#
$pnts[$a] = $pnts[$z];
#
$pnts[$z] = $dummy;
#
}
#
}
#
}
#
if($cats=="All") $cats="";
#
$holdCount = count($pnts);
#
for ($z = 0; $z < $holdCount; $z++) if ($pnts[$z][1] < $pnts[0][1] / 4 or $pnts[$z][1] == 0 or $z >= $os_data['maxresults']) unset($pnts[$z]);
#
$found = count($pnts);
#
if ($stht > count($pnts) or $stht < 0) $stht = 0;
#
$edht = (count($pnts) < $stht + $os_data['maxhits']) ? count($pnts) : $stht + $os_data['maxhits'];
#
?>
#
Found Accomodation Establishment(s) if($term){ ?>which matched : " echo $term; ?>" } if($c){?>in category " echo $c; ?>" } ?>
#
if($c=="indian ocean cruises"){ echo "
DOWNLOAD BROCURE AND PRICE LIST\n"; } ?>
#
#
if($c=="tours"){ ?>
#
| Name | Location | Rating | Type | Duration | Dates |
#
}else{ ?>
#
| Name | Location | Rating | Type | Rooms | Conference | Catering | In Season Rate | Out Season Rate |
#
} ?>
#
#
for ($z = $stht; $z < $edht; $z++) {
#
?>
#
#
#
| " class="blue_link" target="_blank"> |
#
|
#
|
#
|
#
if($c!="tours"){ ?>
#
|
#
|
#
} ?>
#
|
#
|
#
if($c!="tours"){ ?>
#
|
#
} ?>
#
#
#
#
}
#
}
#
if (count($pnts) > $os_data['maxhits']) {
#
$newQstr = "?do=search&term=".str_replace(" ", "+", $allKeys)."&c=".$cats."&s="; ?>
#
#
Show page:
#
#
if ($stht != 0) {
#
?>
#
< Previous
#
#
}
#
for ($z = 0; $z < count($pnts) / $os_data['maxhits']; $z++) {
#
if ((int)($stht / $os_data['maxhits']) != $z) {
#
?>
#
#
#
}
#
else echo ($z + 1);
#
}
#
if ($stht / $os_data['maxhits'] + 1 < $z) {
#
?>
#
Next >
#
#
}
#
?>
#
|
#
#
}
#
?>
#
#
|
#
|
#
#
#
#
#
|
#
|
#
#
#
include("http://www.kznsearch.co.za/footer.php"); ?>
#