File size: 1.28Kb
<?
include_once '../../sys/inc/start.php';
include_once '../../sys/inc/compress.php';
include_once '../../sys/inc/sess.php';
include_once '../../sys/inc/home.php';
include_once '../../sys/inc/settings.php';
include_once '../../sys/inc/db_connect.php';
include_once '../../sys/inc/ipua.php';
include_once '../../sys/inc/fnc.php';
include_once '../../sys/inc/user.php';
// Только для пользователей
if (isset($user)){
define ('id', isset( $_GET['id'] ) ? abs(intval($_GET['id'])) : 0);
$act = mysql_fetch_assoc(mysql_query("SELECT * FROM `news` WHERE `id` = '".id."' LIMIT 1"));
// проверяем существует новость
if (!empty($act)) {
$check = mysql_result(mysql_query("SELECT COUNT(*) FROM `news_read` WHERE `news` = '".$act['id']."' AND `user` = '".$user['id']."'"),0);
if(empty($check)){
mysql_query("INSERT INTO `news_read` (`user`, `news`, `time`) VALUES ('$user[id]', '".$act['id']."', '$time')");
$_SESSION['message'] = 'Новость успешно скрыта';
header("location: /");
}else{
header("location: /");
}
}else{
$_SESSION['message'] = 'Ошибка';
header("location: /");
}
}else{
$_SESSION['message'] = 'Ошибка';
header("location: /");
}
?>