<?php
// INCLUDE HEADER IN PAGE
include('other_header.php');
// GET CURRENT DATE AND TIME
$date = date('Y-m-d H:i:s');
if(isset($_POST['success'])) {
	if($_POST['success'] == 'loggedin') {
	?>
	<div style="margin-top: -80px;" class="alert alert-success" role="alert">
		<strong>Well done!</strong> Successfully logged in.
	</div>
	<?php
	}
	}
	?>
  <div class="container">
    <div class="text-center">
      <h1><?php echo $title; ?>
      	<small>/
      			<?php
						$accounttypenow = $_SESSION['acctype'];
						if($accounttypenow == 0){//Publisher
					?>
							Active is: Publisher Account
					<?php
						}
						if($accounttypenow == 1){//Advertiser
					?>
							Active is: Advertiser Account
					<?php
						}
					?>
			</small>
		</h1>
 	 </div>
		</br>
	<div class="text-center">
      <h1><small>Website Contests</small></h1>
 	</div>
		<div class="col-sm-8 col-md-offset-2">
          <?php
			$query = "SELECT * FROM Web_Contests";
			$result = mysql_query($query) or die('Error, query failed');

			// print the random numbers
			
			if(mysql_num_rows($result)<1){
   echo "<div class='panel panel-default'>
            <div class='panel-heading'>
              <h3 class='panel-title'>No Contests</h3>
            </div>
            <div class='panel-body'>
            	There isn't any contest yet.
            </div>
          </div>";
   }else{
	$numberofnew = 0;
     while($row = mysql_fetch_array($result))
				{
					$numberofnew = $numberofnew + 1;
					if (empty($row['title'])) {
									$row['title'] = "---";
					};
					echo "<div class='panel panel-default'>
            <div class='panel-heading'>
              <h3 class='panel-title'>{$numberofnew}. {$row['title']}</h3>
              <small style='float:left'>/Start Date: {$row['startdate']}</small>
              <small style='float:right'>/End Date: {$row['enddate']}</small></br>
              <small style='float:left'>/Price: {$acu['ISO']} {$row['price']}</small>
              <small style='float:right'>/Winner: {$row['winner']}</small></br>
            </div>
            <div class='panel-body'>
            	<b>Description:</b> {$row['description']}</br>
            </div>
          </div>";

				}

       }
	?>
      </div>
</div>

<?php
include('other_footer.php');
?>
