forked from phpmyadmin/phpmyadmin
/
server_variables.php
112 lines (97 loc) · 2.52 KB
/
server_variables.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
<?php
/* $Id$ */
// vim: expandtab sw=4 ts=4 sts=4:
/**
* Does the common work
*/
require('./server_common.inc.php');
/**
* Displays the links
*/
require('./server_links.inc.php');
/**
* Displays the sub-page heading
*/
echo '<h2>' . "\n"
. ' ' . $strServerVars . "\n"
. '</h2>' . "\n";
/**
* Checks if the user is allowed to do what he tries to...
*/
if (!$is_superuser && !$cfg['ShowMysqlVars']) {
echo $strNoPrivileges;
require_once('./footer.inc.php');
}
/**
* Sends the queries and buffers the results
*/
if (PMA_MYSQL_INT_VERSION >= 40003) {
$res = @PMA_mysql_query('SHOW SESSION VARIABLES;', $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), 'SHOW SESSION VARIABLES;');
while ($row = PMA_mysql_fetch_row($res)) {
$serverVars[$row[0]] = $row[1];
}
@mysql_free_result($res);
$res = @PMA_mysql_query('SHOW GLOBAL VARIABLES;', $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), 'SHOW GLOBAL VARIABLES;');
while ($row = PMA_mysql_fetch_row($res)) {
$serverVarsGlobal[$row[0]] = $row[1];
}
@mysql_free_result($res);
} else {
$res = @PMA_mysql_query('SHOW VARIABLES;', $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), 'SHOW VARIABLES;');
while ($row = PMA_mysql_fetch_row($res)) {
$serverVars[$row[0]] = $row[1];
}
@mysql_free_result($res);
}
unset($res);
unset($row);
/**
* Displays the page
*/
?>
<table border="0">
<tr>
<th> <?php echo $strVar; ?> </th>
<?php
echo ' <th> ';
if (PMA_MYSQL_INT_VERSION >= 40003) {
echo $strSessionValue . ' </th>' . "\n"
. ' <th> ' . $strGlobalValue;
} else {
echo $strValue;
}
echo ' </th>' . "\n";
?>
</tr>
<?php
$useBgcolorOne = TRUE;
foreach ($serverVars as $name => $value) {
?>
<tr>
<td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>">
<?php echo htmlspecialchars(str_replace('_', ' ', $name)) . "\n"; ?>
</td>
<td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>">
<?php echo htmlspecialchars($value) . "\n"; ?>
</td>
<?php
if (PMA_MYSQL_INT_VERSION >= 40003) {
?>
<td bgcolor="<?php echo $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; ?>">
<?php echo htmlspecialchars($serverVarsGlobal[$name]) . "\n"; ?>
</td>
<?php
}
$useBgcolorOne = !$useBgcolorOne;
?>
</tr>
<?php
}
?>
</table>
<?php
/**
* Sends the footer
*/
require_once('./footer.inc.php');
?>