<?php
//phpSystem-0.8 Copyright 2001 Warped Systems
//Created by J.P. Pasnak
//http://www.warpedsystems.sk.ca

// Is the translation file present ?
include("lang_$lang.php");

/* ----------------------------------------------------------------------------
                Title
---------------------------------------------------------------------------- */
$title_result = "
<br />
<h3 align=\"center\">$host ($ip)</h3>";

/* ----------------------------------------------------------------------------
                General info
---------------------------------------------------------------------------- */
$general_info_result .= "
<table border=\"1\" align=\"center\" cellspacing=\"0\">
	<tr><th>$msg_general_info</th></tr>
	<tr><td>
		<table border=\"0\">
			<tr>
				<th>$msg_system_time :</th>
				<td>$time</td>
			</tr>
			<tr>
				<th>$msg_kernel :</th>
				<td class=\"alternate\">$system $kernel</td>
			</tr>
			<tr>
				<th>$msg_cpu :</th>
				<td>$cpu_info</td>
			</tr>
			<tr>
				<th>$msg_cpu_cache :</th>
				<td class=\"alternate\">$cache</td>
			</tr>
			<tr>
				<th>$msg_cpu_bogomips :</th>
				<td>$bogomips</td>
			</tr>
			<tr>
				<th>$msg_uptime :</th>
				<td class=\"alternate\">$uptime</td>
			</tr>
		</table>
	</td></tr>
</table>";

/* ----------------------------------------------------------------------------
                Connections
---------------------------------------------------------------------------- */
$connections_result .= "
<br />
<table border=\"1\" align=\"center\" cellspacing=\"0\">
	<tr>
		<th>$msg_connections</th>
	</tr>
	<tr>
		<td>
			<table border=\"0\">
				<tr>"; 

// new variable 'svcname' is set in 'config.php'
$svc = 1;
$svctot = count ($service); 

while ($svc <= $svctot){
	$connections_result .= "
					<th>$svcname[$svc]:</th>
					<td>$daemon[$svc]&nbsp;&nbsp;&nbsp;</td>";
$svc++;
}
 $connections_result .= "
				</tr>
			</table>
		</td>
	</tr>
</table>";

/* ----------------------------------------------------------------------------
                'Who's logged in' : detail
---------------------------------------------------------------------------- */
$who_result .= "
<br />
<table border=\"1\" align=\"center\" cellspacing=\"0\">
	<tr>
		<th>$msg_who_is_connected</th>
	</tr>
	<tr>
		<td>
			<table border=\"0\">
				<tr align=\"center\">
					<th>$msg_conn_user</th>
					<th>$msg_conn_tty</th>
					<th>$msg_conn_from</th>
					<th>$msg_conn_login</th>
					<th>$msg_conn_idle</th>
					<th>$msg_conn_jcpu</th>
					<th>$msg_conn_pcpu</th>
					<th>$msg_conn_what</th>
				</tr>"; 
$countwho=1;
while ($countwho < sizeof($who)) {
	$who_result .= "
				<tr align=\"center\">
					<td class=\"alternate\">$user[$countwho]</td>
					<td>$tty[$countwho]</td>
					<td class=\"alternate\">$from[$countwho]</td>
					<td>$login[$countwho]</td>
					<td class=\"alternate\">$idle[$countwho]</td>
					<td>$jcpu[$countwho]</td>
					<td class=\"alternate\">$pcpu[$countwho]</td>
					<td>$what[$countwho]</td>
				</tr>";
	$countwho++;
}
$who_result .= "
			</table>
		</td>
	</tr>
</table>";

