• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[ModernAAC ] Staff List Page

camman

New Member
Joined
Jan 5, 2009
Messages
7
Reaction score
0
Location
United States of America
This is a script that will show a list of all the staff on your server. It will show the player's rank (God/CM/etc.), their name, and if they are online or offline.

Save this in /system/pages You could also use your admin panel to add it.
PHP:
<?
// Staff List Page
// by Camman (Cameron Hutchison)
// For ModernAAC
$ots = POT::getInstance();
$ots->connect(POT::DB_MYSQL, connection());
$SQL = POT::getInstance()->getDBHandle();
include ('config.php'); 

//Ranks
$rank[6]="God";
$rank[5]="Community Manager";
$rank[4]="Game Master";
$rank[3]="Senior Tutor";
$rank[2]="Tutor";

$query = $SQL->query("SELECT group_id,name FROM players WHERE group_id > 1 ORDER BY group_id DESC");

echo 'All of the staff of ' . $config['server_name'] .' are listed below.<br/>
	<br />
	<table width="100%">
	<tbody>
	<tr><td><b>Rank</b></td><td width="60%"><b>Name</b></td><td><b>Status</b></td></tr>';

$aaa = 0;
foreach($query as $info)
	{
	$player = $ots->createObject('Player');
	$player->find($info['name']);
	$showRank = $rank[ $info['group_id'] ];
	echo '<tr>
		<td>'.$showRank.'</td>
		<td width="60%"><a href="/index.php/character/view/'.$info['name'].'">'.$info['name'].'</a></td>
		<td><font color="';
	echo ($player->isOnline()) ? 'green' : 'red';
	echo '">';
	echo ($player->isOnline()) ? 'Online' : 'Offline';
	echo '</font></td>
	</tr>';
	$aaa++;
	}
echo '</tbody>
</table>';
?>

If you only want to show a people above a certain rank, change "WHERE group_id > 1" to something else. For example, to only show GM's and higher make that part say "WHERE group_id > 3".

-Cameron
 
Well, what about <?PHP at the beginning?

PHP:
<?PHP 
// Staff List Page 
// by Camman (Cameron Hutchison) 
// For ModernAAC 
$ots = POT::getInstance(); 
$ots->connect(POT::DB_MYSQL, connection()); 
$SQL = POT::getInstance()->getDBHandle(); 
include ('config.php');  

//Ranks 
$rank[6]="God"; 
$rank[5]="Community Manager"; 
$rank[4]="Game Master"; 
$rank[3]="Senior Tutor"; 
$rank[2]="Tutor"; 

$query = $SQL->query("SELECT group_id,name FROM players WHERE group_id > 1 ORDER BY group_id DESC"); 

echo 'All of the staff of ' . $config['server_name'] .' are listed below.<br/> 
    <br /> 
    <table width="100%"> 
    <tbody> 
    <tr><td><b>Rank</b></td><td width="60%"><b>Name</b></td><td><b>Status</b></td></tr>'; 

$aaa = 0; 
foreach($query as $info) 
    { 
    $player = $ots->createObject('Player'); 
    $player->find($info['name']); 
    $showRank = $rank[ $info['group_id'] ]; 
    echo '<tr> 
        <td>'.$showRank.'</td> 
        <td width="60%"><a href="/index.php/character/view/'.$info['name'].'">'.$info['name'].'</a></td> 
        <td><font color="'; 
    echo ($player->isOnline()) ? 'green' : 'red'; 
    echo '">'; 
    echo ($player->isOnline()) ? 'Online' : 'Offline'; 
    echo '</font></td> 
    </tr>'; 
    $aaa++; 
    } 
echo '</tbody> 
</table>'; 
?>

Works for me. : P
 
@Barbyn; What version of TFS are you using?
0.3.6.pl1 but Saint's "<?PHP" in the beginning works but then this happens:
PHP:
A PHP Error was encountered

Severity: Notice

Message: Undefined index: 7

Filename: pages/staff.php

Line Number: 30
 
And if you edit the names of the ranks you get something like this:
PHP:
Parse error: syntax error, unexpected '>' in C:\Program\xampp\htdocs\system\pages\staff.php on line 7
 
You have different access levels setup on your server.

Code:
Message: Undefined index: 7
Is saying that it's trying to call $rank[7], which isn't declared in the beginning. So if you add something like this to the ranks it should work.
PHP:
//Ranks 
$rank[7]="Supreme God"; 
$rank[6]="God"; 
$rank[5]="Community Manager"; 
$rank[4]="Game Master"; 
$rank[3]="Senior Tutor"; 
$rank[2]="Tutor";
 
You have different access levels setup on your server.

Code:
Message: Undefined index: 7
Is saying that it's trying to call $rank[7], which isn't declared in the beginning. So if you add something like this to the ranks it should work.
PHP:
//Ranks 
$rank[7]="Supreme God"; 
$rank[6]="God"; 
$rank[5]="Community Manager"; 
$rank[4]="Game Master"; 
$rank[3]="Senior Tutor"; 
$rank[2]="Tutor";
Yeah, I know, I did all that, but still, that error shows up:
PHP:
Parse error: syntax error, unexpected '>' in C:\Program\xampp\htdocs\system\pages\staff.php  on line 7
 
PHP:
   <?PHP 
// Staff List Page 
// by Camman (Cameron Hutchison) 
// For ModernAAC 
$ots = POT::getInstance(); 
$ots->connect(POT::DB_MYSQL, connection()); 
$SQL = >POT::getInstance()-getDBHandle(); 
include ('config.php');  

//Ranks 
$rank[6]="Admin"; 
$rank[6]="Exalted Gamemaster"; 
$rank[5]="Revered Gamemaster"; 
$rank[4]="Gamemaster"; 
$rank[3]="Senior Tutor"; 
$rank[2]="Tutor"; 

$query = >$SQL-query("SELECT group_id,name FROM players WHERE group_id > 1 ORDER BY group_id DESC"); 

echo 'All of the staff of ' . $config['server_name'] .' are listed below.<br/> 
    <br /> 
    <table width="100%"> 
    <tbody> 
    <tr><td><b>Rank</b></td><td width="60%"><b>Name</b></td><td><b>Status</b></td></tr>'; 

$aaa = 0; 
foreach($query as $info) 
    { 
    $player = >$ots-createObject('Player'); 
    >$player-find($info['name']); 
    $showRank = $rank[ $info['group_id'] ]; 
    echo '<tr> 
        <td>'.$showRank.'</td> 
        <td width="60%"><a href="/index.php/character/view/'.$info['name'].'">'.$info['name'].'</a></td> 
        <td><font color="'; 
    echo ($player->isOnline()) ? 'green' : 'red'; 
    echo >'"'; 
    echo >($player-isOnline()) ? 'Online' : 'Offline'; 
    echo '</font></td> 
    </tr>'; 
    $aaa++; 
    } 
echo '</tbody> 
</table>'; 
>?

:]
 
Line 7 in your script is
PHP:
$SQL = >POT::getInstance()-getDBHandle();

It should be
PHP:
$SQL = POT::getInstance()->getDBHandle();

I'm not sure what happened there. Oh and also, your last line closes the php script with >? when it should be ?>. I'm not sure how that happened either. Are you using ModernAAC's administration panel to edit the script?
 
You don't see the obious error? Here either.

$query = >$SQL-query("SELECT group_id,name FROM players WHERE group_id > 1 ORDER BY group_id DESC");

The maker gets a HUGE minus from me...
 
Line 7 in your script is
PHP:
$SQL = >POT::getInstance()-getDBHandle();

It should be
PHP:
$SQL = POT::getInstance()->getDBHandle();

I'm not sure what happened there. Oh and also, your last line closes the php script with >? when it should be ?>. I'm not sure how that happened either. Are you using ModernAAC's administration panel to edit the script?

^^! That solved the problem. The ModernAAC's admin panel caused this issue. Thanks :)...
 
Back
Top