<?php
if ($_GET['go'] == 'go') {
$subject = htmlspecialchars($_POST['subject']);
$text = addslashes($_POST['text']);
$description = htmlspecialchars($_POST['description']);
$keywords = htmlspecialchars($_POST['keywords']);
if (!$subject) {
print '<p class="er">Укажите тему новости!</p>';
} elseif (!$text) {
print '<p class="er">Введите текст новости!</p>';
} else {
$now = date('d.m.Y');
$sql = "INSERT INTO news (subject, msg, date, keywords, description) values ('".$subject."','".$text."','".$now."', '".$keywords."', '".$description."')";
$result = mysql_query($sql);
include "modules/rss.php";
print '<p class="erok">Новость добавлена!</p>';
}
}
?>
<script type="text/javascript" src="editor/tiny_mce_src.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "exact",
elements : "elm1",
theme : "advanced",
plugins : "cyberfm,safari, inlinepopups,advlink,advimage,advhr,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave",
language: "ru",
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,sub,sup,|,justifyleft,justifycenter,justifyright,justifyfull,hr,|,forecolor,backcolor,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "pasteword,|,bullist,numlist,|,link,image,media,|,tablecontrols,|,replace,charmap,cleanup,fullscreen,preview,code",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
content_css : "/files/styles.css",
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "lists/image_list.js",
media_external_list_url : "lists/media_list.js",
template_replace_values : {
username : "Some User",
staffid : "991234"
}
});
</script>
<LEGEND><b>Добавить новость</b></LEGEND>
<form action="?a=news&go=go" method="post" name="mainForm">
<table width="612" align="center" border="0" style="width: 612px;">
<tr>
<td style="padding-left: 2px;">Тема новости:</td>
<td align="right"><input class="inp" style="width: 490px;" type="text" name="subject" size="97" /></td>
</tr>
<tr>
<td align="center" style="padding-bottom: 10px;" colspan="2">
<textarea id="elm1" style="width: 605px;" name="text" cols="103" rows="20"></textarea>
</td>
</tr>
<tr>
<td style="padding-left: 2px;">Ключевые слова:</td>
<td align="right"><input class="inp" style="width: 490px;" type="text" name="keywords" maxlength="250" /></td>
</tr>
<tr>
<td style="padding-left: 2px;">Описание страницы:</td>
<td align="right"><input class="inp" style="width: 490px;" type="text" name="description" maxlength="250" /></td>
</tr>
</table>
<table align="center" width="624" border="0">
<tr>
<td align="right"><input class="input dfs3" type="image" src="images/save.gif" border="0" value="Сохранить" title="Сохранить!"></td>
</tr>
</table>
</form>