<?php
@session_start();
error_reporting(0); 
class DBController {
	private $host = "localhost";
	private $user = "u840064903_amjad";
	private $password = "Amjad#@#@143";
	private $database = "u840064903_amjad";
	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) or die(mysqli_error($this->connection));
		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();
//$date = date('Y-m-d G:i:s');
 $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_regenerate_id(true);
function generateRandomString($length) {
    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $charactersLength = strlen($characters);
    $randomString = '';
    for ($i = 0; $i < $length; $i++) {
        $randomString .= $characters[rand(0, $charactersLength - 1)];
    }
    return $randomString;
}

$_SESSION['LAST_ACTIVITY'] = time();
// $baseurl='https://www.umeedeinfoundation.org/';
$baseurl='https://unitedwebfox.com/amjad/';

?>