<?php 
	session_start();
	include ('../config.php');
	include ('secureadmin.php');
				
	include 'includes/imageupload.php';
	
	$query = "select * from adboxes where id=1;"; 
	$result = mysql_query($query,$connection) or die(mysql_error());
	$info = mysql_fetch_assoc($result);
	$ad250 = $info['adcode'];

	$query = "select * from adboxes where id=2;"; 
	$result = mysql_query($query,$connection) or die(mysql_error());
	$info = mysql_fetch_assoc($result);
	$ad468 = $info['adcode'];
	
	$query = "select * from adboxes where id=3;"; 
	$result = mysql_query($query,$connection) or die(mysql_error());
	$info = mysql_fetch_assoc($result);
	$ad120 = $info['adcode'];

	
	
	if(isset($_POST['update'])) { 
	$adcode250 = mysql_real_escape_string($_POST['250']);
	$adcode468 = mysql_real_escape_string($_POST['468']);
	$adcode120 = mysql_real_escape_string($_POST['120']);
				
	$sql = "UPDATE `adboxes` SET adcode='".$adcode250."' where id=1";
	$query = mysql_query($sql);
	
	$sql = "UPDATE `adboxes` SET adcode='".$adcode468."' where id=2";
	$query = mysql_query($sql);
	
	$sql = "UPDATE `adboxes` SET adcode='".$adcode120."' where id=3";
	$query = mysql_query($sql);
	
	header('Location: adsettings.php?update=true');
	exit();
}
	$metatitle = "Ad 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>Advertisement Settings</h2>
				<p>Your directory displays a number of advertisements. This page helps you easily manage which ads are displayed in each position. Each box corresponds with a particular ad slot on your front-end site. Simply paste an appropriately-sized advertisement code (i.e. Google AdSense) in the box. <b>TIP:</b> leave a box blank to remove ads from that position. </p>
			
			<br/>
	<div class="box grid_16 round_all">
	<div class="block">
	<h2>Manage Your Ad Positions</h2>
			
	<form name="submission" enctype="multipart/form-data" method="POST" action="adsettings.php">

	
	<b>250 x 300:</b>
	<p>This size is shown in the right sidebar (homepage, categories). <br/>
	And, it is shown in-content on each article. </p>	
	<textarea class="mceNoEditor" name="250" style="width:350px; height: 150px;"><?php echo stripslashes($ad250); ?></textarea>
	<br/>
	
	<b>468 x 60:</b>
	<p>This size is shown in the header of many pages. </p>	
	<textarea class="mceNoEditor" name="468" style="width:350px; height: 150px;"><?php echo stripslashes($ad468); ?></textarea>
	<br/>
	
	<b>120 x (variable):</b>
	<p>This size is shown in the left navigation bar, above "categories". </p>	
	<textarea class="mceNoEditor" name="120" style="width:350px; height: 150px;"><?php echo stripslashes($ad120); ?></textarea>
	<br/>

	<div style="clear:both"></div>
	
	<input name="update" type="hidden" id="update" />
	<button type="submit" id="submitstyle" name="save" class="button_colour round_all"><img height="24" width="24" alt="Bended Arrow Right" src="images/icons/small/white/Bended Arrow Right.png"><span>Update Ad Boxes</span></button>

</form>
<div style="clear:both"></div>
	<br/><p><b>TIP:</b> Additional ads can be manually added by editing the front-end template files in your root install directory. The files to edit include: sidebar.php, rightsidebar.php, header.php, category.php, article.php, and index.php, respectively. </p>	
<br/>
</div>
	</div>



	</div>



			</div>
			
			
			
		</div>	
<?php include 'includes/closing_items.php'?>