Файл: 04/04/view.php
Строк: 169
<?
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 == "delcomment"){
if($passwd == $sha){
$query="DELETE FROM `comments` WHERE `id` = '$id'";
mysql_query($query);
echo "<META HTTP-EQUIV='Refresh' CONTENT='100; URL=article_$news_id.html'>";
}else{
echo "<br /><br /><center class='style3'><b>Доступ запрещён!</b></center>";
}
}
if($Submit){
if(empty($name)){ echo "<META HTTP-EQUIV='Refresh' CONTENT='0; URL=article_$id_article.html'>"; exit;}
if(empty($textarea)){ echo "<META HTTP-EQUIV='Refresh' CONTENT='0; URL=article_$id_article.html'>"; exit;}
function replace($string)
{
$string = strip_tags($string);
$string = htmlspecialchars($string);
return trim($string);
}
$name = replace($name);
$email = replace($email);
$textarea = replace($textarea);
$text = substr($textarea,0,500);
$query="INSERT into comments VALUES('', '$id_article', '$name', '$email', '$text')";
mysql_query($query);
echo "<META HTTP-EQUIV='Refresh' CONTENT='0; URL=article_$id_article.html'>";
}
$idex = mysql_query("SELECT * FROM `news` WHERE `id` = '$news_id'");
if($t = mysql_fetch_array($idex)){
if(empty($news_id)){
header("Location: index.html");
}
$conn = mysql_query("SELECT * FROM `news` WHERE `id` = '$news_id'")
or die(mysql_error());
$row = mysql_fetch_array($conn);
$n=0;
$n++;
$result = $n + $row['view'];
$query="UPDATE `news` SET `view` = '$result' WHERE `id` = '$news_id'";
mysql_query($query);
$desc = substr($row[full],0,200);
?>
<!-- This script powered by www.WebCommersant.ru -->
<!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 transitional//EN" "http://www.w3.org/tr/xhtml1/Dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><? echo $row[head]; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<meta name="keywords" content="<? echo $row[head]; ?>">
<meta name="description" content="<? echo strip_tags($desc); ?>">
<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">
<table width="100%" border="0" cellspacing="10" cellpadding="0">
<tr>
<td><div align="right"><span class="style3"><a href='index.html'>на главную</a> | <a href='print_<? echo $news_id; ?>.html'>версия для печати</a></span></div></td>
</tr>
<tr>
<td class="style3"><span class="style2"><b><? echo $row[head]; ?></b></span></td>
</tr>
<tr>
<td class="style3"><div align="justify"><? echo $row[full]; ?></div></td>
</tr>
<tr>
<td class="style3"><hr /><b>Добавить комментарий</b>
<form id="form1" name="form1" method="post" action="view.php">
<table width="60%" border="0" align="center" cellpadding="0" cellspacing="2">
<tr>
<td width="35%"><div align="right"><span class="style3">Имя:</span></div></td>
<td width="65%"><label>
<input name="name" type="text" class="style3" maxlength="15" />
</label></td>
</tr>
<tr>
<td><div align="right"><span class="style3">Email:</span></div></td>
<td><input name="email" type="text" class="style3" maxlength="30" />
<input name="id_article" type="hidden" value="<? echo $news_id; ?>" />
</td>
</tr>
<tr>
<td><div align="right"><span class="style3">Комментарий:</span><br /><br /><br /><br /></div></td>
<td><label>
<textarea class="style3" name="textarea" cols="30" rows="5" maxlength="500" /></textarea>
</label></td>
</tr>
<tr>
<td> </td>
<td><label>
<input class="style3" type="submit" name="Submit" value="Добавить" />
</label></td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td class="style3"><hr /><b>Комментарии</b><br />
<?
$con = mysql_query("SELECT * FROM `comments` WHERE `id_article` = '$news_id' order by `id` desc");
$show = "<table class='style3' align='center' width='80%' border='0' cellspacing='10' cellpadding='0'>";
while($res=mysql_fetch_array($con)){
$show.= "<tr><td><b>Имя:</b> $res[name] <br /><b>Email:</b> $res[email]<br /><b>Комментарий:</b> $res[text]";
if($passwd == $sha){
$show.= "<br><a href='view.php?action=delcomment&id=$res[id]&news_id=$news_id'>[удалить комментарий]</a>";
}
$show.= "</td></tr>";
}
echo "</table>";
echo $show;
?>
</td>
</tr>
</table>
</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 "<META HTTP-EQUIV='Refresh' CONTENT='0; URL=index.html'>";
}
?>