= 2){$country=$temp[2];} if($numitems >= 3){$county=$temp[3];} if($numitems == 4){$town=$temp[4];} $category = urldecode($category); $country = urldecode($country); $county = urldecode($county); $town = urldecode($town); if($country=="northern-ireland"){$country="n.ireland";} //proper case the necessary variables $pcategory=ucwords($category); $pcountry=ucwords($country); if($pcountry=="N.ireland"){$pcountry="N.Ireland";} $pcounty=ucwords($county); $ptown=ucwords($town); //get the category code switch($category){ case "bed and breakfast": $accommtype="BB"; break; case "campsites": $accommtype="CS"; break; case "caravan parks": $accommtype="CP"; break; case "farm holidays": $accommtype="FH"; break; case "guest houses": $accommtype="GH"; break; case "holiday cottages": $accommtype="HC"; break; case "holiday parks": $accommtype="HP"; break; case "hostels": $accommtype="HS"; break; case "hotels": $accommtype="HO"; break; case "self catering": $accommtype="SC"; break; } //connect to the database and select the database $link=connect_select_db($hostName,$databaseName,$userName,$password); ############################################################################################################ if($town != ""){ //compile the sql query $qry = " SELECT id,name,address1,address2,address3,town,county,postcode,country,phone,emailaddress,showemail,url,accommtypes,description"; $qry .= " FROM $ukdirectory"; $qry .= " WHERE accommtypes LIKE '%$accommtype%'"; if($country != ""){$qry .= " AND country LIKE '$country'";} if($county != ""){$qry .= " AND county LIKE '$county'";} if($town != ""){$qry .= " AND town LIKE '$town'";} $qry .= " AND status = ''"; $qry .= " ORDER BY priority ASC, name ASC"; //execute the query if(!($results = mysql_query($qry, $link))){ displayErrMsg(sprintf("Error in executing %s query", $qry)); displayErrMsg(sprintf("error:%d %s", mysql_errno($link), mysql_error($link))); exit(); } $numresults = mysql_num_rows($results); $listings = ""; if($numresults > 0){ $listings = "\n"; $listings .= "\n"; $listings .= "\n"; $listings .= "\n"; $listings .= "\n"; while($row = mysql_fetch_object($results)){ $listings .= "\n"; $listings .= "\n"; # buttons $listings .= "\n"; } $listings .= "
 \n"; $rslts="results"; if($numresults == 1){$rslts="result";} $listings .= "$numresults $rslts found for $category in "; if($town != ""){ $listings .= "$ptown"; if($county != ""){$listings .= ", ";} } if($county != ""){ $listings .= "$pcounty"; if($country != ""){$listings .= ", ";} } if($country != ""){ $listings .= "$pcountry"; } $listings .= "\n"; $listings .= "
"; $listings .= "
"; #name line if($row->url != ""){ $listings .= "$row->name"; }else{ $listings .= "$row->name"; } # address line $address=""; if($row->address1 != ""){ $address .= "$row->address1"; } if($row->address2 != ""){ if($address != ""){$address .= ", ";} $address .= "$row->address2"; } if($row->address3 != ""){ if($address != ""){$address .= ", ";} $address .= "$row->address3"; } if($row->town != ""){ if($address != ""){$address .= ", ";} $address .= "$row->town"; } if(($row->county != "") && ($row->county != $row->town)){ if($address != ""){$address .= ", ";} $address .= "$row->county"; } if($row->postcode != ""){ if($address != ""){$address .= ", ";} $address .= "$row->postcode"; } if($row->country != ""){ if($address != ""){$address .= ", ";} $address .= "$row->country"; } if($address != ""){ $listings .= "
$address\n"; } # phone and email line if($row->phone != ""){ $listings .= "
Phone: $row->phone\n"; } if(($row->emailaddress != "") && ($row->showemail == "y")){ $listings .= "   [ email this accommodation ]\n"; } #description if($row->description != ""){ $listings .= "
$row->description\n"; } if($_SERVER["REMOTE_ADDR"]==$adminip){ $referrer = $_SERVER['HTTP_REFERER']; $referrer=urlencode($referrer); $listings .= "
[ edit  • \n"; $listings .= " put in unreviewed  • \n"; $listings .= " delete ]\n"; } $listings .= "
\n"; # for future $listings .= "
\n"; } //free the memory associated with $results mysql_free_result($results); } //prepare the strings for substitution ------------------------------------------------------- # title $title="$pcategory :"; #if($country != ""){$title .= " $pcountry";} #if($county != ""){$title .= " > $pcounty";} #if($town != ""){$title .= " > $ptown";} if($town != ""){$title .= " $ptown, ";} if($county != ""){$title .= " $pcounty, ";} if($country != ""){$title .= " $pcountry. ";} $title .= "( For The Good Times directory )"; # description $description="$pcategory in"; if($town != ""){$description .= " $ptown";} if($county != ""){$description .= " $pcounty";} if($country != ""){$description .= " $pcountry";} # keywords $keywords="$category"; if($town != ""){$keywords .= " $town";} if($county != ""){$keywords .= " $county";} if($country != ""){$keywords .= " $country";} if($category=="bed and breakfast"){ $keywords .= ", b&b, bed & breakfast"; }else if($category=="guest houses"){ $keywords .= ", guesthouses"; }else if($category=="campsites"){ $keywords .= ", camp sites"; }else if($category=="caravan parks"){ $keywords .= ", caravan sites"; }else if($category=="farm holidays"){ $keywords .= ", farms"; }else if($category=="holiday cottages"){ $keywords .= ", cottage holidays"; } $keywords .= ", uk accommodation directory, uk holiday accommodation"; # alt text $alt="$pcategory in"; if($town != ""){$alt .= " $ptown";} if($county != ""){$alt .= " $pcounty";} if($country != ""){$alt .= " $pcountry";} # bread crumb trail (path) if($country=="n.ireland"){ $urlcountry="northern-ireland"; }else{ $urlcountry="$country"; } $path="$pcategory:"; if($country != ""){ if($county != ""){ $path .= " $pcountry\n"; }else{ $path .= " > $pcountry\n"; } } if($county != ""){ if($town != ""){ $path .= " > $pcounty\n"; }else{ $path .= " > $pcounty\n"; } } if($town != ""){ $path .= " > $ptown\n"; } # make alternative types of accommodation links if($town != ""){ $subcategories = make_town_subcats($country,$pcountry,$county,$pcounty,$town,$ptown,$ukdirectory,$link,$category,$accommtype); $temp=split("~",$subcategories); $subcategories=$temp[0]; $altaccomcats=$temp[1]; }else if($county != ""){ $subcategories = make_county_subcats($country,$pcountry,$county,$pcounty,$ukdirectory,$link,$category,$accommtype); $temp=split("~",$subcategories); $subcategories=$temp[0]; $altaccomcats=$temp[1]; }else if($country != ""){ $subcategories = make_country_subcats($country,$pcountry,$ukdirectory,$link,$category,$accommtype); $temp=split("~",$subcategories); $subcategories=$temp[0]; $altaccomcats=$temp[1]; } // send the response page send_page($overallwidth,$indentedwidth,$deepcolor,$linecolor,$barcolor,$title,$description,$keywords,$subcategories,$listings,$altaccomcats,$alt,$path,$header,$footer,$totallistings,$query,$link,$ukdirectory,$searchtype,$type); ?>