punbb/admin_index.php
changeset 2 a8a21e1c7afa
parent 0 f9ffdbd96607
--- a/punbb/admin_index.php	Wed Jul 11 21:28:39 2007 -0400
+++ b/punbb/admin_index.php	Thu Jul 12 01:04:01 2007 -0400
@@ -26,12 +26,15 @@
 // Tell header.php to use the admin template
 define('PUN_ADMIN_CONSOLE', 1);
 
-define('PUN_ROOT', './');
-require PUN_ROOT.'include/common.php';
+//define('PUN_ROOT', './');
+//require PUN_ROOT.'include/common.php';
+
+global $pun_db, $pun_user, $pun_config, $lang_common;
+
 require PUN_ROOT.'include/common_admin.php';
 
 
-if ($pun_user['g_id'] > PUN_MOD)
+if ($pun_user['g_id'] < PUN_MOD)
 	message($lang_common['No permission']);
 
 
@@ -93,8 +96,8 @@
 
 
 // Get number of current visitors
-$result = $db->query('SELECT COUNT(user_id) FROM '.$db->prefix.'online WHERE idle=0') or error('Unable to fetch online count', __FILE__, __LINE__, $db->error());
-$num_online = $db->result($result);
+$result = $pun_db->query('SELECT COUNT(user_id) FROM '.$pun_db->prefix.'online WHERE idle=0') or error('Unable to fetch online count', __FILE__, __LINE__, $pun_db->error());
+$num_online = $pun_db->result($result);
 
 
 // Get the database system version
@@ -105,8 +108,8 @@
 		break;
 
 	default:
-		$result = $db->query('SELECT VERSION()') or error('Unable to fetch version info', __FILE__, __LINE__, $db->error());
-		$db_version = $db->result($result);
+		$result = $pun_db->query('SELECT VERSION()') or error('Unable to fetch version info', __FILE__, __LINE__, $pun_db->error());
+		$db_version = $pun_db->result($result);
 		break;
 }
 
@@ -117,10 +120,10 @@
 	$db_version = 'MySQL '.$db_version;
 
 	// Calculate total db size/row count
-	$result = $db->query('SHOW TABLE STATUS FROM `'.$db_name.'`') or error('Unable to fetch table status', __FILE__, __LINE__, $db->error());
+	$result = $pun_db->query('SHOW TABLE STATUS FROM `'.$db_name.'`') or error('Unable to fetch table status', __FILE__, __LINE__, $pun_db->error());
 
 	$total_records = $total_size = 0;
-	while ($status = $db->fetch_assoc($result))
+	while ($status = $pun_db->fetch_assoc($result))
 	{
 		$total_records += $status['Rows'];
 		$total_size += $status['Data_length'] + $status['Index_length'];