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
|
<?
/*
* Latest Version Checker
* Checks Apache, PHP, Zend Optimizer, MySQL and phpMyAdmin Versions
*
* Author : JMan
* HomePage : www.bedpan.ca
* Email : jman@bedpan.ca
*/
include("cache.php");
$phpMyAdmin_dir = "./phpMyAdmin"; //Relative phpMyAdmin directory; no trailing slash
$link = mysql_connect($server, $db_user, $db_pass);
function phpMyAdmin_version(){
global $phpMyAdmin_dir;
if (file_exists($phpMyAdmin_dir . "/libraries/defines.lib.php")){
$PMA = file_get_contents($phpMyAdmin_dir . "/libraries/defines.lib.php");
}else{
$PMA = file_get_contents($phpMyAdmin_dir . "/libraries/Config.class.php");
}
$PMA_start = strpos($PMA, "define('PMA_VERSION', ");
$PMA = substr($PMA, $PMA_start, strpos($PMA, "')", $PMA_start) - $PMA_start);
return substr($PMA, strrpos($PMA, "'") + 1);
}
function ZO_version(){
ob_start();
phpinfo(INFO_GENERAL);
$info = str_replace(" ", " ", ob_get_contents());
ob_end_clean();
preg_match('/Optimizer v(.*?), Copyright/', $info, $regs);
return $regs[1];
}
function Fetch($URL, $Special){
$Website = @file_get_contents($URL);
if ($Special == "Apache"){
preg_match('/<strong>Apache HTTP Server (.*?)is the best available version<\/strong>/s', $Website, $regs);
$fetch = trim($regs[1]);
}elseif ($Special == "PHP"){
preg_match('/<h1>PHP (.*?)<\/h1>/', $Website, $regs);
$fetch = $regs[1];
}elseif ($Special == "Zend"){
preg_match_all('/\/optimizer\/(.*?)\/">\\d/', $Website, $regs, PREG_PATTERN_ORDER);
usort($regs[1], "version_compare");
$fetch = $regs[1][count($regs[1])-1];
}elseif ($Special == "MySQL"){
preg_match('/<td>Windows Essentials \\(x86\\)<\/td><td><\/td><td>(.*?)<\/td>/', $Website, $regs);
$fetch = $regs[1];
}elseif ($Special == "phpMyAdmin"){
preg_match('/Latest stable version:<br \/><span class="version">phpMyAdmin (.*?)<\/span>/s', $Website, $regs);
$fetch = $regs[1];
}
return $fetch;
}
function HighlightVersion($CurrentVerson, $LatestVersion){
if (version_compare($CurrentVerson, $LatestVersion) < 0) return " style=\"background-color:#FF7777;\"";
}
$cached = cache("version");
if ($cached){
$apache = $cached[0];
$php = $cached[1];
$zendoptimizer = $cached[2];
$mysql = $cached[3];
$phpmyadmin = $cached[4];
$latest_apache = $cached[5];
$latest_php = $cached[6];
$latest_zendoptimizer = $cached[7];
$latest_mysql = $cached[8];
$latest_phpmyadmin = $cached[9];
}else{
preg_match('/\/(.*?) /', apache_get_version(), $apache);
$apache = $apache[1];
$php = phpversion();
$zendoptimizer = ZO_version();
$mysql = preg_replace('/-nt$/', '', mysql_get_server_info());
$mysql = preg_replace('/-community$/', '', $mysql);
$phpmyadmin = phpMyAdmin_version();
$latest_apache = Fetch("http://httpd.apache.org/download.cgi", "Apache");
$latest_php = Fetch("http://www.php.net/downloads.php", "PHP");
$latest_zendoptimizer = Fetch("http://downloads.zend.com/optimizer/", "Zend");
$latest_mysql = Fetch("http://dev.mysql.com/downloads/mysql/", "MySQL");
$latest_phpmyadmin = Fetch("http://www.phpmyadmin.net/home_page/index.php", "phpMyAdmin");
$cache = array($apache, $php, $zendoptimizer, $mysql, $phpmyadmin, $latest_apache, $latest_php, $latest_zendoptimizer, $latest_mysql, $latest_phpmyadmin);
cache("version", 86400, $cache);
}
$apache_u2d = HighlightVersion($apache, $latest_apache);
$php_u2d = HighlightVersion($php, $latest_php);
$zendoptimizer_u2d = HighlightVersion($zendoptimizer, $latest_zendoptimizer);
$mysql_u2d = HighlightVersion($mysql, $latest_mysql);
$phpmyadmin_u2d = HighlightVersion($phpmyadmin, $latest_phpmyadmin);
$version = "<table border=\"1\" cellpadding=\"2\" cellspacing=\"0\" style=\"border-color:#000000; border-collapse: collapse;\">
<tr>
<td></td>
<td><b>Installed Version</b></td>
<td><b>Latest Version</b></td>
</tr>";
if ($latest_apache) {
$version .= "
<tr$apache_u2d>
<td><b>Apache</b></td>
<td><center>$apache</center></td>
<td><center>$latest_apache</center></td>
</tr>";
}
if ($latest_php) {
$version .= "
<tr$php_u2d>
<td><b>PHP</b></td>
<td><center>$php</center></td>
<td><center>$latest_php</center></td>
</tr>";
}
if ($latest_zendoptimizer) {
$version .= "
<tr$zendoptimizer_u2d>
<td><b>Zend Optimizer</b></td>
<td><center>$zendoptimizer</center></td>
<td><center>$latest_zendoptimizer</center></td>
</tr>";
}
if ($latest_mysql) {
$version .= "
<tr$mysql_u2d>
<td><b>MySQL</b></td>
<td><center>$mysql</center></td>
<td><center>$latest_mysql</center></td>
</tr>";
}
if ($latest_phpmyadmin) {
$version .= "
<tr$phpmyadmin_u2d>
<td><b>phpMyAdmin</b></td>
<td><center>$phpmyadmin</center></td>
<td><center>$latest_phpmyadmin</center></td>
</tr>";
}
$version .= "
</table>";
mysql_close($link);
echo $version;
?>
|