MINI MINI MANI MO

Path : /home/lhcar/www/mobile/board/
File Upload :
Current File : /home/lhcar/www/mobile/board/comment_reload_page.php

<?
include_once $_SERVER['DOCUMENT_ROOT']."/inc/header.php";


$comment_update='<table width="100%" border="0" cellpadding="0" cellspacing="0">';

	if (!$page) $page=1;
	if (!$nperpage) $nperpage=5;
	$nperblock=10;

	if($user_c) $wh=" and userno='$user_c' ";

	$sql="select count(*) from ".$id."_comments where board_idx='$vno' $wh ";
	$result=mysql_query($sql) or die(mysql_error());
	$trecord=mysql_result($result,0);
	$tpage = ceil($trecord/$nperpage); //ÀüüÆäÀÌÁö

	// Ãâ·Â ·¹ÄÚµå ¹üÀ§
	if($trecord==0) {
		$first=1;
		$last=0;
	} else {
		$first=$nperpage*($page-1);
		$last=$nperpage*$page;
	}

	$tblock = ceil($tpage/$nperblock);
	$block = ceil($page/$nperblock);
	$first_page = ($block-1)*$nperblock;
	$last_page = $block*$nperblock;
	if($tblock <= $block) {
	   $last_page = $tpage;
	}

	$article_num = $trecord - $nperpage*($page-1); //°¡»ó¹øÈ£ ¼³Á¤

	$sql_c="select * from ".$id."_comments where board_idx='$vno' $wh order by date desc LIMIT $first, $nperpage ";
	$result_c=mysql_query($sql_c);
	while($data_c=mysql_fetch_array($result_c)){
		$board_member=qassoc("select * from member where idx='$data_c[userno]'  ");
		$comment_update.='						  <tr>                            <td height="90" align="center" bgcolor="#FFFFFF" style="border-bottom:1px solid #CCCCCC"><table width="100%" border="0" cellspacing="0" cellpadding="0">                              <tr>                                <td width="78%" height="30"><table border="0" cellspacing="0" cellpadding="0">                                    <tr>                                      <td width="30"><strong>'.$article_num--.'</strong> </td><td><strong>'.$data_c[name].'</strong> </td>                                      <td style="padding-left:5px;"><img src="/images/join_icon'.sprintf("%02d",$board_member[user_icon]).'.png" /></td>									  <td style="padding-left:10px;"><strong>'.date("Y-m-d",$data_c['date']).'</strong></td>                                    </tr>                                  </table></td>                                <td width="12%" align="right"><table border="0" cellspacing="0" cellpadding="0">                                  <tr>                                    <td><img src="/images/view_s.jpg" /></td>                                    <td>&nbsp;</td>                                    <td>';
									 if ($_SESSION[login_user_level]=="99"||$data_c[userno]==$_SESSION[login_user_idx]){ 
										$comment_update.='<img src="/images/del_bt03.jpg" style="cursor:pointer;" onclick="c_del(&quot;'.$id.'&quot;,&quot;'.$data_c[c_idx].'&quot;);" />';
									 } 
									 $comment_update.='</td>                                  </tr>                                </table></td>                              </tr>                              <tr>                                <td colspan="2" align="left">'.nl2br($data_c[content]).'</td>                                </tr>                            </table></td>                          </tr>';
	}
	$comment_update.='</table>						<table width="100%" border="0" cellpadding="0" cellspacing="0">						<tr>						<td align="center" style="padding-top:20px;">';
	// ÀÌÀüºí·Ï¿¡ ´ëÇÑ ¸µÅ©
	if($block > 1) {
		$imsi=$page;
	   $page = $first_page;
	  $comment_update.='<a href="javascript:page_co(&quot;'.$id.'&quot;,&quot;'.$vno.'&quot;,&quot;1&quot;,&quot;'.$user_c.'&quot;)" ><img src="/img/icon/icon_prev.gif"></a>&nbsp;&nbsp;&nbsp;';
	   $page=$imsi;
	} 

	// ÆäÀÌÁöÀ̵¿(ºí·Ï³»)

	for($direct_page = $first_page+1; $direct_page <= $last_page; $direct_page++) {
	   if($page == $direct_page) {
		  $comment_update.='<FONT SIZE=3 COLOR=red>'.$direct_page.'</FONT>';
	   } else {
		  $comment_update.='<a href="javascript:page_co(&quot;'.$id.'&quot;,&quot;'.$vno.'&quot;,&quot;'.$direct_page.'&quot;,&quot;'.$user_c.'&quot;)" >&nbsp;<FONT COLOR=#bbb>'.$direct_page.'</FONT></a>';
	   }
	}


	// ´ÙÀ½ºí·Ï¿¡ ´ëÇÑ ¸µÅ©

	if($block < $tblock) {
	   $page = $last_page+1;
	   $comment_update.='&nbsp;&nbsp;&nbsp;<a href="javascript:page_co(&quot;'.$id.'&quot;,&quot;'.$vno.'&quot;,&quot;'.$page.'&quot;,&quot;'.$user_c.'&quot;)" ><img src="/img/icon/icon_next.gif"></a>';
	} 
                    $comment_update.='</td>						</tr>						</table>';

?>

<script>
parent.document.bwrite.content.value="";
parent.document.getElementById("comment_num").innerHTML='<?=$trecord?>';
parent.document.getElementById("comment_area").innerHTML='<?=$comment_update?>';
</script>

OHA YOOOO