forked from SimonSimCity/PhpSpeed
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmysql.php
194 lines (149 loc) · 5.71 KB
/
mysql.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<?php
/***************************************************************************
*
* PHPspeed.com | PHP Benchmarking Script
* http://www.phpspeed.com
* November 4, 2006
*
* This is a commercial script. You MAY modify this script for your
* personal use. You MAY NOT redistrubute modified code without the
* written permission of the author. Please see the included license
* for additional restrictions.
*
***************************************************************************/
define('IN_PHPSPEED', true);
include "config_db.php";
if(!file_exists("config_db.php"))
{
header("Location:install/install.php");
die;
}
include "inc/mysql.php";
include "inc/functions.server.php";
$self = $_SERVER['PHP_SELF'];
$db = new sql_db($dbhost, $dbuname, $dbpass, $dbname, false);
$sql = "SELECT * FROM phpspeed_config";
$result = $db->sql_query($sql);
$ver = mysql_fetch_assoc($result);
session_start();
if (isset($_GET['action']) and $_GET['action'] == 'logout') {
session_start();
session_destroy();
header("Location: $self");
}
if(isset($_SESSION['logged']) && $_SESSION['logged'] == 'yes') {
$login = "<a href=\"$self?action=logout\"><img align=\"middle\" src=\"inc/images/exit.gif\" border=\"0\" hspace=\"6\" alt=\"logout\"></a>";
} else {
$login = "<span class=\"gen\"><form name=\"login\" action=\"$self\" method=\"POST\" style=\"margin:0;\"><input type=\"hidden\" name=\"submit\">Name: <input type=\"text\" name=\"user\" size=\"10\" class=\"post\"> Pass: <input type=\"password\" name=\"pass\" size=\"10\" class=\"post\"> <input name=\"Submit\" type=\"submit\" class=\"button\" value=\"Login\"></form></span>";
}
$u = isset($_POST['user']) ? $_POST['user'] : ''; //username from form
$p = isset($_POST['pass']) ? $_POST['pass'] : ''; // password from form.
if ($u == "$admin" && $p == "$pass"){
$_SESSION['user'] = $u;
$_SESSION['logged'] = "yes";
header("Location: $self");
}
$show = isset($_GET['show']) ? htmlentities(addslashes($_GET['show'])) : '';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>PHPspeed | MySQL Info</title>
<meta http-equiv="content-language" content="en-us" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="start" title="Home" href="http://www.phpspeed.com/" />
<link rel="stylesheet" type="text/css" media="screen" href="inc/Style.css" />
</head>
<body>
<table width="97%" cellspacing="0" cellpadding="15" border="0" align="center">
<tr>
<td>
<span class="maintitle">PHPspeed <?php echo $ver['version']; ?></span><br />
<span class="mainmenu"><a href="index.php">Home</a> •
<a href="phpinfo.php">PHP Info</a> •
<a href="mysql.php">MySQL Info</a> •
<a href="info.php">System Info</a></span>
</td>
<td align="right">
<?php echo $login; ?>
</td>
</tr>
</table>
<?php
if(isset($_SESSION['logged']) && $_SESSION['logged'] == 'yes') {
if(!extension_loaded("mysql")){
echo ("<br><font color=red><b>php MySQL extension not loaded !!</font><br><br>Check in php.ini if extension=php_mysql.dll is enabled, and that the extension_dir = is pointing to your php/ext folder. <br><br>Copy libmySQL.dll from your Mysql/bin folder to c:/windows.</b><br><br><br>");
die;
}
$link = mysql_connect($dbhost, $dbuname, $dbpass);
if (!$link) {
echo ('<br><font color=red><b>Could not connect to the Mysql server !!</font><br><br>' . mysql_error() . '<br><br><b>Did you set the correct host and login parameters in mysqlinfo.php ? <br><br><br>');
die;
}
else
{
if( $user == 'root' ) {
if( $password == '') {
echo "<font color=red><b>Your user and password are the install default (user:root and password is blank), change it !!</b></font><br><br>";
}
}
if ($show == "1") {
?>
<h6> MySQL Show Status</h6>
<table width="95%" class="forumline" align="center" cellspacing="1" cellpadding="4">
<tr>
<th colspan="4" align="center">
<?php
echo "MySQL Status | <a href=\"$self\">Show Variables</a></th></tr><tr></th></tr><tr>";
$result = mysql_query('SHOW /*!50002 GLOBAL */ STATUS', $link);
$p = 1;
while ($row = mysql_fetch_assoc($result)) {
$p ++;
if($p%2==0){
echo '</tr><tr>';
}
echo '<td class=row1><span class=gen> ' . $row['Variable_name'] . '</span></td><td class=row1><span class=gen> ' . number_format($row['Value']) . "</span></td>";
}
?>
</tr>
</table>
<?php
} else {
?>
<h6> MySQL Show Variables</h6>
<table width="95%" class="forumline" align="center" cellspacing="1" cellpadding="4">
<tr>
<th colspan="4" align="center">
<?php
echo "MySQL Variables | <a href=\"$self?show=1\">Show Status</a></th></tr><tr>";
$result = mysql_query('SHOW VARIABLES', $link);
$p = 1;
while ($row = mysql_fetch_assoc($result)) {
$p ++;
if($p%2==0){
echo '</tr><tr>';
}
echo '<td class=row1><span class=gen> ' . $row['Variable_name'] . '</span></td><td class=row1><span class=gen> ' . number_format($row['Value']) . "</span></td>";
}
}
?>
</tr>
</table>
<?php
}
} else {
echo "<table width=\"95%\" align=\"center\">
<tr>
<td width=\"100%\">
<table class=\"forumline\" cellpadding=\"8\">
<tr>
<td class=\"row1\">You need to login to view this page...</td>
</tr>
</table>
</td>
</tr>
</table>";
}
?>
</body>
</html>