Location: PHPKode > projects > ArticleSetup > ArticleSetup-v1-1/upload/admin/authors.php
<?php 
	session_start();
	include ('../config.php');
	include ('secureadmin.php');
			
			
	if(isset($_GET['status'])) { 
	
	$currentstatus = $_GET['status'];
	
	if($currentstatus == 0) {
		$newstatus = 1;
	} else {
		$newstatus = 0;
	}
	
	$banid = $_GET['id'];
	
		$sql = "UPDATE authors SET status =".$newstatus." where id =".$banid;
			$query = mysql_query($sql);
			header('Location: authors.php?ban=true');
			exit();	
}



	$metatitle = "Author Management - Admin Control Panel";
	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>Author Management</h2>
				<p>Here you can manage the authors who have registered for an account on your directory. As admin, you have the ability to manage the author's settings. Additionally, authors can be "banned." A banned author is prohibited from submitting new articles. However, they may still login to their account and all active articles by this author will remain active.</p> 
				<p><b>Click an author's name</b> to view and edit their details, and to see a table with all their articles:</p><br/>
			</div>
<?php 
	if($_GET["ban"] == "true") {
	echo '<center><p"><b>Author Status Updated</b></p></center>';
	} 
?>

			<div class="box grid_16 round_all">
				<table class="display table"> 
					<thead> 
						<tr> 
							<th>AuthID</th> 
							<th>Name</th> 
							<th>Email</th> 
							<th>Pen Name</th> 
							<th>Status</th> 
							<th>All Articles</th>
						</tr> 
					</thead> 
					<tbody> 
					
					
<?php // Populates the Dropdown list with all categories and subcats
	$query = "select * from authors;"; 
	$result = mysql_query($query,$connection) or die(mysql_error());
	$num_results = mysql_num_rows($result);
	
	for ($i=0; $i <$num_results; $i++) { 
		$row = mysql_fetch_assoc($result);
		
		if($row['status'] == 0) {
			$status = "Active";
			$action = "Ban";
		} else {
			$status = "Banned";
			$action = "Restore";
		}
	
		$totalquery = "select * from articles where authorid = ".$row['id']; 
		$totalresult = mysql_query($totalquery,$connection) or die(mysql_error());
		$totalarticles = mysql_num_rows($totalresult);
	
		echo "<tr> <td>".$row['id']."</td> 
			 <td><a href=\"authoredit.php?id=".$row['id']."\">".$row['fname']."</a></td> 
			 <td>".$row['email']."</td>
			 <td>".$row['displayname']."</td>
			 <td>".$status." (<a href=\"authors.php?status=".$row['status']."&id=".$row['id']."\">".$action."</a>)</td>
			 <td>".$totalarticles."</td></tr>";
		}
?>

					</tbody> 
				</table>
			</div>


				</div>				
			
			
			


			
		</div>	
<?php include 'includes/closing_items.php'?>
Return current item: ArticleSetup