<?php
@session_start(); error_reporting(0); 
class DBController {
	private $host = "localhost";
	private $user = "root";
	private $password = "";
	private $database = "company";
	private $connection = "";
	
	function __construct() {
		$conn = $this->connectDB();
		$this->connection = $conn;
	}
	
	function connectDB() {
		$conn = mysqli_connect($this->host,$this->user,$this->password,$this->database);
		return $conn;
	}
	
	function runQuery($query) { $resultset;
		$result = mysqli_query($this->connection,$query);
		while($row=mysqli_fetch_assoc($result)) {
			$resultset[] = $row; 
		} 		
		if(!empty($resultset)) return $resultset; 
	}
	
	function numRows($query) {
		$result  = mysqli_query($this->connection,$query);
		$rowcount = mysqli_num_rows($result);
		return $rowcount;	
	}
}
$getData = new DBController();
$db_handle = new DBController();
$ip = '';
                  if (!empty($_SERVER['HTTP_CLIENT_IP'])) //if from shared
                   {
                     $ip = $_SERVER['HTTP_CLIENT_IP'];
                   }
                  else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))   //if from a proxy
                   {
                    $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
                   }
                 else
                  {
                    $ip = $_SERVER['REMOTE_ADDR'];
                  }
if (isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY'] > 1800)) {
    session_unset();
    session_destroy();
}
$_SESSION['LAST_ACTIVITY'] = time();
$baseurl='http://localhost/mammasaale/';
$footerData = $db_handle->runQuery("SELECT * FROM `contact` where `sr_no`='1'");
?>