관리자 조회수 증가

관리자 조회수 증가

QA

관리자 조회수 증가

본문

https://sir.kr/g5_skin/1404 여기 스킨을 사용하려고 설치를 했는데 전체게시판은 조회수 증가가 잘되는데 게시판선택 후 증가를 하려고하니 그냥 먹통이네요 .. 혹시 뭐가 문제인지 알수 있을까요?

<?php 
$sub_menu = "300300"; 
include_once('./_common.php'); 

include_once("./admin.head.php"); 
?> 
<script> 
function myfn(myform){ 
if(myform.bo_tbl.value == ""){alert('* 게시판을 선택해 주세요! *');myform.bo_tbl.focus();return false;} 
if(myform.myinc.value == "0"){alert('* 증가값을 0이상으로 해주세요! *');myform.myinc.focus();return false;} 
return true; 


</script> 
<style> 
.hd{border-top:1px #6b95bd solid;border-bottom:1px #6b95bd solid;font-size:11px} 
</style> 
<?php 
if(empty($mode))$mode = "new"; 

if($mode == "new"){ 
?> 

<form name="myfrm" method="post" action="<?php echo $PHP_SELF?>" onsubmit="return myfn(this);"> 
<input type="hidden" name="mode" value="insert"> 
<input type="hidden" name="type" value="inc"> 
<fieldset> 
    <legend>게시물 조회수 관리</legend> 

- 게시물 조회수 증가 : <select name="bo_tbl"> 
<option value="" selected>게시판 선택!!</option> 
<option value="all">전체게시판</option> 
<?php 
$sql = "select * from g5_board order by bo_order"; 

$result = sql_query($sql); 
while($row=sql_fetch_array($result)){ 
$sql2 = "select * from g5_group where gr_id = '$row[gr_id]'"; 
$result2 = sql_query($sql2); 
$row2=sql_fetch_array($result2); 
echo "<option value='".$row[bo_subject]." - ".$row[bo_table]."'>".$row2[gr_subject]."-".$row[bo_subject]."</option>"; 

?> 
</select> 
증가값: <input type="test" name = "myinc" size="5" value="9">   
갯수(최근글 순): <input type="test" name = "mycnt" size="5" value="500">   
<input type="submit" value="=처리="> 
</fieldset> 
</form> 

<?php } else if($mode == "insert"){ 


if($bo_tbl == "all"){ //게시판 전체 
$sql = "select * from g5_board order by bo_table"; 
$result = mysql_query($sql); 
for ($i=0; $row=mysql_fetch_array($result); $i++){ 
$arr[$i] = $row[bo_table]; 

for($i = 0 ; $i < sizeof($arr);$i++){ 
$sql1 = "select * from g5_write_".$arr[$i]."  where wr_is_comment=0 order by wr_id desc limit 0, ".$mycnt; 
$result1 = mysql_query($sql1); 
for ($j=0; $row1=mysql_fetch_array($result1); $j++){ 
$myinc2 =  $row1[wr_hit] + $myinc; 
$sql2 = "update g5_write_".$arr[$i]." set wr_hit =".$myinc2." where  wr_is_comment=0 and wr_id = '$row1[wr_id]'"; 
sql_query($sql2); 



}else{ //특정게시판 
$lnk = explode(" - ",$bo_tbl); 
$sql1 = "select * from g5_write_".$lnk[1]."  where wr_is_comment=0 order by wr_id desc limit 0, ".$mycnt; 
echo $sql11; 
$result1 = mysql_query($sql1); 
$tot = mysql_num_rows($result1); 

$nn = 0; 
while($row1=mysql_fetch_array($result1)){ 
$nn++; 
$myinc2 =  $row1[wr_hit] + $myinc; 
$sql2 = "update g5_write_".$lnk[1]." set wr_hit =".$myinc2." where wr_is_comment=0 and wr_id = '".$row1[wr_id]."'"; 
mysql_query($sql2); 


} //inner-if 
if($bo_tbl == "all")$bo_tbl="전체"; 
$sql = "insert into g5_board_count(wr_type, bo_tbl, wr_value, wr_count,wr_date) value('증가','$bo_tbl','$myinc','$mycnt',now())"; 
mysql_query($sql); 
echo "<script>location.href='$PHP_SELF';</script>"; 
} //outer-if 

$qry = "select count(*) as cnt from g5_board_count"; 
$row = sql_fetch($qry); 
$total_count = $row[cnt]; 
$rows = $config[cf_page_rows]; 
$total_page  = ceil($total_count / $rows);  // 전체 페이지 계산 
if ($page == "") { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지) 
$from_record = ($page - 1) * $rows; // 시작 열을 구함 
?> 
<table width=90% cellpadding=0 border=0 cellspacing=0 align="center" style="margin:20px 5px 5px 5px;border:0px solid #ccc"> 
<tr bgcolor='#f8f8f9'> 
    <th class="hd" align="center"width="5%" height="30" >번호</th> 
<th class="hd"  width="15%" >조회수처리</th> 
<th class="hd"  width="25%" >테이블</th> 
<th class="hd"  width="15%" >증가값</th> 
<th class="hd"  width="15%" >범위(최신글)</th> 
<th class="hd"  width="25%" >처리일자</th> 
</tr> 
<?php 
$qry = "select * from g5_board_count order by wr_id desc limit $from_record, $rows"; 
$res= mysql_query($qry); 
while($li = mysql_fetch_array($res)){ 
?> 

<tr bgcolor='#f8f8f9'> 
    <td align="center" height="30"><?php echo $li[wr_id]?></td> 
<td align="center"><?php echo $li[wr_type]?></td> 
<td align="center"> 
<?php 
$lnk = explode(" - ",$li[bo_tbl]); 
if($li[bo_tbl] == "전체") echo $li[bo_tbl]; 
else echo "<a href=".$g4['path']."/bbs/board.php?bo_table=".$lnk[1].">".$li[bo_tbl]."</a>"; 
?> 
</td> 
<td align="center"><?php echo $li[wr_value]?></td> 
<td align="center"><?php echo $li[wr_count]?></td> 
<td align="center"><?php echo $li[wr_date]?></td> 
</tr> 
<?php 

?> 

</table> 
<?php 
$pagelist = get_paging($config[cf_write_pages], $page, $total_page, "$_SERVER[PHP_SELF]?$qstr&page="); 
echo "<table width=90% cellpadding=3 cellspacing=1>"; 
echo "<tr><td width=100% align=right>$pagelist</td></tr></table>\n"; 
?> 
<?php 
include_once("./admin.tail.php"); 
?> 

이 질문에 댓글 쓰기 :

답변 1

답변을 작성하시기 전에 로그인 해주세요.
전체 32
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT