Crew algemeen |
|
Hallo iedereen,
Ik heb een klein probleempje. Voor mijn Counter-strike's gaming community Robowars (http://robowars.robohost.be/) ben ik een admin pagina aan het maken. Hier worden alle admin's op getoond. Dit is een uitbrijding op de banlist (http://212.104.212.77/bans). De SQL heb ik (uiteraard) wat aangepast naar mijn zin, en de scripts zijn ook wat veranderd. Alles werkt, behalve dit script.
Er wordt gebruikt gemaakt van de Smarty (http://smarty.php.net/) temlate engine.
view_admins.php (http://212.104.212.77/bans/view_admins.php)
<?php
/*
view_admins.php
By GDX^
RoboWars
http://robowars.robohost.be/
*/
// Require basic site files
require("include/config.inc.php");
if ($config->error_handler == "enabled") {
include("$config->error_handler_path");
}
//require("$config->path_root/include/functions.inc.php");
$db_conn = mysql_connect($config->db_host, $config->db_user, $config->db_pass) OR die("Couldn't connect to database");
mysql_select_db($config->db_name, $db_conn) OR die("Database not found!");
$admins = NULL; // Remove the admins var
$adminrank = array(
"1" => "RoboWars HEAD Admin",
"2" => "RoboWars Public Admin",
"3" => "RoboWars Trial Admin"
);
$query = mysql_query("SELECT username, level FROM $config->webadmins") OR die(mysql_error());
while ($admin = mysql_fetch_object($query) OR die(mysql_error())) {
$admins .= "<tr><td width=\"50%\">".$admin->username."</td><td width=\"50%\">".$adminrank[$admin->level]."</td></tr>";
}
// Count the admins ($n_admins)
$n_admins = @mysql_num_rows($query);
/////////////////////////////////////////////////////////////////
// Template parsing
/////////////////////////////////////////////////////////////////
$title = "View Admins";
// Section
$section = "";
$smarty = new dynamicPage;
$smarty->assign("meta","");
$smarty->assign("title",$title);
$smarty->assign("section",$section);
$smarty->assign("dir",$config->document_root);
$smarty->assign("n_admins",$n_admins);
$smarty->assign("admins",$admins);
$smarty->display('main_header.tpl');
$smarty->display('view_admins.tpl');
$smarty->display('main_footer.tpl');
?>
<?php /* view_admins.php By GDX^ RoboWars http://robowars.robohost.be/ */ // Require basic site files require("include/config.inc.php"); if ($config->error_handler == "enabled") { include("$config->error_handler_path"); } //require("$config->path_root/include/functions.inc.php"); $db_conn = mysql_connect($config->db_host, $config->db_user, $config->db_pass) OR die("Couldn't connect to database"); $admins = NULL; // Remove the admins var "1" => "RoboWars HEAD Admin", "2" => "RoboWars Public Admin", "3" => "RoboWars Trial Admin" ); $admins .= "<tr><td width=\"50%\">".$admin->username."</td><td width=\"50%\">".$adminrank[$admin->level]."</td></tr>"; } // Count the admins ($n_admins) ///////////////////////////////////////////////////////////////// // Template parsing ///////////////////////////////////////////////////////////////// $title = "View Admins"; // Section $section = ""; $smarty = new dynamicPage; $smarty->assign("meta",""); $smarty->assign("title",$title); $smarty->assign("section",$section); $smarty->assign("dir",$config->document_root); $smarty->assign("n_admins",$n_admins); $smarty->assign("admins",$admins); $smarty->display('main_header.tpl'); $smarty->display('view_admins.tpl'); $smarty->display('main_footer.tpl'); ?>
view_admins.tpl:
<table cellspacing='1' class='listtable' width='100%'>
<tr>
<td height='16' colspan='4' class='listtable_top'><b>Prune Database</b></td>
</tr>
<tr bgcolor="#D3D8DC">
<td height='16' width='30%' class='listtable_1'>Admins: {$n_admins}</td>
<td height='16' width='60%' class='listtable_1'> </td>
<td height='16' width='10%' class='listtable_1' align='right' colspan='2'> </td>
</tr>
</form>
<tr bgcolor="#D3D8DC">
<td height='16' width='100%' class='listtable_1' colspan='4'><br>
<b>Current admins:</b><br>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%">Admin name</td>
<td width="50%">Status: (Head/Public/Trial)</td>
</tr>
{$admins}
</table>
<br>
<br>
</td>
</tr>
</table>
<table cellspacing='1' class='listtable' width='100%'> <tr> <td height='16' colspan='4' class='listtable_top'><b>Prune Database</b></td> </tr> <tr bgcolor="#D3D8DC"> <td height='16' width='30%' class='listtable_1'>Admins: {$n_admins}</td> <td height='16' width='60%' class='listtable_1'> </td> <td height='16' width='10%' class='listtable_1' align='right' colspan='2'> </td> </tr> </form> <tr bgcolor="#D3D8DC"> <td height='16' width='100%' class='listtable_1' colspan='4'><br> <b>Current admins:</b><br> <br> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="50%">Admin name</td> <td width="50%">Status: (Head/Public/Trial)</td> </tr> {$admins} </table> <br> <br> </td> </tr> </table>
config klopt volledig (anders zou de rest ook niet werken).
Greetz,
Wim Mariën
GDX^
|