<?php

$title ='Новости';

include_once 'protected/sys.php';


if(isset($_GET['read'])){
	$db->query('UPDATE `users` SET `read_news`=? WHERE `id`=?',array(0,$user['id']));
	header('location: /');
}



?>
<a href="?read">скрыть новости на главной</a>
<?


$allnews = $db->fetchAll("SELECT * FROM `news` ORDER BY `id` DESC",null);

if (is_array($allnews))
{
	foreach ($allnews as $data)
	{
		?>
		<div class ='menu'/>
			<center>
				<i>
					<?=$data['title'];?>
				</i>
			</center>
			<br/>
			<span class='grey2'/>
				<?=htmlspecialchars($data['text']);?>
			</span>
		</div>
		<?
	}
}

include_once $config['root'].'/protected/footermain.php';