mirror of
https://gitlab.com/JKANetwork/CheckServer.git
synced 2026-03-04 17:49:55 +01:00
Optimize index and fix delete older checks from hist
This commit is contained in:
16
connect.php
16
connect.php
@@ -1,4 +1,6 @@
|
||||
<?php
|
||||
define('VERSION','0.9.1');
|
||||
session_start(); //Session in all page
|
||||
require_once "lib/dbwrapper.php";
|
||||
|
||||
$db_file = __DIR__."/sqlite.db3";
|
||||
@@ -10,19 +12,17 @@ if (!is_file($db_file)){ //Go to install if not.
|
||||
$db_conn = dbw_connect("sqlite",$db_file); //Database
|
||||
|
||||
/** In connect.php check if user SessionID exists, if not, delete Cookie */
|
||||
if (isset($_COOKIE['SessionID'])){
|
||||
$data = dbw_query_fetch_array($db_conn, "SELECT * FROM USERS WHERE SessionID='$_COOKIE[SessionID]'");
|
||||
if (!isset($data['SessionID'])){
|
||||
setcookie("SessionID", "", time()-3600,"/");
|
||||
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['SessionID'] = $data['SessionID'];
|
||||
$you['webRoot'] = webRoot();
|
||||
|
||||
}
|
||||
|
||||
$lang=getSystemOpt($db_conn,'lang');
|
||||
@@ -30,4 +30,8 @@ $lang=getSystemOpt($db_conn,'lang');
|
||||
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");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user