<?php
session_start();
include "../functions.php";

$sessionID = session_id();

checkAdmin($sessionID);

?>

<?php

$title = "add news";
//$header = "add a piece of news";
include "header.php";

?>
	<form action="add_handler.php" method="post">
	<tr>
	<td>
	<table border=0 cellpadding=5 width=100%>
	  
	  <tr>
	    <td align="right" valign="top">
	    Date(dd/mm/yyyy):
	    </td>
	    
	    <td align="left" valign="top">
	    <input type="text" name="date" maxleng="30" value=
	    <?php
	    $date = date("Ymd");
	    $year = substr($date, 0, 4);
	    $month = substr($date, 4, 2);
	    $day = substr($date, 6, 2); 
	    echo "$day/$month/$year";
	    ?>
	    >
	    </td>
	  </tr>
	  
	  <tr>
	    <td align="right" valign="top">
	    Subject:
	    </td>
	    
	    <td align="left" valign="top">
	    <input type="text" name="subject" maxleng="30">
	    </td>
	  </tr>
	  
	  <tr>
	    <td align="right" valign="top">
	    Category:
	    </td>
	    
	    <td align="left" valign="top">
	    <select name="categoryID">
	    <?php
	    $query = "select categoryID, categoryName from news_category order by categoryName asc";
	    $result = mysql_query($query) or die (mysql_error());
	    while ($row = mysql_fetch_array($result))
	    {
	    	$categoryID = $row[0];
	    	$categoryName = $row[1];
	    	echo "<option value=\"$categoryID\">$categoryName</option>";
	    }
	    ?>
	    </select>
	    </td>
	  </tr>
	  
	  <tr>
	    <td align="right" valign="top">
	    Author:
	    </td>
	    
	    <td align="left" valign="top">
	    <input type="text" name="author" maxleng="30">
	    </td>
	  </tr>
	  
	  <tr>
	    <td align="right" valign="top">
	    Summary:
	    </td>
	    
	    <td align="left" valign="top">
	    <TEXTAREA NAME="summary" ROWS=5 COLS=30 WRAP="virtual"></TEXTAREA>
	    </td>
	  </tr>
	  
	  <tr>
	    <td align="right" valign="top">
	    Body:
	    </td>
	    
	    <td align="left" valign="top">
	    <TEXTAREA NAME="body" ROWS=5 COLS=30 WRAP="virtual"></TEXTAREA>
	    </td>
	  </tr>
	  
	  <tr>
	    <td align="right" valign="top">
	    URL:
	    </td>
	    
	    <td align="left" valign="top">
	    <input type="text" name="url" maxlength="80" size=30>
	    </td>
	  </tr>
	  
	  <tr>
	    <td align="right" valign="top">
	    Image:
	    </td>
	    
	    <td align="left" valign="top">
	    <input type="text" name="image" maxlength="80" size=30>
	    </td>
	  </tr>
	  
	  <tr>
	    <td align="right" valign="top">
	    Highlight:
	    </td>
	    
	    <td align="left" valign="top">
	    <input type="checkbox" name="highlight">
	    </td>
	  </tr>
	  
	  <tr>
	    <td colspan=2 align="center">
	    <input type="hidden"  name="submit" value=1>
	    <input type="submit" value=" Add ">&nbsp;<input type="reset" value="Cancel">
	    </td>
	  </tr>
	
	</table>
	</td>
	</tr>
	
	</form>
	
	<tr>
	<td>
	<IFRAME SRC="../adm/upload.php" WIDTH=100% HEIGHT=300 frameborder=0>
If you can see this, your browser doesn't 
understand IFRAME.  However, we'll still 
<A HREF="../adm/upload.php" target=_blank>link</A> 
you to the file.
</IFRAME>
	</td>
	</tr>

<?php

include "footer.php";
?>