"Архив новостей", "news/rss/" => "Экспорт новостей", "news/add_news/" => "Добавить новость"); $keywords = "новости медицины, поиск лекарств, аптеки Фетида, медицинские новости, новости сайта, экспорт новостей, архив новостей"; $title = "Новости медицины"; $query = "SELECT number, date_format(date,'%e.%m.%Y') as date1, name, text, autor FROM news WHERE date <= '".date("Y-m-d")."' ORDER BY date DESC LIMIT 5"; $result = mysql_query($query); $news_arr = array(); while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { $stroka = split("\.", $line['text']); $anons = $stroka[0].$stroka[1]; $news_arr[] = array('num' => $line['number'], 'name' => $line['name'], 'anons' => $anons); } mysql_free_result($result); mysql_close($connect); $smarty->assign('title', $title); $smarty->assign('news_arr', $news_arr); $smarty->display('news_index_new.tpl'); } //функция печати запрошенной новости function novost(){ if (empty($_GET['num']) || preg_match("/[^0-9]/", $_GET['num'])){ header("Location: /error.php"); exit; } require('time.php'); require('setup.php'); require "mysql_connect.php"; $num = $_GET['num']; $title = "Новости сайта"; $osn_txt = ""; $query = "SELECT number, date_format(date,'%e.%m.%Y') as date1, name, text, autor FROM news WHERE number = $num"; $result = mysql_query($query); if (mysql_num_rows($result) == 0) { header("Location: /error.php"); exit(); } $news_arr = array(); while($line = mysql_fetch_array($result, MYSQL_ASSOC)) { $title = $line['name']; $news_arr['text'] = $line['text']; $news_arr['date'] = $line["date1"]; $news_arr['autor'] = $line["autor"]; } mysql_free_result($result); mysql_close($connect); $smarty->assign('title', $title); $smarty->assign('news_arr', $news_arr); $smarty->display('news_novost_new.tpl'); } switch ($_GET['f']) { case 'index': news(); break; case 'novost': novost(); break; default: header("Location: /error.php"); } ?>