<?php
include_once("../include/main.inc.php");
check_session('MyCpanel','index.php');

$id=$_REQUEST['id'];
if($id=="Update"){
	db_query("update logfile set subject='$_POST[subject]' ,newsletter='$_POST[message]'");
	$_SESSION[session_message]='**Newsletter Content has been updated.';
	header("Location: ".SITE_ADMIN_URL."/sendmail.php");
	exit();
	echo mysql_error();
}

$res=db_fetch_array(db_query("select * from logfile"));
admin_header();
print_message();
?>

<script type="text/javascript" src="fckeditor/fckeditor.js"></script>
<script language="javascript" src="<?=SITE_URL_PATH;?>/validate.js" type="text/JavaScript"></script>
<form name="formn" action="" method="post" onsubmit="return sendmail(this);">
<table width="100%"  border="0" cellpadding="6" cellspacing="2" class="lightBorder">
 <tr>
  <td class="lightGrayBg">&nbsp;</td>
  <td align="right" class="lightGrayBg"><a href="newsletter.php"><b>Send Newsletter</b></a></td>
 </tr>
 
 <tr>
  <td class="lightGrayBg"><b>Subject</b></td>
  <td class="lightGrayBg">
   <input type=text name="subject" value="<?=stripslashes($res[subject])?>" size=60>
  </td>
 </tr>
 <tr>
  <td valign="top" class="lightGrayBg"><b>Message</b></td>
  <td class="lightGrayBg"><textarea name="message" cols=50 rows=8><?=$res[newsletter]?></textarea></td>
 </tr>
 <tr>
  <td class="lightGrayBg">&nbsp;</td>
  <td align="left" class="lightGrayBg">
   <input class="button" type="submit" name="id" value="Update" >
  </td>
 </tr>
</table>
</form>

<script type="text/javascript">
var oFCKeditor=new FCKeditor('message');
oFCKeditor.BasePath="fckeditor/";
oFCKeditor.ReplaceTextarea();
</script>

<?php
admin_footer();
exit;	
?>