-
Notifications
You must be signed in to change notification settings - Fork 1
/
LocalSettings.php
executable file
·54 lines (41 loc) · 1.27 KB
/
LocalSettings.php
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?
session_start();
//For debugging
//error_reporting(E_ALL);
ini_set('display_errors', '0');
//root folder as seen by server
$DocRoot="/opt/vlabs_insti_aug/";
//root folder as seen by browser
$WebRoot="/opt/vlabs_insti_aug/";
//absolute URL to root
$URLRoot="http://localhost/";
//current location relative to DocRoot
$Path=$_SERVER['PHP_SELF'];
//macros
$header=$DocRoot."header.php";
$banner=$DocRoot."banner.php";
$menu=$DocRoot."menu.php";
$context_menu="context_menu.php";
$sidebar=$DocRoot."sidebar.php";
$footer=$DocRoot."footer.php";
$script=$WebRoot."main.js";
$style=$WebRoot."style.css";
//counter
include $DocRoot."count.php";
//password salt!
$salt="l958k7j987b93j7'x293j4860b'2j4026j0x2j8670209487'b";
//database connection
try {
$conn = new PDO('mysql:host=localhost;dbname=vil', "root","");
}
catch (Exception $e) {
die("Unable to connect to database: " . $e->getMessage());
}
//allow some pages without login
$no_login = array($WebRoot."index.php",$WebRoot."user/signup.php",$WebRoot."user/confirm.php",$WebRoot."user/login.php",$WebRoot."user/logout.php",$WebRoot."user/require_login.php");
if(!in_array($Path, $no_login) && !isset($_SESSION['username'])){
//force login for everybody else:
header("Location: ".$URLRoot."user/require_login.php");
exit();
}
?>