<?
if (!defined('_GNUBOARD_')) exit;

function banner_sero($banner_sca)
{
    global $g4, $is_admin;

	$list = array();
    $g4_table         = "banner";	  
    $g4_site_table    =  "g4_site_".$g4_table;  
    $mct              = " where po_poll1 = '$banner_sca' ";
    $sql              = " select * from $g4_site_table $mct order by po_cnt4, po_id ";
    $result           = sql_query($sql);
	$total_count      = mysql_num_rows($result);


	if($total_count){
    ob_start();
		     echo "<table cellpadding=0 cellspacing=0>";
		for ($i=0; $row = sql_fetch_array($result); $i++){

             //파일 확장자 검색, 오류예방
	         $path_info       =  pathinfo($row[po_poll19]);
	         //  $path_info["extension"];

			 
			 if($path_info["extension"] == 'swf'){//플레쉬 파일일경우
		     echo "<tr><td align='center'>";
                 ?>
                <script>
                doc_write(flash_movie("<?=$g4[path]?>/data/file/banner/<?=$row[po_poll19]?>", "myfile", "<?=$row[po_cnt5]?>", "<?=$row[po_cnt6]?>", "transparent"));
                </script>
				 <?
			 echo "</td></tr>";
			 }
			 else{
		     echo "<tr><td align='center'>";
			 echo "<a href='$row[po_poll4]' target='$row[po_poll5]' >"; // 연결할 주소
             echo "<img src='$g4[path]/data/file/banner/$row[po_poll19]' title='$row[po_subject]'  border='0'>";
			 echo "</a>";
			 echo "</td></tr>";
			 }
		}
		     echo "</table>";
    $content = ob_get_contents();
    ob_end_clean();

	}
	else{
    ob_start();
	   if($is_admin){
	    $set_url = "<a href=".$g4[path]."/adm/category_list.php?url=banner>";
	    $set_url = "<a href=".$g4[path]."/adm/category_list.php?url=banner>";
		echo "<table width=100% height=100%  border=1 cellspacing=0 cellpadding=0 bordercolor=#F4F3F3 bordercolordark=white bordercolorlight=#F4F3F3>";
		echo "<tr><td height=100% align=center>[{$set_url}{$banner_sca}</a>]</td></tr>";
		echo "<tr><td height=5></td></tr>";
		echo "</table>";
	   }

    $content = ob_get_contents();
    ob_end_clean();
	}

    return $content;
}

function banner_garo($banner_sca)
{
    global $g4, $is_admin;

	$list = array();
    $g4_table         = "banner";	  
    $g4_site_table    =  "g4_site_".$g4_table; 


    $mct              = " where po_poll1 = '$banner_sca' ";
    $sql              = " select * from $g4_site_table $mct order by po_cnt4, po_id ";
    $result           = sql_query($sql);
	$total_count      = mysql_num_rows($result);

	$banner_target    = $result[po_poll1]; // 대상프레임


	if($total_count){
    ob_start();
		     echo "<table cellpadding=0 cellspacing=0><tr>";

		for ($i=0; $row = sql_fetch_array($result); $i++){

             //파일 확장자 검색, 오류예방
	         $path_info       =  pathinfo($row[po_poll19]);
	         //  $path_info["extension"];

			 if($path_info["extension"] == 'swf'){//플레쉬 파일일경우
		     echo "<td align='center'>";             
                 ?>
                <script>
                doc_write(flash_movie("<?=$g4[path]?>/data/file/banner/<?=$row[po_poll19]?>", "myfile", "<?=$row[po_cnt5]?>", "<?=$row[po_cnt6]?>", "transparent"));
                </script>
				 <?
			 echo "</td>";
			 }
			 else{
		     echo "<td align='center'>";             
			 echo "<a href='$row[po_poll4]' target='$row[po_poll5]'>"; // 연결할 주소
             echo "<img src='$g4[path]/data/file/banner/$row[po_poll19]' title='$row[po_subject]'  border='0'>";
			 echo "</a>";
			 echo "</td>";
			 }
		}
		     echo "</tr></table>";
    $content = ob_get_contents();
    ob_end_clean();
	}
	else{
    ob_start();
	   if($is_admin){
	    $set_url = "<a href=".$g4[path]."/adm/category_list.php?url=banner>";
		echo "<table width=100%  border=1 cellspacing=0 cellpadding=0 bordercolor=#F4F3F3 bordercolordark=white bordercolorlight=#F4F3F3>";
		echo "<tr><td hegiht=20 align=center>[{$set_url}{$banner_sca}</a>]</td></tr>";
		echo "<tr><td height=5></td></tr>";
		echo "</table>";
	   }

    $content = ob_get_contents();
    ob_end_clean();
	}

    return $content;
}

function banner_rand($banner_sca)
{
    global $g4, $is_admin;

	$list = array();
    $g4_table         = "banner";	  
    $g4_site_table    =  "g4_site_".$g4_table; 


    $mct              = " where po_poll1 = '$banner_sca' ";
    $sql              = " select * from $g4_site_table $mct order by po_cnt4, po_id ";
    $result           = sql_query($sql);
	$total_count      = mysql_num_rows($result);
	$t_c              = $total_count -1;

	$banner_target    = $result[po_poll1]; // 대상프레임


	if($total_count){
    ob_start();
		     echo "<table width='100%' cellpadding=0 cellspacing=0 align='center'><tr>";
		     echo "<td align='center'>"; 

		for ($i=0; $row = sql_fetch_array($result); $i++){

             //파일 확장자 검색, 오류예방
	         $path_info       =  pathinfo($row[po_poll19]);
	         //  $path_info["extension"];

			 if($path_info["extension"] == 'swf'){//플레쉬 파일일경우

             $data[$i] = "<script>doc_write(flash_movie('$g4[path]/data/file/banner/$row[po_poll19]', 'myfile', '$row[po_cnt5]', '$row[po_cnt6]', 'transparent'));</script>";

			 }
			 else{           

			 $data[$i] = "<a href='$row[po_poll4]' target='$row[po_poll5]'><img src='$g4[path]/data/file/banner/$row[po_poll19]' title='$row[po_subject]'  border='0'></a>";

			 }
		}

            $rand         = mt_rand(0,$t_c); 
            $data_view    = "$data[$rand]";

			 echo $data_view;
			 echo "</td>";
		     echo "</tr></table>";

    $content = ob_get_contents();
    ob_end_clean();
	}
	else{
    ob_start();
	   if($is_admin){
	    $set_url = "<a href=".$g4[path]."/adm/category_list.php?url=banner>";
		echo "<table width=100%  border=1 cellspacing=0 cellpadding=0 bordercolor=#F4F3F3 bordercolordark=white bordercolorlight=#F4F3F3>";
		echo "<tr><td hegiht=20 align=center>[{$set_url}{$banner_sca}</a>]</td></tr>";
		echo "<tr><td height=5></td></tr>";
		echo "</table>";
	   }

    $content = ob_get_contents();
    ob_end_clean();
	}

    return $content;
}
?>
