\r\n";
mail('jim.rolt@googlemail.com', $subject, $error, $headers);
}
include'dataedit/sql.php';
//include'memcache.php';
if(intval($_GET['county']) > 0 && intval($_GET['county']) < 142){$county = intval($_GET['county']);}
else{
header("HTTP/1.1 404 Not Found");
header("Location: https://information-britain.co.uk/errordoc.php");
exit();
}
$town = !empty($_GET['town']) ? $_GET['town'] : 'Worcester';
$qtown = mysql_real_escape_string($_GET['town']);
$act = mysql_query("SELECT SQL_CACHE Activities.ID, Activities.Name, ActivityTypes.TYPE
FROM Activities
INNER JOIN ActivityTypes ON ActivityTypes.ID = Activities.TYPE
WHERE County = $county
AND Town = '$qtown'
Order by TYPE, Name ")or mailjim("act", mysql_error());
$shops = mysql_query("SELECT ID, Name, TYPE FROM Shops
WHERE county = $county
AND Town LIKE '".preg_replace("/[-\s]/", "_", $qtown)."'
AND TYPE NOT IN(1,29) ")or die('shops serror: '.mysql_error());
$ant = mysql_query("SELECT ID, Name, TYPE FROM Shops
WHERE county = $county
AND Town LIKE '".preg_replace("/[-\s]/", "_", $qtown)."'
AND TYPE = 1 ")or mailjim("ant", mysql_error());
$sql = "SELECT EstDetails.RecordID,
EstDetails.Name,
EstType,
EstTypeAlt,
EstType2,
EstType3,
Town,
EstDetails.description,
website,
EstDetails.email,
CountyName,
CountyNameCut,
CountyDetails.CountryID,
bcomregion,
reviews.id AS Rid,
Details.DPrice
FROM EstDetails
LEFT JOIN Details ON Details.RecordID = EstDetails.RecordID
INNER JOIN CountyDetails ON (County = CountyDetails.RecordID OR County2 = CountyDetails.RecordID)
LEFT JOIN reviews ON EstDetails.RecordID = reviews.est AND reviews.display = 1 AND reviews.type = 1
WHERE List = 1
AND EstDetails.County = $county
AND Town LIKE '".preg_replace("/[-\s]/", "_", $qtown)."'
AND( Esttype = 7
OR Esttype2 = 7
OR Esttype3 = 7
OR EsttypeAlt = 7)";
$poptemp = mysql_query($sql)or die("tmp insert error:
$sql\n".mysql_error());
if(mysql_num_rows($poptemp) == 0){
header("HTTP/1.1 404 Not Found");
header("Location: https://information-britain.co.uk/errordoc.php");
exit();
}
$details = array();
$chid = array();
$count = 0;
while($row = mysql_fetch_object($poptemp)){
if($count == 0){
$CountyName = $row->CountyName;
$CountyNameCut = $row->CountyNameCut;
$CountryID = $row->CountryID;
$bcomregion = $row->bcomregion;
}
$details['Budget'][$row->RecordID] = array('Name'=>$row->Name, 'Town'=>$row->Town, 'description'=>$row->description, 'website'=>$row->website, 'email'=>$row->email, 'Rid'=>$row->Rid, 'DPrice'=>$row->DPrice);
$count ++;
$chid[] = $row->RecordID;
}
//print_r($details);
$sql = "SELECT Towns.Description, brochure, brochurelink, telcode, Towns.postcode, population, gridref, council, jobs, clientpic, piclink, Towns.latitude, Towns.longitude, snippet, Towns.weather, EstDetails.Name, history FROM Towns
LEFT JOIN EstDetails ON EstDetails.RecordID = Towns.council
WHERE Towns.Name LIKE '".preg_replace("/[-\s]/", "_", $qtown)."' AND Towns.County = $county";
$tdetails = mysql_query($sql)or mailjim("towndetails", "$sql\n".mysql_error());
$towndetails = mysql_fetch_object($tdetails);
$sql = "SELECT COUNT(*) AS num
FROM EstDetails
INNER JOIN reviews ON reviews.est = EstDetails.RecordID AND reviews.display = 1
WHERE county = $county AND town LIKE '".preg_replace("/[-\s]/", "_", $qtown)."'";
$townreviews = mysql_query($sql)or mailjim("Townreviews", "$sql\n".mysql_error());
$townrev = mysql_fetch_object($townreviews);
$rev= mysql_query("SELECT countyreviews.id FROM countyreviews WHERE county = $county LIMIT 1");
if($count < 8){
$hotelids = array();
foreach($details as $a => $b){
foreach($b as $c => $d){
$hotelids[] = $c;
}
}
$hotelids = array_unique($hotelids);
$exclude = implode(',',$hotelids);
$sql = "SELECT EstDetails.RecordID,
EstDetails.Name,
Town,
EstDetails.description,
website,
EstDetails.email,
reviews.id AS Rid,
EstablishmentType.TYPE,
Details.DPrice,
SQRT( POW( 69.1 * ( latitude - $towndetails->latitude ) , 2 ) + POW( 69.1 * ( $towndetails->longitude - longitude ) * COS( latitude / 57.3 ) , 2 ) ) AS distance
FROM EstDetails
INNER JOIN EstablishmentType ON EstablishmentType.ID = EstType
LEFT JOIN reviews ON EstDetails.RecordID = reviews.est AND reviews.display = 1 AND reviews.type = 1
LEFT JOIN Details ON Details.RecordID = EstDetails.RecordID
WHERE latitude IS NOT NULL
AND EstType IN(1,2,4,5,7)
AND EstDetails.RecordID NOT IN($exclude)
AND List = 1
GROUP BY distance
ORDER BY distance ASC
LIMIT 10";
$others = mysql_query($sql)or die(mysql_error());
//$others = mysql_query_cache($sql);
//echo $sql;
}
echo <<Budget accommodation in $town. Online booking for cheap $town hotels, $CountyName
EOT;
?>
postcode)){
$wday = date("D");
$wdate = date("j M");
$xml = simplexml_load_string($towndetails->weather, 'SimpleXMLElement', LIBXML_NOCDATA);
echo <<
Click for 5 day $town Weather |
$wday $wdate |
Max {$xml->Forecast[0]->maxtemp}°C Min {$xml->Forecast[0]->mintemp}°C |
{$xml->Forecast[0]->day->windspeed_mph} mph |
|
Provided by Weather2 |
EOT;
}
if($county == 16){
echo'
London Tickets
';
}
include'yellowbcombox.php';
yellowbox($town,$bcomregion);
include'connect.php';
connect($county, $town);
/*
echo"
email page to a friend
\n";
*/
if(!empty($towndetails->telcode) || !empty($towndetails->postcode) || !empty($towndetails->population) || !empty($towndetails->gridref) || !empty($towndetails->council) || $townrev->num > 0){
echo"
Information";
if(isset($towndetails->brochure) && $towndetails->brochure == 1){
if(!empty($towndetails->brochurelink)){echo" | Free Brochure";}
else{echo" | Free Brochure";}
}
echo"
$town Map
\nCounty - $CountyName
\n";
if(!empty($towndetails->telcode)){echo"Tel code: $towndetails->telcode | code search
\n";}
if(!empty($towndetails->postcode)){echo"Postcode: $towndetails->postcode | code search
\n";}
if(!empty($towndetails->population)){echo"Population: $towndetails->population
\n";}
if(!empty($towndetails->gridref)){echo"Grid Reference: $towndetails->gridref
\n";}
if(!empty($towndetails->council)){
$pos = stripos($towndetails->Name, 'council');
$councilname = ($pos === false) ? $towndetails->Name : substr($towndetails->Name, 0, $pos);
echo"Council: $councilname
\n";}
if(!empty($towndetails->jobs)){echo"$town Jobs
\n";}
if(!empty($towndetails->tips)){echo"$town Travel Tips
\n";}
if($townrev->num > 0){echo"$town Reviews ($townrev->num)
\n";}
if(mysql_num_rows($rev) > 0){echo"Visitor reports
";}
if(!empty($towndetails->history)){echo"$town History
\n";}
if(!empty($towndetails->Description)){echo"$town townguide
\n";}
echo<<$town
Britains Favourite Town
EOT;
}
?>
1 ? 'places' : 'place';
echo"
Budget accommodation in $town - $count $places to stay
";
$join = '';
$estarray = array(
1 => array('hotel', 'Hotels'),
2 => array('bnb', 'Bed and Breakfast'),
15 => array('selfc', 'Holiday Parks'),
17 => array('selfc', 'Camping'),
19 => array('selfc', 'Caravan Parks')
);
if(empty($towndetails->snippet)){
if(!empty($towndetails->Description)){
echo"
Town Guide";
}
foreach($estarray as $key => $value){
if($key == 2 && in_array(1, $esorter[$town]) && in_array(2, $esorter[$town])){
echo " | {$value[1]}\n";
}
else{
echo in_array($key, $esorter[$town]) ? "| {$value[1]}\n" :
" | {$value[1]}";
}
}
if($county != 16){
echo" | Today's Best Rates\n";
}
}
else{
echo"
$towndetails->snippet.. \n";
if(!empty($towndetails->Description)){echo"Read More.
";}
$comma = '';
foreach($estarray as $key => $value){
if($key == 2 && in_array(1, $esorter[$town]) && in_array(2, $esorter[$town])){
echo " $comma {$value[1]}\n";
$comma = ',';
}
else{
echo in_array($key, $esorter[$town]) ? "$comma {$value[1]}\n" :
" $comma {$value[1]}";
$comma = ',';
}
}
if($county != 16){
echo" or you can find Today's Best Rates or get a LATE DEAL\n";
}
}
echo '
';
include'hotelsummarynew.php';
showplace('Budget');
if(mysql_num_rows($others) > 0){
//if(!empty($others)){
echo"
Other Places to Stay near $town
\n";
$details = array();
while($row = mysql_fetch_object($others)){
// foreach($others as $row){
$details['Hotel'][$row->RecordID] = array('Name'=>$row->Name, 'Town'=>$row->Town, 'description'=>$row->description, 'website'=>$row->website, 'email'=>$row->email, 'Rid'=>$row->Rid, 'DPrice'=>$row->DPrice, 'distance'=>sprintf("%01.2f", $row->distance));
}
foreach($details as $key =>$value){showplace($key);}
}
include'dailyfeature.php';
?>