[Znote AAC] Simple serverinfo

Raggaer

Godly Member
Joined
Jul 25, 2012
Messages
1,545
Best answers
8
Likes
860
Location
Spain
#1
I made this simple serverinfo page to practise skills, to install you need to configure your server path in
*Note: this will just work with servers using exp stages, ( lazy )

PHP:
$path = 'C:\Users\Asus\Desktop\Daneria Land';
add your path.

- Photo -

Untitled-2.jpg

- Install -

Add this to your serverinfo page ( erase all first )

PHP:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>

<h1>Server Information</h1>
<?php

$path = 'C:\Users\Asus\Desktop\Daneria Land';
echo '<table cellpadding="0"><tr class="yellow"><td><center>From level</center></td><td><center>To level</center></td><td><center>Rate</center></td></tr>';
if (is_dir($path)) {

	
	$xml1 = simplexml_load_file($path."\data\xml\stages.xml");
	foreach ($xml1->world->children() as $stage1) {
		if ($stage1['maxlevel'] == '') {
		$stage1['maxlevel'] = 'Infinite';	
		}
		echo '<tr><td><center>'.$stage1['minlevel'].'</center></td><td><center>'.$stage1['maxlevel'].'</center></td><td><center>'.$stage1['multiplier'].'</center></td></tr>';	
	    }
	$word = 'a'; 
	$loadconfig = file($path.'\config.lua');
	$key = 'rateMagic';
	$key2 = 'rateLoot';
	$key3 = 'rateSkill';
	$found = false;
	foreach ($loadconfig as $lineNumber => $e) {
    if (strpos($e,$key) !== false) {
       $found = true;
       break;
    }
}

	foreach ($loadconfig as $lineNumberr => $ee) {
    if (strpos($ee,$key2) !== false) {
       $found = true;
       break;
    }
}

	foreach ($loadconfig as $lineNumberrr => $eee) {
    if (strpos($eee,$key3) !== false) {
       $found = true;
       break;
    }
}

if ($found) {
   echo '<table cellpadding="0"><tr class="yellow"><td><center>Magic rate</center></td><td><center>Skills rate</center></td><td><center>Loot rate</center></td></tr>';
   echo '<tr><td><center>'.$loadconfig[$lineNumber].'</center></td><td><center>'.$loadconfig[$lineNumberrr].'</center></td><td><center>'.$loadconfig[$lineNumberr].'</center></td></tr>';
}
	
	$getallplayers = mysql_query("SELECT COUNT(*) as MAX FROM players");
	$parseallplayers = mysql_fetch_assoc($getallplayers);
	$getallaccounts = mysql_query("SELECT COUNT(*) as MEX FROM accounts");
	$parseallaccounts = mysql_fetch_assoc($getallaccounts);
	$getallguilds = mysql_query("SELECT COUNT(*) as MOX FROM guilds");
	$parseallguilds = mysql_fetch_assoc($getallguilds);
	
	echo '</table></tr>';
	echo '<table cellpadding="0"><tr class="yellow"><td><center>Total accounts</center></td><td><center>Total players</center></td><td><center>Total guilds</center></td></tr>';
	echo '<tr><td><center>'.$parseallplayers['MAX'].'</center></td><td><center>'.$parseallaccounts['MEX'].'</center></td><td><center>'.$parseallguilds['MOX'].'</center></td></tr>';
	echo '</table></tr>';
	
	$talkactions = simplexml_load_file($path.'/data/talkactions/talkactions.xml');
	echo '<table cellpadding="0"><tr class="yellow"><td><center>Player commands</center></td></center></tr>';
	foreach ($talkactions as $commands) {
		if (empty($commands['access'])) {
	echo '<center><tr><td><center>'.$commands['words'].'</center></td></tr></center>';
		}
	}
	echo '</table></tr>';
	
} else {
	
echo '<br><b>Invalid path!</b>';
	
}
?>
<?php include 'layout/overall/footer.php'; ?>
Tested and 0 errors showed up
 

Znote

<?php echo $title; ?>
Staff member
Global Moderator
Premium User
Joined
Feb 14, 2008
Messages
6,367
Best answers
150
Likes
1,060
Location
Norway, Oslo
#2
Approved.

Looks great. :)

Got something to learn here, never used XML with PHP before. :p
 

Evan

A splendid one to behold
Premium User
Joined
May 6, 2009
Messages
7,011
Best answers
0
Likes
922
Location
United States
#3
Should check if stages is on/off.
If it's off, there's no reason to display the information and confuse the players.
 

Elexonic

Well-Known Member
Joined
Jun 18, 2008
Messages
1,921
Best answers
0
Likes
54
#6
Very god =)
Just missing the frags for my taste
solo faltaria para mi gusto las frags,red,black,duracion etc.
 
Joined
Jun 9, 2008
Messages
188
Best answers
0
Likes
9
#9
yeah show the rest of info but the talkactions dont appear

web.jpg

i use itx based on tfs_03
 

edycerpa

New Member
Joined
May 5, 2009
Messages
16
Best answers
0
Likes
0
#17
you can hide the warning with
Code:
error_reporting(0);
after the top <?php
I prefer fix the error, but can works for a while :)

or edit the config of the webserver to disable errors. Or even better, fix the code so it doesn't give the warning haha:p
Yes, I want to fix it, the problem it's: I don't know NOTHING about php hahaha
 
Joined
Oct 5, 2011
Messages
90
Best answers
0
Likes
0
#20
So I installed it and got this error..

Code:
Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "C:/Users/root/Desktop/swev/config.lua/data/talkactions/talkactions.xml" in C:\xampp\htdocs\serverinfo.php on line 62

Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\serverinfo.php on line 64
Looks like this Swev
 
Top