<?php
session_start();
header("Cache-control: private"); 

if ($_SESSION["denglu"] != 1)
{
	echo "<h3>you have not logged in</h3>";
	echo "If you are an administrator, <a href=../login.php>login here</a><br>";
	echo "If you are not administrator, <a href=../index.htm>visit our website</a>";
	exit;
}

$title = "delete news";
include "header.php";

if ($_SESSION["denglu"] == 1)
{
	include "../conn.php";
	
	$query = "select date, subject, highlight, id from news order by date desc";
	
	$result = mysql_query($query);
	
	echo "<form action=delete_handler.php method=post>";
	
	echo "<table border=0 bordercolor=black width=80%>";
	
	while ($row = mysql_fetch_array($result))
	{
		?>
		<tr>
		  <td><?php echo $row[0]?></td>
		  
		  <td>
		  <?php 
		  echo "<a href=edit.php?id=$row[3]>$row[1]</a>";
		  ?>
		  </td>
		  
		  <td>
		  <?php 
		  {
		  	$chkbx =  '<input type="checkbox" name="id';
		  	$chkbx .= $row[3] . '">';
		  	echo $chkbx;
		  }
		  ?>
		  </td>
		</tr>
		<?php
		
	}
	
	echo '<tr><td colspan=3 align=right><input type=submit value="delete selected"></td></tr>';
	
	echo "</table>";
	echo "</form>";
}
else
{
	echo "<p><center><table width=80%>You must login as Administrator to access this page</table></center>";
}
include "footer.php";
?>