|
<?
//-----Создаем титл страницы-----//$title = 'Анкета';//-----Подключаем функции-----//require_once ('../system/function.php');//-----Подключаем вверх-----//require_once ('../system/header.php');//-----Если гость,то...----//if(!$user['id']) {header('Location: /index.php');exit();}
switch ($_GET['act']){default:$id = abs(intval($_GET['id']));$status = mysql_fetch_assoc(mysql_query("SELECT * FROM `stena_komm` WHERE `id_news` = '".$id."'"));$st = mysql_fetch_assoc(mysql_query("SELECT * FROM `stena` WHERE `id` = '".$id."'"));$ank = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '".$st['avtor']."'"));if(!isset($st['id'])) {echo '<div class="title">Коментарии</div><div class="podmenu"><center><b>Такого статуса не существует!</b></center></div>';require_once ('../../system/footer.php');exit();}echo '<div class="podmenu">'.smile(bb($st['msg'])).'';$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `stena_komm` WHERE `id_news` = '".$id."'"),0);echo '</br><a href="/user/komm.php?id='.$st['id'].'"><img src="/design/icons/bbl4.png" alt=""/>'.$count.'</a>';$reit_a = mysql_fetch_array(mysql_query('select * from `status_r` where `news` = "'.$st['id'].'" and `kto` = "'.$user['id'].'"'));$reit = mysql_result(mysql_query('select count(`id`) from `status_r` where `news`= "'.$st['id'].'" and `r` = "1"'),0);if($user['id'] != $ank['id'] && $reit_a == 0) {echo ' <a href="'.$HOME.'/like'.$st['id'].'"><img src="'.$HOME.'/images/plus.png" alt="*" />'.$reit.'</a>';echo '</b> ';}else {echo ' <img src="'.$HOME.'/images/plus.png" alt="*" />'.$reit.'';}echo '</div>';echo '<div class="podmenu"><form action="" method="POST">*Сообщение:
<textarea name="msg"></textarea>
<input type="submit" name="ok" value="Написать" /></form></div>';if(isset($_REQUEST['ok'])){ $msg = strong($_POST['msg']);mysql_query("INSERT INTO `stena_komm` SET `id_user` = '".$user['id']."', `msg` = '".$msg."', `id_news` = '".$id."', `time` = '".time()."'");if($user['id'] != $status['id_user']){mysql_query("INSERT INTO `lenta` SET `readlen` = '0', `time` = '".time()."', `komy` = '".$status[id_user]."', `kto` = '".$user[id]."', `text` = 'прокоментировал ваш [url=".$HOME."/user/komm.php?id=".$id."]новость в стене[/url]'");}header('Location: komm.php?id='.$id.'');exit();}if (empty($user['max'])) $user['max']=10;$max = $user['max'];$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `stena_komm` WHERE `id_news` = '".$id."'"),0);$k_page = k_page($k_post,$max);$page = page($k_page);$start = $max*$page-$max;$q = mysql_query("SELECT * FROM `stena_komm` WHERE `id_news`='$id.' ORDER BY `time` DESC LIMIT $start, $max");while ($m=mysql_fetch_assoc($q)){echo "<div class='podmenu'>";echo ''.nick($m['id_user']).' '.vremja($m['time']).'
';echo ''.$m['msg'].'
';if($user['level'] >= 1 or $user['id'] == $m['id_user']){echo '[<a href="'.$HOME.'/user/komm.php?act=delmsg&id='.$m['id'].'">уд</a>]';}echo '</div>';}if($k_post < 1){echo '<div class="podmenu"><center><b>Нет комментариев</b></center></div>';}if ($k_page > 1) {echo str(''.$HOME.'/user/komm.php?id='.$id.'&',$k_page,$page); // Вывод страниц}break;case 'delmsg':$id = abs(intval($_GET['id']));$k = mysql_fetch_assoc(mysql_query("SELECT * FROM `stena_komm` WHERE `id` = '".$id."'"));if(isset($k['id'])){if($user['level'] > 1 or $user['id'] == $k['id_user']){mysql_query("DELETE FROM `stena_komm` WHERE `id` = '".$id."'");header('Location: '.$HOME.'/user/status/komm.php?id='.$k['id_news'].'');exit();}else{header('Location: '.$HOME.'/user/status/komm.php?id='.$k['id_news'].'');}}else{echo '<div class="podmenu"><center><b>Такого статуса не существует!</b></center></div>';}break;}//-----Подключаем низ-----//require_once ('../system/footer.php');
?>