-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.php
205 lines (82 loc) · 3.88 KB
/
config.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<?php
//-------- 1. CONSTANTS define the default path for includes -----------------------------
$local = false;
defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR);
if ($local == false){
define("APP_PATH", dirname(__FILE__));
define('PATH', '');
define("SITE_ROOT", "/new-pdo");
define("PATH_FILE", APP_PATH.SITE_ROOT);
define("ADDRESS", "");
define("BASE", 'http://'.$_SERVER['HTTP_HOST']);
//define("DEBUG_MODE", false);
define("DEBUG_MODE", true);//on the cloud change this with false
//ini_set('display_errors', 0);
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);
//error_reporting( 0 );
error_reporting( E_ALL );
}else{
define('PATH', '/traian4');
define("APP_PATH", $_SERVER['DOCUMENT_ROOT'].PATH);
define("SITE_ROOT", PATH."/new-pdo");
define("PATH_FILE", $_SERVER['DOCUMENT_ROOT'].SITE_ROOT);
define("ADDRESS", 'http://'.$_SERVER['HTTP_HOST']);//$_SERVER['SERVER_NAME']
define("BASE", ADDRESS.SITE_ROOT.'/');
define("DEBUG_MODE", true);//on the cloud change this with false
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);
error_reporting( E_ALL );
}
//--------------- 2. INCLUDES -------------------------------------------------------
file_exists(APP_PATH.'/application/util_func.php') ?
include_once APP_PATH."/application/util_func.php" : "";
file_exists(APP_PATH.'/library/Core.php') ?
include_once APP_PATH."/library/Core.php" : "";
if(file_exists(APP_PATH.'/library/recaptchalib.php')){
require_once APP_PATH.'/library/recaptchalib.php';
}
//------------ 3 INI CLASSES -------------------------------------------------------
Core::initialize();
Sessions::init();
CSRF::init();
Hash::init();
//----------------------4 ERROR REPORTING ---------------------------------------------
if ($local == false) {
//set_error_handler('Errors::my_error_handler_prod');
set_error_handler('Errors::my_error_handler', E_ALL);
if (isset($_SESSION['system_error_message'])) {
error_log($_SESSION['system_error_message']."\n", 3,"/home/remb4372/public_html/traian4/new-pdo/error.log");
}
}else{
set_error_handler('Errors::my_error_handler', E_ALL);
if (isset($_SESSION['system_error_message'])) {
error_log($_SESSION['system_error_message']."\n", 3, "C:\\Users\\victor92\OneDrive\htdocs\\traian4\\new-pdo\\error.log");
}
}
// ------------ 5 CONFIG KEYS, ENCRYPTION FROM INI FILE ----------------------------
$sec = Config_ini::getConfig("sec");
define('SUP', $sec['sup']);
define('PWD', $sec['pwd']);
define("K", $sec['k']);//for session user
define("K1", $sec['k1']);//for session admin
define("KS", $sec['ks']);//for admin
// Get a key from https://www.google.com/recaptcha/admin/create
define('PUB_KEY', $sec['pub_key']);
define('PRIV_KEY', $sec['priv_key']);
//for hidden input in registration users
define ('FV', crypt($sec['fv1'], '$'.$sec['fv2']));
//for my encryption functions
//define('IV', mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND));
define('IV', mcrypt_create_iv(32, MCRYPT_RAND));
define('KY', '&;'.$sec['ky'].'$!');//max8 if >8 error
//for class Encription
define('KYC', '&;$'.$sec['kyc']);//init 10. for encrypt class
define('TYPE', $sec['type']);
define('SEPARATOR', '=');
# - Encryption algorithm name; Recommended algorithms: sha384, sha512, ripemd256, ripemd320, whirlpool or salsa20 ; http://www.php.net/manual/pt_BR/function.hash.php#104987
/* The RFC recommends a key size larger than the output hash for the hash function you use (16 for md5() and 20 for sha1()). */
define('KEY', $sec['key']);
//------- 7 CONFIG CONST FROM XML FILE ------------------------------
//define('DB_INFO', $ftp->getElementsByTagName("db_info")->item(0)->nodeValue);
//define('DB_INFO', $xml->children()[1]->db_info);