All pastes #458544 Raw Edit

Stuff

public text v1 · immutable
#458544 ·published 2007-04-25 23:06 UTC
rendered paste body
<!-- L2j DATABASE CONNECTION INFO -->
<!-- <?php require_once("config.php"); ?> -->

<!-- CPU INFORMATION  --> 
<?php
	$kernel = shell_exec("uname -r").substr("\n", 0, -2);
	$host = shell_exec("hostname");
	$hostname = shell_exec("hostname -f");
	$uptime = shell_exec("uptime");
	$cpuvendor = shell_exec("cat /proc/cpuinfo | head -n2 | tail -n1 | cut -f2 -d: | sed 's| ||'");
	$cpumodel = shell_exec("cat /proc/cpuinfo | head -n5 | tail -n1 | cut -f2 -d: | sed 's| ||'");
	$cpumhz = shell_exec("cat /proc/cpuinfo | head -n7 | tail -n1 | cut -f2 -d: | sed 's| ||'");
	$cpucache = shell_exec("cat /proc/cpuinfo | head -n8 | tail -n1 | cut -f2 -d: | sed 's| ||'");
	$memtotal = shell_exec("free -m | head -n2 | tail -n1 | awk '{ print $2 }'");
	$memused = shell_exec("free -m | head -n3 | tail -n1 | awk '{ print $3 }'");
	$memfree = shell_exec("free -m | head -n3 | tail -n1 | awk '{ print $4 }'");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<meta name="description" content="" />
	<meta name="keywords" content="" />
	<META HTTP-EQUIV="Refresh" CONTENT="300" >
	<title>L2Advantage Server Information</title>
	<link rel="stylesheet" type="text/css" href="style.css" />
	<script src="clmenu.js" type="text/javascript"></script>	
