<?
include "./config/admin_config.cgi";
include "./counter/db_count.cgi";
include "./include/main_func.php3";
include "./config/design_config.cgi";
include "./config/config.cgi";
include "./include/top_header.php3";

if (is_file("./html/".$SEARCH_HEADER."_header.cgi")) {
	include "./html/".$SEARCH_HEADER."_header.cgi";
} else {
	include "./html/default_header.cgi";
}

$swhere="display='Y' and newstime <= $time";
$num_per_page = 15;
$page_per_block = 20;
if($page < 1) $page = 1;

if(!$total_record) {
	$query = "select count(*) from article where $swhere";

	$result = mysql_query($query);
	$total_record = mysql_result($result,0,0);
}

$first = $num_per_page*($page-1);
$total_page = ceil($total_record/$num_per_page);

$query="select no,title1,newstime,gisaimg,section,gisaimg,content from article where $swhere order by newstime desc limit $first,$num_per_page";
$res=mysql_query($query); 
if($res) {

echo ("<table width=100% cellpadding=0 cellspacing=0 border='0'>");


while($row=mysql_fetch_array($res)) {

	$title1= stripslashes($row[title1]);
	$newstime=strftime("%Y. %m.%d",$row[newstime]);
	$section=$seid[$row[section]];
	$content= strip_tags(stripslashes($row[content]));
	$summary= cutting($content,220);
	$gosection = sprintf('%03d', $row[section]); // 3자리
	$link="/article.asp?aid=$row[newstime]$row[no]$gosection";

	if($row[gisaimg] && is_file("./upimages/gisaimg/$row[gisaimg]")) {
		$img_src =timg(80,55,"gisaimg/$row[gisaimg]","$row[no]");
		$img= "<a href='$link'><img src=$img_src $pok border=0 style='margin: 0 10 5 5' align='left'></a>";
	}




	echo "<tr>
	<td style='padding:10 0 10 0'>$img<font color='#CC0033'>[$section]</font> <a href='$link' class='subtitle1'>$title1</a>  <span class='date_dv'>|</span><span class='date'>$newstime</span>
	<p style='margin:5 0 0 20'><a href='$link&search=$search' class='summary'>$summary</a></td>
	</tr>
	<tr><td bgcolor=#ececec height='1'></td></tr>";
	unset($img);
}

echo ("</table>");
mysql_free_result($res);
}

$go_url="/articles.asp";
$go_vars="total_record=$total_record";
include "./include/page_list.php";

if (is_file("./html/".$SEARCH_FOOTER."_footer.cgi")) {
	include "./html/".$SEARCH_FOOTER."_footer.cgi";
} else {
	include "./html/default_footer.cgi";
}
?>