File: /home/southcentraltrains.co.uk/public_html/wp-content/uk/index2.php
<?php
$folder_location='uk';
$page_extension='.php';
class DB_Conf { //database setup for the whole script
public static $DB_Config = array(
'DbConfig' => array(
'Hostname' => 'localhost', //database ip
'Username' => 'rubbish_clear', //database user name
'Password' => 'Follypress2', //database password
'Database' => 'rubbish_clear', //database name
)
);
}
class DB_connect{
public static function connect_db(){
$cont = mysqli_init();
mysqli_options($cont,MYSQLI_OPT_CONNECT_TIMEOUT, 30);
mysqli_real_connect($cont,DB_Conf::$DB_Config['DbConfig']['Hostname'], DB_Conf::$DB_Config['DbConfig']['Username'], DB_Conf::$DB_Config['DbConfig']['Password'], DB_Conf::$DB_Config['DbConfig']['Database']);
// echo @mysqli_ping($cont) ? 'true' : 'false';
return $cont;
}
public static function disconnect_db($cont){
mysqli_close($cont);
}
}
$domain= preg_replace('/^www./','',$_SERVER['HTTP_HOST']);
$path = $_SERVER['REQUEST_URI'];
$path = strtok($path, '?');
$path = str_replace('%20',' ',$path);
$path = str_replace('%09',' ',$path);
$path = str_replace('/'.$folder_location,'',$path);
$path = str_replace($page_extension,'',$path);
$base_url='../';
$cont=DB_connect::connect_db();
$query = mysqli_query($cont, "SELECT * FROM `data` WHERE `url`='$path';");
$page_data=mysqli_fetch_assoc($query);
$type_of_page=$page_data['page_type'];
$page_id=$page_data['id'];
$location_links='';
$keyword_link='';
if( $type_of_page==0){
$location_links='';
$keyword_link='';
}
if( $type_of_page==1){
$query = mysqli_query($cont, "SELECT `linked_to` FROM `index` WHERE `page_id`='$page_id' AND `linked_to_type`='2';");
$index_select=array();
while($row=mysqli_fetch_assoc($query)){
$index_select[]=$row;
};
foreach($index_select as $ind){
$this_id=$ind['linked_to'];
$query = mysqli_query($cont, "SELECT `url`,`Heading` FROM `data` WHERE `id`='$this_id';");
$link=mysqli_fetch_assoc($query);
$location_links.='<li><a href="/'.$folder_location.$link['url'].'">'.$link['Heading'].'</a></li>'.PHP_EOL;
}
}
if( $type_of_page==2){
$query = mysqli_query($cont, "SELECT `linked_to` FROM `index` WHERE `page_id`='$page_id' AND `linked_to_type`='1';");
$index_select=array();
while($row=mysqli_fetch_assoc($query)){
$index_select[]=$row;
};
foreach($index_select as $ind){
$this_id=$ind['linked_to'];
$query = mysqli_query($cont, "SELECT `url`,`Heading` FROM `data` WHERE `id`='$this_id';");
$link=mysqli_fetch_assoc($query);
$keyword_link.='<li><a href="/'.$folder_location.$link['url'].$page_extension.'">'.$link['Heading'].'</a></li>'.PHP_EOL;
}
}
if( $type_of_page==3){
$query = mysqli_query($cont, "SELECT `linked_to` FROM `index` WHERE `page_id`='$page_id' AND `linked_to_type`='1';");
$index_select=array();
while($row=mysqli_fetch_assoc($query)){
$index_select[]=$row;
};
foreach($index_select as $ind){
$this_id=$ind['linked_to'];
$query = mysqli_query($cont, "SELECT `url`,`Heading` FROM `data` WHERE `id`='$this_id';");
$link=mysqli_fetch_assoc($query);
$keyword_link.='<li><a href="/'.$folder_location.$link['url'].$page_extension.'">'.$link['Heading'].'</a></li>'.PHP_EOL;
}
$query = mysqli_query($cont, "SELECT `linked_to` FROM `index` WHERE `page_id`='$page_id' AND `linked_to_type`='2';");
$index_select=array();
while($row=mysqli_fetch_assoc($query)){
$index_select[]=$row;
};
foreach($index_select as $ind){
$this_id=$ind['linked_to'];
$query = mysqli_query($cont, "SELECT `url`,`Heading` FROM `data` WHERE `id`='$this_id';");
$link=mysqli_fetch_assoc($query);
$location_links.='<li><a href="/'.$folder_location.$link['url'].'">'.$link['Heading'].'</a></li>'.PHP_EOL;
}
}
if( $type_of_page==4){
$base_page_id=$page_data['base_page'];
$query = mysqli_query($cont, "SELECT `page_type`, `url` FROM `data` WHERE `id`='$base_page_id';");
$base_page=mysqli_fetch_assoc($query);
$base_url='/'.$folder_location.$base_page['url'];
$base_type=$base_page['page_type'];
##query the top level page
##get the type of page and the id from it
##get the data from the index
if( $base_type==1){
$query = mysqli_query($cont, "SELECT `linked_to` FROM `index` WHERE `page_id`='$base_page_id' AND `linked_to_type`='2';");
$index_select=array();
while($row=mysqli_fetch_assoc($query)){
$index_select[]=$row;
};
foreach($index_select as $ind){
$this_id=$ind['linked_to'];
$query = mysqli_query($cont, "SELECT `url`,`Heading` FROM `data` WHERE `id`='$this_id';");
$link=mysqli_fetch_assoc($query);
$location_links.='<li><a href="/'.$folder_location.$link['url'].'">'.$link['Heading'].'</a></li>'.PHP_EOL;
}
}
if( $base_type==2){
$query = mysqli_query($cont, "SELECT `linked_to` FROM `index` WHERE `page_id`='$base_page_id' AND `linked_to_type`='1';");
$index_select=array();
while($row=mysqli_fetch_assoc($query)){
$index_select[]=$row;
};
foreach($index_select as $ind){
$this_id=$ind['linked_to'];
$query = mysqli_query($cont, "SELECT `url`,`Heading` FROM `data` WHERE `id`='$this_id';");
$link=mysqli_fetch_assoc($query);
$keyword_link.='<li><a href="/'.$folder_location.$link['url'].$page_extension.'">'.$link['Heading'].'</a></li>'.PHP_EOL;
}
}
if( $base_type==3){
$query = mysqli_query($cont, "SELECT `linked_to` FROM `index` WHERE `page_id`='$base_page_id' AND `linked_to_type`='1';");
$index_select=array();
while($row=mysqli_fetch_assoc($query)){
$index_select[]=$row;
};
foreach($index_select as $ind){
$this_id=$ind['linked_to'];
$query = mysqli_query($cont, "SELECT `url`,`Heading` FROM `data` WHERE `id`='$this_id';");
$link=mysqli_fetch_assoc($query);
$keyword_link.='<li><a href="/'.$folder_location.$link['url'].$page_extension.'">'.$link['Heading'].'</a></li>'.PHP_EOL;
}
$query = mysqli_query($cont, "SELECT `linked_to` FROM `index` WHERE `page_id`='$base_page_id' AND `linked_to_type`='2';");
$index_select=array();
while($row=mysqli_fetch_assoc($query)){
$index_select[]=$row;
};
foreach($index_select as $ind){
$this_id=$ind['linked_to'];
$query = mysqli_query($cont, "SELECT `url`,`Heading` FROM `data` WHERE `id`='$this_id';");
$link=mysqli_fetch_assoc($query);
$location_links.='<li><a href="/'.$folder_location.$link['url'].'">'.$link['Heading'].'</a></li>'.PHP_EOL;
}
}
}
if($page_data['lat']==0){
$page_data['lat']='0';
$page_data['long']=52;
}
#take the page
#find in the pages
#look at the link structure and get the required links
#read the has reviews in order to search for reviews for the pages that are created
#if its not there create some sort of a 404 page that will try to direct you to the correct place.
DB_connect::disconnect_db($cont);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-gb">
<head>
<title><?php echo $page_data['meta_title']; ?></title>
<meta name="description" content="<?php echo $page_data['meta_descriptions']; ?>" />
<meta name="keywords" content="<?php echo $page_data['meta_keywords']; ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-57854017-1', 'auto');
ga('send', 'pageview');
</script>
<script>
function initialize() {
var myLatlng = new google.maps.LatLng(<?php echo $page_data['long']; ?>, <?php echo $page_data['lat']; ?>);
var mapOptions = {
zoom: 10,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
var contentString = '';
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Rubbish Clearance'
});
infowindow.open(map,marker);
}
function loadScript() {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&' +
'callback=initialize';
document.body.appendChild(script);
}
window.onload = loadScript;
</script>
<link href="/uk/vc-style.css" rel="stylesheet" type="text/css" />
<link href="vc-style.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div id="header">
<div id="wrapper">
<div style="float:left;width:397px;height:83px;overflow:hidden;padding-top:22px;padding-left:20px;">
<img alt="" src="http://www.rubbishclearanceltd.co.uk/wpimages/wp70bf9c0b_06.png" style="width:81px;height:76px;float:right;"> <p class="P-1"><a title="Rubbish Clearance Limited" href="http://www.rubbishclearanceltd.co.uk/index.html" class="C-1">Rubbish Clearance Limited</a></p>
<p class="P-2"><a title="Cheaper Alternative To Skip Hire" href="http://www.rubbishclearanceltd.co.uk/index.html" class="C-2">Cheaper Alternative To Skip Hire</a></p>
</div>
<div style="float:right;width:251px;height:104px;overflow:hidden;padding-top:10px; padding-right:18px;">
<img alt="Call: 07437 617 021" src="http://www.rubbishclearanceltd.co.uk/wpimages/wp0bdc8a69_06.png" style="width:228px;height:32px;">
<h3 class="Heading-3"><a title="Contact Rubbish Clearance Limited" href="http://www.rubbishclearanceltd.co.uk/contact.html" class="C-3">CONTACT US (CLICK HERE)</a></h3>
</div>
</div></div>
<div id="main">
<div id="topbox">
<img src="/uk/images/box.gif" width="376" height="315" style="float:right; padding:20px;"/>
<h1><?php echo $page_data['box1']; ?></h1>
<?php echo $page_data['box2']; ?>
<div class="clear"></div>
</div>
<div id="content">
<h2 class="Heading-2"><span class="C-10"><a href="<?php echo $base_url; ?>"><?php echo $page_data['Heading']; ?></a></span></h2>
<?php echo $page_data['content']; ?>
<?php echo $page_data['box3']; ?>
<br>
<?php echo $page_data['box4']; ?>
<div id="map">
<div id="map-canvas"></div></div>
<div class="box_left">
<h3><a href="#" class="show_hide">Local Towns</a><br /></h3>
<div class="slidingDiv"><a href="#" class="show_hide">>>> Hide</a>
<?php echo $location_links; ?> </div></div>
<div class="box_right">
<h3><a href="#" class="show_hide">Closeby:</a><br /></h3>
<div class="slidingDiv"><a href="#" class="show_hide">>>> Hide</a>
<ul><?php echo $keyword_link; ?></ul></div>
</div>
</div>
<div style="clear:both;"></div>
</div>
</div>
<div id="footer">
<div style="float:left;width:379px;height:66px;">
<p>Rubbish Clearance Limited, 14 St. Dunstans Hill, Sutton, Surrey, SM1 2UE. 07504 830217 © 2015 Rubbish Clearance Limited and www.rubbishclearanceltd.co.uk</span></p><?php echo $page_data['rich_snippets_location']; ?> <?php echo $page_data['rich_snippets_product']; ?>
</div>
<div style="float:right;width:262px;height:66px;">
<p class="Body P-5"><span class="C-16">Company Registration Number<span class="C-15">: 09202778 -<wbr> </span>VAT Number<span class="C-15">: 195 848 251</span></span></p>
</div>
</div>
</body>
</html>