</head>
<body>

	<table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="left" valign="top">
			<?php require_once("linksleft.php"); ?>

				<h4>System Info</h4>
				CPU <?php echo "$cpuvendor"; ?> <?php echo "$cpumodel"; ?><br />
				CPU MHz: <?php echo "$cpumhz"; ?> cache: <?php echo "$cpucache"; ?><br />
				Memory total: <?php echo "$memtotal"; ?>mb <br />
				Memory used: <?php echo "$memused"; ?>mb<br /> 
				<?php 
				  if ($memfree > 1000) { $class = 'green'; } else if ($memfree > 400) { $class = 'blue'; } else { $class = 'red'; }
				 ?>
				Memory free: <font color="<?php echo $class; ?>"><b><?php echo $memfree; ?></font> mb</b><br />
 				Hostname: <?php echo "$host($hostname)"; ?><br />
				Kernel: <?php echo "$kernel"; ?><br />
				Uptime: <?php echo "$uptime"; ?><br />

				<br />

				<h4>L2Advantage Info</h4>
				<?php
					$query_acc= ("select count(login) as log from $login_db.accounts");
					$result =mysql_query($query_acc);
					$row = mysql_fetch_array($result);
					$acc=($row['log']);

					$gm_chars= ("select count(accesslevel) as gm from characters where accesslevel>=90");
					$result =mysql_query($gm_chars);
					$row = mysql_fetch_array($result);
					$gm=($row['gm']);
					If ($gm==0) $gm="none";
					echo"GM characters: $gm <br />";

					$query_acc_empty= ("select count(login) as log_empty from accounts where login not in (select account_name from $login_db.characters) ");
					$result =mysql_query($query_acc_empty);
					$row = mysql_fetch_array($result);
					$acc_empty=$row['log_empty'];
					if ($acc_empty==0) $acc_empty="none";
					echo "Total accounts: $acc (Empty: $acc_empty) <a href=\"acu.php\">ACU</a><br />";
					$x=($acc-1);

					$query_chars= ("select count(*) as chars from characters");
					$result =mysql_query($query_chars);
					$row = mysql_fetch_array($result);
					$chars=($row['chars']);

					$avglvl=mysql_query("select avg(level) as lvl from characters");
					$resavg=mysql_fetch_array($avglvl);
					$avg=round($resavg['lvl'],2);

					echo"Total characters: $chars (Average level: $avg)<br />";
					$y=($chars-1);
					$row = mysql_fetch_array(mysql_query("select count(*) as online from characters where online=1"));
					$charso=($row['online']);
					$procon=round(($charso*100/$chars),2);

					$race=("select count(race) as race from characters where race=0");
					$row=mysql_fetch_array(mysql_query($race));
					$human=($row['race']);
					$proch=round(($human*100/$chars),2);

					$race=("select count(race) as race from characters where race=1");
					$row=mysql_fetch_array(mysql_query($race));
					$elf=($row['race']);
					$proce=round(($elf*100/$chars),2);

					$race=("select count(race) as race from characters where race=2");
					$row=mysql_fetch_array(mysql_query($race));
					$delf=($row['race']);
					$proced=round(($delf*100/$chars),2);

					$race=("select count(race) as race from characters where race=3");
					$row=mysql_fetch_array(mysql_query($race));
					$orc=($row['race']);
					$proceo=round(($orc*100/$chars),2);

					$race=("select count(race) as race from characters where race=4");
					$row=mysql_fetch_array(mysql_query($race));
					$dwarf=($row['race']);
					$procew=round(($dwarf*100/$chars),2);

					echo "Races statistic:<br />Human: $human($proch%) Elf: $elf($proce%) Dark Elf: $delf($proced%) Orc: $orc($proceo%) Dwarf:$dwarf($procew%)<br />";

					echo "<br />";

					$ban_acc=("select count(access_level) as ban from $login_db.accounts where access_level<0 ");
					$result =mysql_query($ban_acc);
					$row = mysql_fetch_array($result);
					$acc_ban=($row['ban']);
					if ($acc_ban==0) $acc_ban="none";
					echo "Banned accounts: $acc_ban ";

					$ban_accs="select login from accounts where access_level<0";
					$result =mysql_query($ban_accs);
					while ($row = mysql_fetch_array($result)){
						$accs_ban=($row['login']);
						echo "  $accs_ban, ";
					}

					echo "<br />";

					$ban_chars= ("select count(accesslevel) as ban from characters where accesslevel<0");
					$result =mysql_query($ban_chars);
					$row = mysql_fetch_array($result);
					$ban_chars=($row['ban']);
					If ($ban_chars==0) $ban_chars="none";
					echo"Banned characters: $ban_chars <br />";

					echo "<br />";

					$jail_chars= ("select count(in_jail) as in_jail from characters where in_jail=1");
					$result =mysql_query($jail_chars);
					$row = mysql_fetch_array($result);
					$jail_chars=($row['in_jail']);
					If ($jail_chars==0) $jail_chars="none";
					echo"Jailed: $jail_chars <br />";

					echo "<br />";

					$query = "select  count(char_name and level) from characters";
					$link = mysql_query($query);
					$all = mysql_fetch_row($link);
					$query = "select account_name, char_name, level,obj_Id from characters where online=1 order by characters.accesslevel, characters.level, characters.lastAccess";
					$link = mysql_query($query);
					$num = mysql_num_rows($link);
					@$FORM .= "Online characters: $charso ($procon%)<br />";
					while ( $char = mysql_fetch_row($link))
						{
							$FORM .= " $char[1] $char[2], ";
						}
					echo $FORM;
					mysql_close();
				?>

				<?php require_once("castles.php"); mysql_close(); ?>

				<br /><br />

			<a href="http://l2advantage.fromthepit.com/L2AbannerA_468x59.gif"><img src="http://l2advantage.fromthepit.com/L2AbannerA_468x59.gif" border="0"></a> <br />
			[img]http://l2advantage.fromthepit.com/L2AbannerA_468x59.gif[/img] <a href="http://l2advantage.fromthepit.com/L2AbannerA_468x59.gif">468x59</a> <br />
			[img]http://l2advantage.fromthepit.com/L2AbannerA_700x88.gif[/img] <a href="http://l2advantage.fromthepit.com/L2AbannerA_700x88.gif">700x88</a> <br />

			<br />
					
			<a href="http://l2advantage.fromthepit.com/L2AbannerB_468x60.gif"><img src="http://l2advantage.fromthepit.com/L2AbannerB_468x60.gif" border="0"></a> <br />
			[img]http://l2advantage.fromthepit.com/L2AbannerB_468x60.gif[/img] <a href="http://l2advantage.fromthepit.com/L2AbannerB_468x60.gif">468x60</a> <br />
			[img]http://l2advantage.fromthepit.com/L2AbannerB_700x88.gif[/img] <a href="http://l2advantage.fromthepit.com/L2AbannerB_700x88.gif">700x88</a> <br />



	    </td>
		<td width="500" align="left" valign="top">
			<?php require_once("linksright.php"); ?>
			<img src="graphs/graph_bandwidth_day.png" alt="BANDWIDTH" name="BANDWIDTH" border="0" id="BANDWIDTH" /><br /><br />
			<img src="graphs/graph_mems_day.png" alt="MEMORY SIMPLE" name="MEMORY" border="0" id="MEMORY" /><br /><br />
			<img src="graphs/graph_cpua_day.png" alt="CPU ALL" name="CPU" border="0" id="CPU" /><br /><br />
			<img src="graphs/graph_cpus_day.png" alt="CPU SCALED" name="CPU" border="0" id="CPU" /><br /><br />
			<img src="graphs/graph_rtt_day.png" alt="RTT" name="RTT" border="0" id="RTT" /><br /><br />
		</td>
	</tr>
</table>

</body>
</html>