<?php
session_start();
include ('../config.php');
include ('secureadmin.php');
function plural($total) {
if ($total == 1) {
echo " is";
} else {
echo " are";
}
}
// A query to get article information
$query = "select ID from articles;";
$result = mysql_query($query,$connection) or die(mysql_error());
$totalarticles = mysql_num_rows($result);
$query = "select ID from articles where status=0;";
$result = mysql_query($query,$connection) or die(mysql_error());
$activearticles = mysql_num_rows($result);
$query = "select ID from articles where status=1;";
$result = mysql_query($query,$connection) or die(mysql_error());
$reviewarticles = mysql_num_rows($result);
$query = "select ID from articles where status=2;";
$result = mysql_query($query,$connection) or die(mysql_error());
$problemarticles = mysql_num_rows($result);
$query = "select ID from authors;";
$result = mysql_query($query,$connection) or die(mysql_error());
$totalauthors = mysql_num_rows($result);
$query = "select ID from authors where status=1;";
$result = mysql_query($query,$connection) or die(mysql_error());
$bannedauthors = mysql_num_rows($result);
$query = "select SUM(articleviews.views) from articleviews";
$result = mysql_query($query,$connection) or die(mysql_error());
$getviews = mysql_fetch_array($result);
$totalviews = $getviews['SUM(articleviews.views)'];
$metatitle = "Admin Control Panel Homepage";
include ('includes/document_head.php');
?>
<div id="wrapper">
<?php include 'includes/topbar.php'?>
<?php include 'includes/sidebar.php'?>
<div class="main_container container_16 clearfix">
<div class="flat_area grid_16">
<h2>Welcome to <strong><?php echo $sitetitle; ?></strong> Admin Panel</h2>
<p>This admin control panel allows you to <strong>effortlessly monitor and manage</strong> all aspects of your article directory. Use the sections along the left to navigate through the different areas of your site: </p>
<p><strong>Articles</strong> - Create new articles, approve articles in the queue, view active articles and more.</p>
<p><strong>Authors</strong> - View and manage the users who have signed up to submit articles to your directory.</strong></p>
<p><strong>Categories</strong> - You have full control over the categories and sub-categories that display on your directory.</strong></p>
<p><strong>Pages</strong> - These are non-article pages of content that display across your directory.</strong></p>
<p><strong>Settings</strong> - Manage your site title, logo, admin account settings, and even advertisement positions.</strong></p>
</div>
</div>
<div class="main_container container_16 clearfix">
<h2 class="text_highlight">Directory Vitals</h2>
<div class="box grid_8">
<h2 class="box_head round_top">Article Statistics</h2>
<div class="block">
<p>Your directory currently has <b><?php echo $totalarticles; ?> total articles</b>. Of these, <?php echo $activearticles; plural($activearticles) ?> active, <?php echo $reviewarticles; plural($reviewarticles)?> under review, and <?php echo $problemarticles; plural($problemarticles) ?> marked problem. Between all articles, you have <b><?php echo $totalviews; ?> total article views.</b></p><br/>
</div></div>
<div class="box grid_8">
<h2 class="box_head round_top">Author Statistics</h2>
<div class="block">
<p>Your directory currently has <b><?php echo $totalauthors; ?> registered authors</b>. The average number of article submissions per author is <?php echo @number_format(($totalarticles / $totalauthors), 2); ?>. You have <?php echo $bannedauthors; ?> banned authors. </p><br/>
</div>
</div>
</div>
<?php include 'includes/closing_items.php'?>