관리자페이지에서 파일다운로드 권한설정하기







게시판마다 다운로드 권한을 설정할수 있게 합나다.
다운로드권한이 없으면 링크는 안됩니다.
글 작성자는 다운로드권한이 없어도 다운로드 가능합니다

수정할 파일은 3개 입니다.
admin/admin_exce_board.php
admin/admin_modify_grant.php
include/list_check.php





admin_exce_board.php  

수정전

// 권한 설정
elseif($exec2=="modify_grant_ok") {
@mysql_query("update $admin_table set grant_html='$grant_html', grant_list='$grant_list',
grant_view='$grant_view', grant_comment='$grant_comment', grant_write='$grant_write',
grant_reply='$grant_reply', grant_delete='$grant_delete', grant_notice='$grant_notice',
grant_view_secret='$grant_view_secret', use_showip = '$grant_imagebox' where no='$no'") or

Error("권한 설정 변경시 에러가 발생하였습니다".mysql_error());
-----------------------------------------------
수정후

// 권한 설정
elseif($exec2=="modify_grant_ok") {
@mysql_query("update $admin_table set grant_html='$grant_html', grant_list='$grant_list',
grant_download='$grant_download',
grant_view='$grant_view', grant_comment='$grant_comment', grant_write='$grant_write',
grant_reply='$grant_reply', grant_delete='$grant_delete', grant_notice='$grant_notice',
grant_view_secret='$grant_view_secret', use_showip = '$grant_imagebox' where no='$no'") or

Error("권한 설정 변경시 에러가 발생하였습니다".mysql_error());






admin_modify_grant.php  

수정전

     댓글 달기 권한을 레벨별로 지정합니다.
  </td>
</tr>

<tr height=25 bgcolor=#e0e0e0>
  <td  align=right style=font-family:Tahoma;font-size:8pt;font-weight:bold;><b>삭제 권한

</td>
-----------------------------------------------

수정후

     댓글 달기 권한을 레벨별로 지정합니다.
  </td>
</tr>

<!------추가부분---------->
<tr height=25 bgcolor=#e0e0e0>
  <td  align=right style=font-family:Tahoma;font-size:8pt;font-weight:bold;><b>다운로드 권한

</td>
  <td >  
     <select name=grant_download class=input>
<?
  for($i=1;$i<=10;$i++)
  if($i==$board_data[grant_download]) echo"<option value=$i selected>$i</option>";
  else echo"<option value=$i>$i</option>";
?>
     </select>  
     다운로드 권한을 레벨별로 지정합니다.
  </td>
</tr>
<!------여기까지---------->

<tr height=25 bgcolor=#e0e0e0>
  <td  align=right style=font-family:Tahoma;font-size:8pt;font-weight:bold;><b>삭제 권한

</td>






list_check.php

수정전

                if($file_name1) {
                        $file_size1=@GetFileSize(filesize($data[file_name1]));
                        $a_file_link1="<a href='download.php?$href$sort&no=$data[no]

&filenum=1'>";
                } else {
                        $file_size1=0;
                        $a_file_link1="<Zeroboard";
                }
                if($file_name2) {
                        $file_size2=@GetFileSize(filesize($data[file_name2]));
                        $a_file_link2="<a href='download.php?$href$sort&no=$data[no]

&filenum=2'>";
                } else {
                        $file_size2=0;
                        $a_file_link2="<Zeroboard";
                }
  
                $upload_image1=$upload_image2="";
-----------------------------------------------

수정후

        $file_size1=@GetFileSize(filesize($data[file_name1]));
        $file_size2=@GetFileSize(filesize($data[file_name2]));
            if($file_name1&&($is_admin||$member[level]<=$setup[grant_download]||$data

[ismember]==$member[no])) {
                        $a_file_link1="<a href='download.php?$href$sort&no=$data[no]

&filenum=1'>";
                } else {$a_file_link1="";}
                if($file_name2&&($is_admin||$member[level]<=$setup[grant_download]||$data

[ismember]==$member[no])) {
                        
                        $a_file_link2="<a href='download.php?$href$sort&no=$data[no]

&filenum=2'>";
                } else {$a_file_link2="";}
  
                $upload_image1=$upload_image2="";






down.php

<?
$file=file("../config.php");
$size=sizeof($file);

for($i=1;$i<=4;$i++){$file[$i]=trim(str_replace("\n","",$file[$i]));}

$conn=mysql_connect($file[1], $file[2], $file[3]);  //mysql접속
$mysql=mysql_select_db($file[4], $conn);  //db선택

$query="alter table zetyx_admin_table add (grant_download int(2) not null default '10')";
$da=mysql_query($query, $conn);
if($da){echo "<p align=center>다운로드 필드 추가 성공<br><br><a href='../admin_setup.php'>

관리자페이지로 이동</a>";}
else{echo "<p align=center>다운로드 필드 추가 실패";}
?>
-------------------------------------------------
down.php는 필드를 추가하는 파일입니다. 다운로드 권한설정 필드가 필요하기때문에.
필드추가 완료되면 이 파일은 쓸모가 없는 파일입니다.

down.php파일을 admin폴더에 넣고 웹에서 실행하세요.






편법을 이용한 다운로드를 막기 위해 스킨폴더의  view.php 파일도 조금 수정합니다.

수정전
<?=$hide_download1_start?><font class=list_eng>-
<b>Download #1</b> : <?=$a_file_link1?><?=$file_name1?> (<?=$file_size1?>)</a>, Download : <?=$file_download1?></font><br><?=$upload_image1?><?=$hide_download1_end?>
                                <?=$hide_download2_start?><font class=list_eng>- <b>Download #2</b> : <?=$a_file_link2?><?=$file_name2?> (<?=$file_size2?>)</a>, Download : <?=$file_download2?></font><br><?=$upload_image2?><?=$hide_download2_end?>

수정후
<?=$hide_download1_start?><font class=list_eng>-
<?=$a_file_link1?><b> 다운로드1 </b>(<?=$file_size1?>)</a>, Download : <?=$file_download1?></font><br><?=$upload_image1?><?=$hide_download1_end?>
                                <?=$hide_download2_start?><font class=list_eng>-
<?=$a_file_link2?><b> 다운로드2  </b>(<?=$file_size2?>)</a>, Download : <?=$file_download2?></font><br><?=$upload_image2?><?=$hide_download2_end?>