forked from SimonSimCity/PhpSpeed
-
Notifications
You must be signed in to change notification settings - Fork 1
/
phpinfo.php
143 lines (111 loc) · 4.65 KB
/
phpinfo.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
<?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);
session_start();
include "config_db.php";
if (isset($_GET['action']) and $_GET['action'] == 'logout') {
session_start();
session_destroy();
header("Location: $self");
}
$self = $_SERVER['PHP_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");
}
ob_start();
phpinfo(INFO_MODULES);
$php_info = ob_get_contents();
ob_end_clean();
$php_info = strip_tags($php_info, '<table><tr><th><td><h2><style>');
$php_info = str_replace("' '", " \<br>", $php_info);
$php_info = str_replace("'", "", $php_info);
$php_info = str_replace("phpinfo()", "", $php_info);
$php_info = preg_replace('/<h2[^>]*>([^<]+)<\/h2>/',"<H6> \\1</H6>", $php_info);
$php_info = preg_replace('/<style[^>]*>([^<]+)<\/style>/',"", $php_info);
$php_info = str_replace("600", "95%", $php_info);
$php_info = str_replace("table", "table align=center class=forumline cellspacing=1", $php_info);
$php_info = str_replace("=\"e\"", "=\"row1\" width=25%", $php_info);
$php_info = str_replace("=\"v\"", "=\"row1\"", $php_info);
// include_path:
$php_info = str_replace(".:/", "/", $php_info);
// paths:
$php_info = str_replace(":/", "<br>/", $php_info);
$php_info = str_replace("<br>//", "://", $php_info); // correct urls
// LS_COLORS and some paths:
$php_info = str_replace(";", "; ", $php_info);
$php_info = str_replace(",", ", ", $php_info);
// apache address :
$php_info = str_replace("< ", "<", $php_info);
$php_info = str_replace(">", ">", $php_info);
include "inc/mysql.php";
include "inc/functions.server.php";
$db = new sql_db($dbhost, $dbuname, $dbpass, $dbname, false);
$sql = "SELECT * FROM phpspeed_config";
$result = $db->sql_query($sql);
$ver = mysql_fetch_assoc($result);
?>
<!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 | PHP 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>
<span class="gen">
<?php
if(isset($_SESSION['logged']) && $_SESSION['logged'] == 'yes') {
print ($php_info);
} 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>";
}
?>
</span>
</body>
</html>