This repository was archived by the owner on Nov 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.php
More file actions
33 lines (28 loc) · 1.27 KB
/
config.php
File metadata and controls
33 lines (28 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
session_start();
// ini_set("auto_detect_line_endings", true);
// ini_set('display_errors', 'On');
// error_reporting(E_ALL);
//error_reporting(0);
ini_set('log_errors', 1);
# Connecting to Database
include __DIR__.'/connection.php';
include __DIR__.'/func.sec.php';
include __DIR__.'/func.db.php';
$username = (isset($_SESSION['username'])) ? $_SESSION['username'] : '';
$name = (isset($_SESSION['name'])) ? $_SESSION['name'] : '';
$public = (isset($_SESSION['public'])) ? $_SESSION['public'] : '';
$pg = (isset($_GET['pg'])) ? sc_sec($_GET['pg']) : '';
$vp = (isset($_SESSION['vpass'])) ? (int)($_SESSION['vpass']) : 0;
$lg = (isset($_SESSION['login'])) ? (int)($_SESSION['login']) : 0;
$id = $lg;
// the code below ensures that if user is not logged in, they can't access any other page and get redirected to index
if (isset($LOGIN_REQ_OVERRIDE) && $LOGIN_REQ_OVERRIDE == true) {
// don't redirect if we're on impact (tree) pages, users can set public or private if they want
} else {
$whitelist = array("/", "/register", "/ajax.php?pg=login-send", "/ajax.php?pg=vpass-send", "/ajax.php?pg=user-send", "/impact.php");
if (!$lg && !in_array($_SERVER['REQUEST_URI'], $whitelist)) {
// redirect if user is not logged in
header('Location: /');
}
}