Upstream tarball 20080522
[amule.git] / src / webserver / default / stat_graphs.php
blob71db15311e7b0bbd164e037a90b479f6291b8ccf
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
5 <META HTTP-EQUIV="PRAGMAS" CONTENT="NO-CACHE">
6 <?php
7 echo "<title>aMule " , amule_get_version(), " - Web Control Panel</title>";
8 ?>
9 <style type="text/css">
10 img
12 border : 0px;
14 a, a:active, a:link, a:visited
16 color: white;
18 .down-header, .down-header-left, .down-header-right,
19 .down-line, .down-line-good, .down-line-left, .down-line-good-left,
20 .down-line-right, .down-line-good-right,
21 .up-header, .up-header-left, .up-line, .up-line-left,
22 .server-header, .server-header-left, .server-line, .server-line-left,
23 .shared-header, .shared-header-left, .shared-line, .shared-line-changed,
24 .shared-line-left, .shared-line-left-changed,
25 .header, .smallheader, .commontext,
26 .upqueue-header, .upqueue-line, .upqueue-line-left,
27 .websearch-header, .websearch-line, .addserver-header, .addserver-line
29 font-family : Tahoma;
30 font-size : 8pt;
32 .tabs
34 font-family : Tahoma;
35 font-size : 10pt;
36 background-color : #3399FF;
38 .down-header, .down-line, .down-line-good, .up-header, .up-line,
39 .server-header, .server-line, .shared-header, .shared-line, .shared-line-changed,
40 .upqueue-header, .upqueue-line,
41 .websearch-header, .websearch-line, .addserver-header, .addserver-line
43 text-align : center;
45 .down-header-left, .down-line-left, .down-line-good-left,
46 .server-header-left, .server-line-left, .shared-header-left,
47 .up-header-left, .up-line-left, .shared-line-left, .shared-line-left-changed, .upqueue-line-left
49 text-align : left;
51 .down-line-right, .down-line-good-right, .down-header-right
53 text-align : right;
55 .down-header, .down-header-left, .down-header-right,
56 .up-header, .up-header-left, .server-header, .server-header-left,
57 .shared-header, .shared-header-left, .upqueue-header,
58 .websearch-header, .addserver-header
60 background-color : #0066CC;
62 .header
64 background-color : #0046AC;
66 .smallheader
68 background-color : #003399;
69 color : #FFFFFF;
71 .commontext
73 background-color : #FFFFFF;
74 color : #000000;
76 .down-line, .down-line-good, .down-line-left, .down-line-good-left,
77 .down-line-right, .down-line-good-right,
78 .up-line, .up-line-left, .server-line, .server-line-left,
79 .shared-line, .shared-line-changed, .shared-line-left, .shared-line-left-changed,
80 .upqueue-line, .upqueue-line-left,
81 .websearch-line, .addserver-line
83 background-color : #3399FF;
85 .down-line-good, .down-line-good-left, .down-line-good-right, .shared-line-changed, .shared-line-left-changed
87 color : #F0F000;
89 .percent_table
91 border:0px solid #000000;
92 border-collapse: collapse;
94 .message
96 font-size: 10pt;
97 font-weight: bold;
98 color: #FF0000;
100 .dinput
102 border-width: 1px;
103 border-color: black;
105 </style>
106 </head>
107 <body bgcolor="#FBDE9C" text=white link="#3399FF" vlink="#3399FF" alink="#3399FF" marginwidth=0 marginheight=0 topmargin=0 leftmargin=0 style="margin:0px">
108 <table border=0 width="100%" align=center cellpadding=4 cellspacing=0>
109 <tr>
110 <td class="tabs" align="left" colspan="2">
112 <table border="0" cellpadding="4" cellspacing="0">
113 <tr>
114 <td class="tabs" align="center">
115 &nbsp;<a href="http://www.amule.org" target="_blank"><img src="emule.gif"></a>
116 <font face="Tahoma" style="font-size:13pt;" color="#000000">aMule<br>Web Control Panel</font>
117 </td>
118 <td class="tabs" align="center" width="30">&nbsp; </td>
120 <td align="center" class="tabs" width="95">
121 <a href="servers.php">
122 <img src="cp_servers.gif"><br>
123 Server list
124 </a>
125 </td>
126 <td align="center" class="tabs" width="95">
127 <a href="downloads.php">
128 <img src="cp_download.gif"><br>
130 Transfer
131 </a>
132 </td>
133 <td align="center" class="tabs" width="95">
134 <a href="search.php">
135 <img src="cp_search.gif"><br>
136 Search
137 </a>
138 </td>
139 <td align="center" class="tabs" width="95">
141 <a href="shared.php">
142 <img src="cp_shared.gif"><br>
143 Shared Files
144 </a>
145 <td align="center" class="tabs" width="110">
146 <a href="stat_tree.php">
147 <img src="cp_stats.gif"><br>
148 Statistics</a>
149 <font color="#000000">|</font>
151 <a href="stat_graphs.php">Graphs</a>
152 </td>
153 </td>
154 <td align="center" class="tabs" width="95">
155 <a href="preferences.php">
156 <img src="cp_settings.gif"><br>
157 Preferences
158 </a>
159 </td>
161 <td class="tabs" align="center" width="30">&nbsp;</td>
162 <td align="left" class="tabs" width="95">
163 <img src="log.gif"> <a href="index.php?serverinfo=1">Serverinfo</a><br>
164 <img src="log.gif"> <a href="index.php?log=1">Log</a>
165 </td>
166 </tr>
167 </table>
169 </td>
170 </tr>
171 <tr>
172 <td style="background-color: #000000; height: 1px" colspan="2">
173 </td>
174 </tr>
175 <tr>
176 <td class="tabs">
177 &nbsp;&nbsp;<b>Connection:</b>
178 <?php
179 function CastToXBytes($size)
181 if ( $size < 1024 ) {
182 $result = $size . " bytes";
183 } elseif ( $size < 1048576 ) {
184 $result = ($size / 1024.0) . "KB";
185 } elseif ( $size < 1073741824 ) {
186 $result = ($size / 1048576.0) . "MB";
187 } else {
188 $result = ($size / 1073741824.0) . "GB";
190 return $result;
193 $stats = amule_get_stats();
194 if ( $stats["kad_connected"] == 1 ) {
195 echo "Connected";
196 if ( $stats["kad_firewalled"] == 1 ) {
197 echo " to KAD (firewalled), ";
198 } else {
199 echo " to KAD, ";
201 } else {
202 echo "Not connected to KAD, ";
204 if ( $stats["id"] == 0 ) {
205 echo "not connected to ED2K";
206 } elseif ( $stats["id"] == 0xffffffff ) {
207 echo "connecting to ED2k";
208 } else {
209 echo "connected with ", (($stats["id"] < 16777216) ? "low" : "high"), " ID to ",
210 $stats["serv_name"], " ", $stats["serv_addr"];
212 echo '<br>&nbsp;&nbsp;<b>Speed:</b> Up: ', CastToXBytes($stats["speed_up"]), 'ps',
213 ' | Down: ', CastToXBytes($stats["speed_down"]), 'ps',
214 '<small> (Limits: ', CastToXBytes($stats["speed_limit_up"]), 'ps/',
215 CastToXBytes($stats["speed_limit_down"]), 'ps)</small>&nbsp;';
218 <font color=black>
220 <script type="text/javascript" language="javascript">
221 var d = new Date();
222 s = "[ " + d.getDate() + "/" + (d.getMonth() + 1) + "/" + d.getFullYear() + " " + d.getHours() + ":" + (d.getMinutes() < 10 ? "0" : "") + d.getMinutes() + ":" + (d.getSeconds() < 10 ? "0" : "") + d.getSeconds() + " ]";
223 document.write(s);
224 </script>
225 </font>
226 </td>
227 <td align=left class=tabs>
228 <form>
229 <input type="button" value="ed2k://Download" onClick='self.location.href="index.php?links=1"'>
230 <input type="button" value="Logout" onClick='self.location.href="login.php"'>
231 </form>
232 </td>
233 </tr>
234 </table>
236 &nbsp;
238 <?php
239 // reload graphs data
240 amule_load_vars("stats_graph");
243 <table border=0 align=center cellpadding=4 cellspacing=0>
244 <tr>
245 <td class="websearch-line"><img src="amule_stats_download.png" width="500" height="200" border="0" alt="" title="" /></td>
246 </tr>
247 <tr>
248 <td width="600" class="websearch-line"><b><font face=Tahoma style="font-size:8pt;">Download speed</font></b></td>
249 </tr>
250 </table>
251 &nbsp;
252 <table border=0 align=center cellpadding=4 cellspacing=0>
253 <tr>
254 <td class="websearch-line"><img src="amule_stats_upload.png" width="500" height="200" border="0" alt="" title="" /></td>
255 </tr>
256 <tr>
257 <td width="600" class="websearch-line"><b><font face=Tahoma style="font-size:8pt;">Upload speed</font></b></td>
258 </tr>
259 </table>
260 &nbsp;
261 <table border=0 align=center cellpadding=4 cellspacing=0>
262 <tr>
263 <td class="websearch-line"><img src="amule_stats_conncount.png" width="500" height="200" border="0" alt="" title="" /></td>
264 </tr>
265 <tr>
266 <td width="600" class="websearch-line"><b><font face=Tahoma style="font-size:8pt;">Number of connections</font></b></td>
267 </tr>
268 </table>
270 </body>
271 </html>