| 1 | <?php
 | 
  
    | 2 | 
 | 
  
    | 3 | // Include config file
 | 
  
    | 4 | require_once('config.php');
 | 
  
    | 5 | 
 | 
  
    | 6 | // Check if specific page requested
 | 
  
    | 7 | if(isset($_GET['page'])) {
 | 
  
    | 8 | 	// Page link
 | 
  
    | 9 | 	$page_link = addslashes($_GET['page']);
 | 
  
    | 10 | 	// Query database
 | 
  
    | 11 | 	$sql = "SELECT * FROM pages WHERE link = '/".$page_link."'";
 | 
  
    | 12 | 	$query = $database->query($sql);
 | 
  
    | 13 | 	// Check for errors
 | 
  
    | 14 | 	if($database->is_error()) {
 | 
  
    | 15 | 		// Print error
 | 
  
    | 16 | 		die($database->get_error());
 | 
  
    | 17 | 	} elseif($query->numRows() > 0) {
 | 
  
    | 18 | 		// Get page id
 | 
  
    | 19 | 		$page = $query->fetchRow();
 | 
  
    | 20 | 		$page_id = $page['page_id'];
 | 
  
    | 21 | 		unset($page);
 | 
  
    | 22 | 		// Include main script
 | 
  
    | 23 | 		require_once('index.php');
 | 
  
    | 24 | 	}
 | 
  
    | 25 | }
 | 
  
    | 26 | 
 | 
  
    | 27 | ?>
 |