<?php
ini_set("display_errors", 0);
error_reporting(0);
//Add database details below:
$host = "localhost"; //<-- mysql database host, usually localhost if it lives on the same server
$username = "p2playlink_thor"; //<-- username of user that has permission to the new database you just created
$password = "#Thainny1309z";
$dbname = "p2playlink_thor"; //<-- name of database you just created
$sportsApiKey = '';


$appCat = "IBO";
$GLOBALS['panelroot'] = '';
//db version
$expectedVersion = 4;
//app version
$appVersion = "1.3";
$dbConnected = false;
$mysqli = new mysqli($host, $username, $password, $dbname);
if ($mysqli->connect_errno) {
	//Error
} else {
	$dbConnected = true;
}
$insVersion = 0;
try {
	$insResult = $mysqli->prepare("SELECT * FROM config");
	if ($insResult) {
		$insResult->execute(); 
		$insResult = $insResult->get_result();
		$configArray = $insResult->fetch_array();
		$insVersion = $configArray['dbversion'];
		$GLOBALS['panelroot'] = $configArray['panel_root'];
		if (substr($GLOBALS['panelroot'], -1) != "/") {
			$GLOBALS['panelroot'] .= "/";
			
		}
		$authVar = base64_encode($GLOBALS['panelroot']);
	}
	$isInstalled = $insResult !== false;
	$dbIsLatest = $expectedVersion == $insVersion;
} catch (Exception $e) {
	$isInstalled = false;
	$dbIsLatest = false;
}
