Location: PHPKode > projects > ArticleSetup > ArticleSetup-v1-1/upload/admin/authoredit.php
<?php 
	session_start();
	include ('../config.php');
	include ('secureadmin.php');
	include ('paginator.php');
		
	$metatitle = "Edit Author - Admin Control Panel";
	include ('includes/document_head.php');
	
	$authorid = $_GET['id'];
	
	
	$query = "select * from authors where id = ".$authorid.";"; 
	$result = mysql_query($query,$connection) or die(mysql_error());
	$info = mysql_fetch_assoc($result);
	// get this category's information
	$name = $info['fname'];
	$status = $info['status'];
	$email = $info['email'];
	$username = $info['username'];
	$displayname = $info['displayname'];
	$bio = $info['bio'];	
	$url = $info['url'];	
	$avatar = $info['gravatar'];	
	
	if($status == 0) {
		$status = "Active";
		$action = "Ban";
	} else {
		$status = "Banned";
		$action = "Restore";
	}

		
?>
		<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">
			
			
		
	<div class="box grid_8 round_all">
		<div class="block">
			<h2>Profile Settings for <?php echo $name; ?></h2>
					
	

	
	<div style="float:left; padding: 7px;"><img src="<?php echo $avatar; ?>" /></div>
	
	<b>Pen Name:</b> <?php echo $displayname; ?><br/><br/>
	
	<b>Homepage:</b> <a href="<?php echo $url; ?>"><?php echo $url; ?></a><br/><br/>
	<div style="clear: both;"></div>
	<b>Bio:</b> <br/><div style="width: 300px;"><?php echo $bio; ?></div><br/>
	
			</div>
		</div>



			<div class="box grid_8 round_all">
			<div class="block">
	<h2>Account Settings for <?php echo $name; ?></h2>
					
	<b>Name:</b> <?php echo $name; ?><br/><br/>
		
	<b>Username:</b> <?php echo $username; ?><br/><br/>
	
	<b>Status:</b> <?php echo $status; ?><br/><br/>
	
	<b>Email:</b> <?php echo $email; ?><br/><br/>
	
			<a href="authors.php?status=<?php echo $info['status']; ?>&id=<?php echo $authorid; ?>"><button  class="skin_colour round_all"><img width="24" height="24" src="images/icons/small/white/Create Write.png"><span><?php echo $action; ?> User</span></button></a>


	<br/><br/><br/>
	
			</div>
		</div>
		

	</div>
	

<?php 
// Setup pagination controls
	$rowsquery = "select * from articles where authorid=".$authorid."";
	$rowsresults = mysql_query($rowsquery,$connection) or die(mysql_error());
	$rows_results = mysql_num_rows($rowsresults);
	
	$pages = new Paginator;
	$pages->urlparam = "?id=".$authorid."";
	$pages->items_total = $rows_results;
	$pages->mid_range = 9;
	$pages->paginate();

	if ($pages->items_total) {	
		$query = "select * from articles where authorid=".$authorid." order by date asc ".$pages->limit;
	} else {
		$query = "select * from articles where authorid=".$authorid." order by date asc";
	}

	$articleresults = mysql_query($query,$connection) or die(mysql_error());
	$num_results = mysql_num_rows($articleresults);
	
	// for display of page #
	$pagenum = $_GET['page'];
	if (!$pagenum)
		$pagenum = 1;
		

?>

	<br/><br/>
	<h2>All Articles by <?php echo $name; ?> (<?php echo $rows_results; ?>)</h2>
					<?php echo "<div style=\"float:right; font-weight: bold;\">(Page ".$pagenum.") &nbsp; &nbsp;".$pages->display_pages()."</div><br/>"; ?>

				<div class="box grid_16 round_all">
				<table width="100%" class="listing"> 
					<thead> 
						<tr> 
							<th>ID</th> 
							<th>Date</th>
							<th>Author</th> 
							<th>Title</th> 
							<th>Views</th>
							<th>Status</th>
						</tr> 
					</thead> 
					<tbody> 
					
					
<?php // Populates the Dropdown list with all categories and subcats		
	
	for ($i=0; $i <$num_results; $i++) { 
		$row = mysql_fetch_assoc($articleresults);
		
		$date = strtotime($row['date']);
		$artdate = date('m/d/y', $date);
		
		
		// Get Author Display Name
		$authquery = "select * from authors where id=".$row['authorid']; 
		$authresult = mysql_query($authquery,$connection) or die(mysql_error());
		$authinfo = mysql_fetch_assoc($authresult);
		
		// Get Views
		$viewquery = "select * from articleviews where articleid=".$row['id']; 
		$viewresult = mysql_query($viewquery,$connection) or die(mysql_error());
		$viewinfo = mysql_fetch_assoc($viewresult);
		$views = $viewinfo['views'];
		if (!$views) $views = "-";

		if($row['status'] == 0) {
			$status = "Active";
		} elseif($row['status'] == 1) {
			$status = "In Review";
		} else {
			$status = "Problem";
		}
		
		echo "<tr> <td>".$row['id']."</td> 
			 <td>".$artdate."</td> 
			 <td>".$authinfo['displayname']."</td>
			 <td><a href=\"articleedit.php?id=".$row['id']."\">".$row['title']."</a></td>
			 <td>".$views."</td>
			 <td>".$status."</td></tr>";
		}
?>

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

<?php 
	//display pagination
	echo "<div style=\"float:right; font-weight: bold;\"> (Page ".$pagenum.") &nbsp; &nbsp;".$pages->display_pages()."</div><br/>";

	?>			

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