array( 'Hostname' => 'localhost', //database ip 'Username' => 'lockaid1', //database user name 'Password' => 'follypress1', //database password 'Database' => 'lockaid', //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.='
  • '.$link['Heading'].'
  • '.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.='
  • '.$link['Heading'].'
  • '.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.='
  • '.$link['Heading'].'
  • '.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.='
  • '.$link['Heading'].'
  • '.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.='
  • '.$link['Heading'].'
  • '.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.='
  • '.$link['Heading'].'
  • '.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.='
  • '.$link['Heading'].'
  • '.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.='
  • '.$link['Heading'].'
  • '.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); ?> Lock Aid Locksmiths & Security | <? echo $page_data['meta_title']; ?>

     

    Other Services offered Locally

    Nearby