-
Notifications
You must be signed in to change notification settings - Fork 0
/
cfg.php
executable file
·56 lines (44 loc) · 1.38 KB
/
cfg.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
55
56
<?php
define("CHARSET","UTF-8");
if(!defined("SITEHTML"))
define("SITEHTML",SITEROOT);
define("DB_HOST","host");
define("DB_USER","user");
define("DB_PASS","pass");
define("DB_NAME","name");
define("SITENAME","Dessi");
define("SITEURL","http://".$_SERVER["SERVER_NAME"]."/dessi/");
include_once(SITEHTML."class/db.class.php");
$db = new Db(DB_HOST,DB_USER,DB_PASS,DB_NAME);
$db->query("SET CHARSET utf8");
if(isset($_GET["la"])) {
$sql = "SELECT language FROM languages WHERE iso = '".$db->real_escape_string($_GET["la"])."';";
$res = $db->query($sql);
if($res&&$res->num_rows==1) {
define("LANG_ISO", $db->real_escape_string($_GET["la"]));
define("LANGUAGE", $res->fetch_object()->language);
}
} else {
header("Location: ".SITEURL."en/");
die();
}
if(!defined("LANGUAGE") OR !defined("LANG_ISO")) {
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
exit();
}
define("SITEISO","http://".$_SERVER["SERVER_NAME"]."/dessi/".LANG_ISO."/");
include_once(SITEHTML."class/lingual.class.php");
$lingual = new lingual($db, LANG_ISO);
/* Start session and check if logged in*/
session_start();
if(isset($_SESSION['USER_ID'])) {
$sql="SELECT * FROM users WHERE id='".$db->real_escape_string(trim($_SESSION['USER_ID']))."'";
$res=$db->query($sql);
if($res&&$res->num_rows==1) {
$user = $res->fetch_object();
} else {
echo "Something went terribly wrong...";
}
} else {
$user = null;
}