Файл: 04/04/article.php
Строк: 112
<?
include("news_config.php");
if(file_exists("install.php")){
die("<br><br><center style='font-size: 12px;
font-family: Verdana, Arial, Helvetica, sans-serif;'>Вы не удалили файл install.php!</center>");
}
if($action == "add"){
$title = "Добавление статьи";
}else{
$title = "Редактирование статьи";
}
if($passwd == $sha){
if($action == "delete"){
$query="DELETE FROM `news` WHERE `id` = '$id'";
mysql_query($query);
mysql_close();
header("Location: index.html");
}
$date = date("d.m.Y");
if($Submit){
if($passwd == $sha){
$query="INSERT into news VALUES('', '$head', '$full', '0', '$date')";
mysql_query($query);
echo "<br><br><center class='style3'><b>Статья добавленна!</b></center>";
}
}
if($Submit1){
if($passwd == $sha){
$query="UPDATE `news` SET `head` = '$head', `full` = '$full', `date` = '$date' WHERE `id` = '$id'";
mysql_query($query);
echo "<br><br><center class='style3'><b>Статья обновленна!</b></center>";
}
}
?>
<?
if($action == "edit"){
$conn = mysql_query("SELECT * FROM `news` WHERE `id` = '$id'")
or die(mysql_error());
$row = mysql_fetch_array($conn);
}
?>
<!-- This script powered by www.WebCommersant.ru -->
<html>
<head>
<title><? echo $title; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<meta http-equiv="Content-Style-Type" content="text/css">
<link href="style.css" type="text/css" rel="stylesheet">
</head>
<body bgcolor=#EBEBEB leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>
<table width=766 border=0 cellpadding=0 cellspacing=0 align="center">
<tr>
<td width=766 height=34 alt="" valign="top">
<table width=766 border=0 cellpadding=0 cellspacing=0>
<tr><td><img src="images/top_left.jpg" width=75 height=34 alt=""></td>
<td background="images/top_px.jpg"><img src="images/spacer.gif" width=607 height=34 alt=""></td>
<td><img src="images/top_right.jpg" width=84 height=34 alt=""></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="766" height="100%" alt="" valign="top">
<table width="766" border=0 cellpadding=0 cellspacing=0>
<tr>
<td valign="top" background="images/left_px.jpg"><img src="images/left.jpg"></td>
<td width="621" height="100%" alt="" valign="top" bgcolor="#FFFFFF">
<table width="621" border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=621 height=58 alt="" valign="top">
<table width="100%" height="0%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="621" height="169" valign="top" style="background-position:right; background-repeat:repeat-y; padding:15px; line-height:14px"><form id="form1" name="form1" method="post" action="article.php">
<table width="100%" border="0" cellspacing="10" cellpadding="0">
<tr>
<td width="15%" class="style3"><div align="right">Заголовок:</div></td>
<td width="85%"><label>
<?
if($action == "edit"){
echo "<input name='head' type='text' class='style3' id='head' value='$row[head]' />";
}else{
echo "<input name='head' type='text' class='style3' id='head' />";
}
?>
</label></td>
</tr>
<tr>
<td class="style3"><div align="right">Дата:</div></td>
<td>
<?
if($action == "edit"){
echo "<input name='date' type='text' class='style3' id='date' value='$row[date]' />";
}else{
echo "<input name='date' type='text' class='style3' id='date' value='$date' />";
}
?>
</td>
</tr>
<tr>
<td><input name="id" type="hidden" value="<? echo $row[id]; ?>" /></td>
<td><label>
<?
if($action == "edit"){
echo "<textarea name='full' cols='70' rows='30' class='style3' id='full'>$row[full]</textarea>";
}else{
echo "<textarea name='full' cols='70' rows='30' class='style3' id='full'></textarea>";
}
?>
</label></td>
</tr>
<tr>
<td> </td>
<td><label>
<?
if($action == "edit"){
echo "<input type='submit' name='Submit1' value='Обновить' />";
}else{
echo "<input type='submit' name='Submit' value='Добавить' />";
}
?>
</label></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td valign="top" background="images/right_px.jpg"><img src="images/right.jpg"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width=766 height=51 alt="" valign="top">
<table width=766 border=0 cellpadding=0 cellspacing=0>
<tr>
<td><img src="images/bot_left.jpg" width=73 height=51 alt=""></td>
<td background="images/bot_px.jpg" width=609 height=51 alt="" valign="top" style="padding-top:13px "></td>
<td><img src="images/bot_right.jpg" width=84 height=51 alt=""></td>
</tr>
</table>
</td>
</tr>
</table>
<center class="style3">Copyright ©2006 <a href="http://webcommersant.ru">www.WebCommersant.ru</a><br>Powered by NewsBlog v1.1</center><br>
</body>
</html>
<?
}else{
echo "<br /><br /><center class='style3'><b>Доступ запрещён!</b></center>";
}
?>