/* ---------------------------------------------------------------------------- 
		Memory
---------------------------------------------------------------------------- */
$memory_result .= "
<br />
<table align=\"center\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\">
        <tr>
                <th>$msg_memory : $total_mem</th>
        </tr>
        <tr>
                <td>
			<table border=\"0\">
				<tr>
					<td></td>
					<td>$msg_total</td><td>$msg_usage</td><td>$msg_percent</td>
				</tr>
				<tr>
					<td>$msg_used</td>
					<td>$used_mem</td>
					<td><img src=\"img4.png\" height=\"13\" width=\"$percent_used\" alt=\"\"><img src=\"img11.png\" height=\"13\" width=\"".(100-$percent_used)."\" alt=\"\"></td>
					<td>$percent_used $msg_percent</td>
				</tr>
				<tr>
					<td>$msg_free</td>
					<td>$free_mem</td>
					<td><img src=\"img1.png\" height=\"13\" width=\"$percent_free\" alt=\"\"><img src=\"img11.png\" height=\"13\" width=\"".(100-$percent_free)."\" alt=\"\"></td>
					<td>$percent_free $msg_percent</td>
				</tr>
				<tr>
					<td>$msg_buffered</td>
					<td>$buffer_mem</td>
					<td><img src=\"img2.png\" height=\"13\" width=\"$percent_buff\" alt=\"\"><img src=\"img11.png\" height=\"13\" width=\"".(100-$percent_buff)."\" alt=\"\"></td>
					<td>$percent_buff $msg_percent</td>
				</tr>
				<tr>
					<td>$msg_cached</td>
					<td>$cache_mem</td>
					<td><img src=\"img5.png\" height=\"13\" width=\"$percent_cach\" alt=\"\"><img src=\"img11.png\" height=\"13\" width=\"".(100-$percent_cach)."\" alt=\"\"></td>
					<td>$percent_cach $msg_percent</td>
				</tr>
			</table>
		</td>
	</tr>
</table>"; 

/* ----------------------------------------------------------------------------
                Mounts
---------------------------------------------------------------------------- */
$mounts_result .= "
<br />
<table align=\"center\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\">
        <tr>
                <th>$msg_mounts</th>
        </tr>
        <tr>
                <td>
                        <table border=\"0\">
				<tr>
			        	<td>$msg_mount</td>
					<td>$msg_size</td>
					<td>$msg_free</td>
					<td>$msg_used</td>
					<td width=\"100\">$msg_usage</td>
					<td>$msg_percent</td>
				</tr>";													
$count=1;
while ($count < sizeof($x)) {
	$mounts_result .= "
				<tr>
					<td>$mount[$count]</td>
					<td>$size[$count]</td>
					<td>$avail[$count]</td>
					<td>$used[$count]</td>
					<td><img src=\"img$count.png\" height=\"13\" width=\"$percent_part[$count]\" alt=\"\"><img src=\"img11.png\" height=\"13\" width=\"".(100-$percent_part[$count])."\" alt=\"\"></td>
					<td>$percent[$count]</td>
				</tr>";
	$count++;
}
$mounts_result .= "
			</table>
		</td>
	</tr>
</table>";

/* ----------------------------------------------------------------------------
                Swap
---------------------------------------------------------------------------- */
$swap_result .= "
<br />
<table align=\"center\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\">
	<tr>
		<th>$msg_swap : $total_swap</th>
	</tr>
	<tr>
		<td>
			<table border=\"0\">
				<tr>
					<td></td>
					<td>Total</td>
					<td width=\"100\">$msg_usage</td>
					<td>$msg_percent</td>
				</tr>
				<tr>
					<td>$msg_used</td>
					<td>$used_swap</td>
					<td><img src=\"img4.png\" height=\"13\" width=\"$percent_swap\" alt=\"\"><img src=\"img11.png\" height=\"13\" width=\"".(100-$percent_swap)."\" alt=\"\"></td>
					<td>$percent_swap $msg_percent</td>
				</tr>
				<tr>
					<td>$msg_free</td>
					<td>$free_swap</td>
					<td><img src=\"img1.png\" height=\"13\" width=\"$percent_swap_free\" alt=\"\"><img src=\"img11.png\" height=\"13\" width=\"".(100-$percent_swap_free)."\" alt=\"\"></td>
					<td>$percent_swap_free $msg_percent</td>
				</tr>
			</table>
		</td>
	</tr>
</table>"; 

/* ----------------------------------------------------------------------------
                Dump the whole stuff
---------------------------------------------------------------------------- */
$page_result = $title_result . $general_info_result . $connections_result . $who_result . $memory_result . $swap_result . $mounts_result;
echo $page_result;

?> 
