-
Notifications
You must be signed in to change notification settings - Fork 4
/
database.php
56 lines (42 loc) · 1.04 KB
/
database.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
if(!defined('SE_SECTION')) {
die("PERMISSION DENIED!");
}
use Medoo\Medoo;
if(is_file(SE_ROOT.'/config_database.php')) {
include SE_ROOT.'/config_database.php';
$db_type = 'mysql';
$database = new Medoo([
'type' => 'mysql',
'database' => "$database_name",
'host' => "$database_host",
'username' => "$database_user",
'password' => "$database_psw",
'charset' => 'utf8',
'port' => $database_port,
'prefix' => DB_PREFIX
]);
$db_content = $database;
$db_user = $database;
$db_posts = $database;
} else {
$db_type = 'sqlite';
define("CONTENT_DB", "$se_db_content");
define("USER_DB", "$se_db_user");
define("INDEX_DB", "$se_db_index");
define("POSTS_DB", "$se_db_posts");
$db_content = new Medoo([
'type' => 'sqlite',
'database' => CONTENT_DB
]);
$db_user = new Medoo([
'type' => 'sqlite',
'database' => USER_DB
]);
$db_posts = new Medoo([
'type' => 'sqlite',
'database' => POSTS_DB
]);
}
require_once SE_ROOT . '/core/functions.php';
require_once SE_ROOT . '/core/functions/functions.php';