Вход Регистрация
Файл: blog_ecsx/post.php
Строк: 66
<?php
/*

** TJCompany
** Delovoper: TJersy
** Date: 11.2014

*/


require_once('private.files/core.file.php');

$title = ('Добавление новой статьи');


if (isset(
$_GET['id']) && $db->query("SELECT * FROM `articles` WHERE `id` = '".num($_GET['id'])."'") ->num_rows==true){

$a $db->query("SELECT * FROM  `articles` WHERE `id`  = '".num($_GET['id'])."'")-> fetch_assoc();

if(
$db->query("SELECT * FROM `views` WHERE `id_user` = '$user[id]' AND `id_article` = '$a[id]'") -> num_rows != true){

$db->query("INSERT INTO `views` SET `id_user` = '$user[id]',`id_article` = '$a[id]'");

$db->query("UPDATE  `articles` SET `views` = `views` +  '1' WHERE `id` = '$a[id]'");

header('Location:?');

}


$title $a['theme'];

$mess bb($a['text']);

echo 
'<meta name="description" content="'.cutStr($mess,300).'" />';

require_once(
'private.files/head.file.php');

if(!isset(
$user)){ $_SESSION['message'] = 'Сайт закрыт для гостей, авторизуйтесь или зарегистрируйтесь'header('Location: /');}

echo 
'<div class="name"> '.$a['theme'].' </div>';

if(isset(
$_POST['in'])){

if(
$db->query("SELECT * FROM `save_article` WHERE `id_user` = '$user[id]' AND `id_article` = '$a[id]'") -> num_rows != true){

$db->query("INSERT INTO `save_article` SET `id_user`='$user[id]', `id_article` = '$a[id]'");

echo 
'<div class="complate"> Статья добавлена в ваши закладки </div>';

}
}





echo 
'<div class="wrap"> '.bb($a['text']).'<br/><br/><center>'.($db->query("SELECT * FROM `save_article` WHERE `id_user` = '$user[id]' AND `id_article` = '$a[id]'") -> num_rows != true?'<form action="" method="POST"> <center><input type="submit"  name="in" value = "Сохранить в закаладках"> </center></form>':' <b>Статья добавлена в закладки</b>').' </center></div>';

echo 
'<div class="wrap">'.($user['id']==$a['id_user']?'<a href="/redact/'.$a['id'].'"> Редактировать статью </a><br/>':'').'Добавил: '.who($a['id_user']).'<br/>Статью сохранили: '.$db->query("SELECT * FROM `save_article` WHERE `id_article` = '$a[id]'")->num_rows.'<br/><br/><img src="/design.files/views.png"> Просмотры: '.$a['views'].' <br/><img src="/design.files/time.png"> Время публикации: '.timer($a['time']).' <br/> <br/>';
?>

<script type="text/javascript">(function() {
  if (window.pluso)if (typeof window.pluso.start == "function") return;
  if (window.ifpluso==undefined) { window.ifpluso = 2;
    var d = document, s = d.createElement('script'), g = 'getElementsByTagName';
    s.type = 'text/javascript'; s.charset='UTF-8'; s.async = true;
    s.src = ('https:' == window.location.protocol ? 'https' : 'http')  + '://share.pluso.ru/pluso-like.js';
    var h=d[g]('body')[0];
    h.appendChild(s);
  }})();</script>
<div class="pluso" data-background="transparent" data-options="small,round,line,horizontal,nocounter,theme=01" data-services="vkontakte,odnoklassniki,facebook,twitter,google,moimir,email,print"></div>


<?echo '<br/>Ссылка на статью: <br/><input type="text" value="http://'.text($_SERVER['HTTP_HOST']).'/post/'.num($a['id']).'"><br/></div>';




}else{

header('Location:/');}

require_once(
'private.files/foot.file.php');


?>
Онлайн: 2
Реклама