-
Notifications
You must be signed in to change notification settings - Fork 11
/
config.php
executable file
·125 lines (104 loc) · 3.32 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
<?php
/***
* e-Dokter from version 0.1 Beta
* Last modified: 02 Pebruari 2018
* Author : Didi Andriawan
* Email : dd.andriawan26@gmail.com
*
* File : config.php
* Description : Main config, function and helper
* Licence under GPL
***/
if (preg_match ('/config.php/', basename($_SERVER['PHP_SELF']))) die ('Unable to access this script directly from browser!');
define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PASS', '');
define('DB_NAME', 'sik');
$connection = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
define('VERSION', '1.1');
define('URL', 'http://localhost/Dokter-Ulun/');
define('DIR', '/Dokter-Ulun');
define('PRODUCTION', 'NO'); // YES to hide error page. NO to display error page.
define('SIMRSURL', 'http://localhost/webapps');
define('BERKAS_RM', '003');
define('BERKAS_RESEP', '004');
define('BERKAS_LAB', '005');
define('BERKAS_EKG', '006');
// INACBG's and VClaim Configurations
define('INACBG_KEYRS', '');
define('INACBG_URLWS', '');
define('NO_RM', ' ');
define('NO_PESERTA', '');
define('SEP', '');
define('NIK_KODER', '');
define('TIPE_RS', '');
function escape($string) {
global $connection;
return mysqli_real_escape_string($connection, $string);
}
function query($sql) {
global $connection;
$query = mysqli_query($connection, $sql);
confirm($query);
return $query;
}
function confirm($query) {
global $connection;
if(!$query) {
die("Query failed! " . mysqli_error($connection));
}
}
function fetch_array($result) {
return mysqli_fetch_array($result);
}
function fetch_assoc($result) {
return mysqli_fetch_assoc($result);
}
function num_rows($result) {
return mysqli_num_rows($result);
}
// Get date and time
date_default_timezone_set('Asia/Makassar');
$year = date('Y');
$month = date('Y-m');
$date = date('Y-m-d');
$time = date('H:i:s');
$date_time = date('Y-m-d H:i:s');
// Get settings
$getSettings = query("SELECT nama_instansi, alamat_instansi, kabupaten, propinsi FROM setting");
$dataSettings = fetch_assoc($getSettings);
// Get jenis poli
$jenispoli=isset($_SESSION['jenis_poli'])?$_SESSION['jenis_poli']:NULL;
$query_poli = query("SELECT * from poliklinik WHERE kd_poli = '".$jenispoli."'");
$data_poli = fetch_array($query_poli);
if ($jenispoli == $data_poli['0']) {
$nmpoli = $data_poli['1'];
}
// htmlentities remove #$%#$%@ values
function clean($string) {
return htmlentities($string);
}
// redirect to another page
function redirect($location) {
return header("Location:".$location);
}
// add message to session
function set_message($message) {
if(!empty($message)) {
$_SESSION['message'] = $message;
} else {
$message = "";
}
}
// display session message
function display_message() {
if(isset($_SESSION['message'])) {
echo '<div class="alert bg-pink alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>'.$_SESSION['message'].'</div>';
unset($_SESSION['message']);
}
}
// show errors
function validation_errors($error) {
$errors = '<div class="alert bg-pink alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>'.$error.'</div>';
return $errors;
}