-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.php
31 lines (27 loc) · 1.05 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
<?php
define('DB_HOST', 'YOURIP');
define('DB_NAME', 'DBNAME');
define('DB_USERNAME', 'DBUSER');
define('DB_PASSWORD', 'PASSWORD');
define('NAME', 'SESSIONNAME');
try {
$odb = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME, DB_USERNAME, DB_PASSWORD);
}
catch( PDOException $Exception ) {
error_log('ERROR: '.$Exception->getMessage().' - '.$_SERVER['REQUEST_URI'].' at '.date('l jS \of F, Y, h:i:s A')."\n", 3, 'error.log');
die(ERROR_MESSAGE);
}
function error($string){
return '<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><strong>ERROR:</strong> '.$string.'</div>';
}
function success($string){
return '<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><strong>SUCCESS:</strong> '.$string.'</div>';
}
function IsSafe($string){
if(preg_match('/[^a-zA-Z0-9_]/', $string) == 0){
return true;
} else {
return false;
}
}
?>