-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconnection.php
34 lines (27 loc) · 892 Bytes
/
connection.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
<?php
/**
* Connection class connects to the database
* @author Manzoor Ahmed
*/
$flagLocalDB = false;
$string = file_get_contents("dbconfiguration.json");
$json_s = json_decode($string,true);
if($flagLocalDB)// assumes local connection
{
define('HOST',$json_s['Localdbs']['Host']);
define('NAME',$json_s['Localdbs']['User']);
define('PASSWORD',$json_s['Localdbs']['Password']);
define('DATABASE',$json_s['Localdbs']['Database']);
}
else // assumes remote connection
{
define('HOST',$json_s['Remotedbs']['Host']);
define('NAME',$json_s['Remotedbs']['User']);
define('PASSWORD',$json_s['Remotedbs']['Password']);
define('DATABASE',$json_s['Remotedbs']['Database']);
}
//database connection
global $dbc;
$dbc = mysqli_connect("localhost","","","sjsucsor_160s1g1") or die($dbc->connect_error);
$dbc->set_charset('utf8');
?>