1
0
mirror of https://gitlab.com/JKANetwork/CheckServer.git synced 2026-02-15 17:51:39 +01:00
Files
CheckServer/connect.php

37 lines
1.1 KiB
PHP
Executable File

<?php
define('VERSION','0.9.1');
session_start(); //Session in all page
require_once "lib/dbwrapper.php";
$db_file = __DIR__."/sqlite.db3";
if (!is_file($db_file)){ //Go to install if not.
header("Location: install.php");
die();
}
$db_conn = dbw_connect("sqlite",$db_file); //Database
/** In connect.php check if user SessionID exists, if not, delete Cookie */
if (isset($_SESSION['UserID'])){
$data = dbw_query_fetch_array($db_conn, "SELECT * FROM USERS WHERE ID_U='$_SESSION[UserID]'");
if ($data['ID_U'] != $_SESSION['UserID']){
session_destroy();
header("Location: index.php");
}
$you['ID_U'] = $data['ID_U'];
$you['nick'] = $data['nick'];
$you['fullRights'] = $data['fullRights'];
$you['webRoot'] = webRoot();
}
$lang=getSystemOpt($db_conn,'lang');
//Translations
require_once __DIR__."/assets/translations/en.php"; //Ever first English, and then your lang (Database)
require_once __DIR__."/assets/translations/$lang.php";
$ver=getSystemOpt($db_conn,'version');
if (getSystemOpt($db_conn,'version') != VERSION){
die("<p>Please run updater.php to update before using page");
}
?>