-
Notifications
You must be signed in to change notification settings - Fork 1
/
db_functions.php
63 lines (53 loc) · 1.77 KB
/
db_functions.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
<?php
error_reporting(0);
function MAD_connect_maindb()
{
global $maindb;
// Main database
$dbhost_maindb=$GLOBALS['_MAX']['CONF']['database']['host'];
$dbsocket_maindb=$GLOBALS['_MAX']['CONF']['database']['socket'];
$dbport_maindb=$GLOBALS['_MAX']['CONF']['database']['port'];
$dbuname_maindb=$GLOBALS['_MAX']['CONF']['database']['username'];
$dbpass_maindb=$GLOBALS['_MAX']['CONF']['database']['password'];
$dbname_maindb=$GLOBALS['_MAX']['CONF']['database']['name'];
// Main Database
$maindb = mysql_connect($dbhost_maindb, $dbuname_maindb, $dbpass_maindb);
mysql_select_db ($dbname_maindb, $maindb);
if ($maindb){
return true;
}
else {
return false;
}
}
function MAD_connect_repdb()
{
global $repdb;
// Main database
if ($GLOBALS['_MAX']['CONF']['reportingdatabase']['useseparatereportingdatabase']){
$dbhost_repdb=$GLOBALS['_MAX']['CONF']['reportingdatabase']['host'];
$dbsocket_repdb=$GLOBALS['_MAX']['CONF']['reportingdatabase']['socket'];
$dbport_repdb=$GLOBALS['_MAX']['CONF']['reportingdatabase']['port'];
$dbuname_repdb=$GLOBALS['_MAX']['CONF']['reportingdatabase']['username'];
$dbpass_repdb=$GLOBALS['_MAX']['CONF']['reportingdatabase']['password'];
$dbname_repdb=$GLOBALS['_MAX']['CONF']['reportingdatabase']['name'];
}
else {
$dbhost_repdb=$GLOBALS['_MAX']['CONF']['database']['host'];
$dbsocket_repdb=$GLOBALS['_MAX']['CONF']['database']['socket'];
$dbport_repdb=$GLOBALS['_MAX']['CONF']['database']['port'];
$dbuname_repdb=$GLOBALS['_MAX']['CONF']['database']['username'];
$dbpass_repdb=$GLOBALS['_MAX']['CONF']['database']['password'];
$dbname_repdb=$GLOBALS['_MAX']['CONF']['database']['name'];
}
// Main Database
$repdb = mysql_connect($dbhost_repdb, $dbuname_repdb, $dbpass_repdb);
mysql_select_db ($dbname_repdb, $repdb);
if ($repdb){
return true;
}
else {
return false;
}
}
?>