<?php echo latest("simple", "edu_01", 4, 10); ?>
최신글 클릭하면 첨부파일 바로 다운로드 되도록했는데 로그아웃하고나면 "잘못된 접근입니다"가 뜹니다
bbs/download.php파일에서 주석처리도했는데 여전히 잘못된 접근입니다가 뜨네요
// 쿠키에 저장된 ID값과 넘어온 ID값을 비교하여 같지 않을 경우 오류 발생// 다른곳에서 링크 거는것을 방지하기 위한 코드//if (!get_session("ss_view_{$bo_table}_{$wr_id}"))// alert("잘못된 접근입니다.");
latest/simple/latest.skin.php
<?php global $member, $is_admin;?><? set_session('ss_view_'.$bo_table.'_'.$list[$i][wr_id], TRUE); $sql = " select * from $g5[board_file_table] where bo_table = '". $bo_table. "' and wr_id = '". $list[$i][wr_id] ."' order by bf_no ";?><?phpif (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨?><link rel="stylesheet" href="<?php echo $latest_skin_url?>/style.css"><div> <?php for ($i=0; $i<count($list); $i++) { ?> <? $sql = " select * from $g5[board_file_table] where bo_table = '". $bo_table. "' and wr_id = '". $list[$i][wr_id] ."' order by bf_no "; $result = sql_query($sql); while ($row = sql_fetch_array($result)) { $down_link = "download.php?bo_table={$bo_table}&wr_id={$list[$i][wr_id]}&no={$row[bf_no]}"; $file_source = addslashes($row[bf_source]); $file_type = preg_replace('/^.*\.([^.]+)$/D', '$1', $file_source); $file_size = get_filesize($row[bf_filesize]); if(!in_array($file_type, array('jpg', 'jpeg', 'gif', 'bmp', 'png'))){ //이미지는 제외 echo "<li class=\"pr_btn\" style=\"margin-top:0px\"><a href=\"".$down_link."\" title=\"".$file_source."\">파일다운로드</a></li>"; } } ?> <!-- 10레벨만 보임 시작 --> <?php if ($is_admin) { ?> <a href="<?php echo G5_BBS_URL.'/write.php?w=u&bo_table='.$bo_table.'&wr_id='.$list[$i]['wr_id'];?>"> <li class="pr_btn">파일수정</li> </a> <?php } ?></div><?php } ?></div></div>
<?php echo latest("simple", "edu_01", 4, 10); ?>
최신글 클릭하면 첨부파일 바로 다운로드 되도록했는데 첨엔 잘되더니 로그아웃하고나면 "잘못된 접근입니다"가 뜹니다
세션을 추가해줘야한다는데 어디파일에 무슨 세션을 추가해야한다는건지 모르겠습니다 ㅠ
아시는 분 제발 알려주세요 ㅠ
답변 1개 / 댓글 1개
소스에 보면 줄 4번 set_session('ss_view_'.$bo_table.'_'.$list[$i][wr_id], TRUE); 이부분이 세션 추가 부부인데 위치가 잘못삽인된거 같아요
그밑에 줄 5번하고 14번이 중복으로 됏는데 줄 4번을 줄 14번 위에 넣으면 되구요
줄 3~ 줄 5이부분은 삭제하면 되구요
그리고 줄 18번 download.php파일 경로가 제대로 적히지 않은거 같은데요 G5_BBS_URL 이걸 추가로 아래와같이 수정하시면 잘 작동할겁니다.
$down_link = G5_BBS_URL."/download.php?bo_table={$bo_table}&wr_id={$list[$i][wr_id]}&no={$row[bf_no]}";
<?phpif (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨global $member, $is_admin;?><link rel="stylesheet" href="<?php echo $latest_skin_url?>/style.css"><div> <?php for ($i=0; $i<count($list); $i++) { set_session('ss_view_'.$bo_table.'_'.$list[$i][wr_id], TRUE); $sql = " select * from $g5[board_file_table] where bo_table = '". $bo_table. "' and wr_id = '". $list[$i][wr_id] ."' order by bf_no "; $result = sql_query($sql); while ($row = sql_fetch_array($result)) { $down_link = G5_BBS_URL."/download.php?bo_table={$bo_table}&wr_id={$list[$i][wr_id]}&no={$row[bf_no]}"; $file_source = addslashes($row[bf_source]); $file_type = preg_replace('/^.*\.([^.]+)$/D', '$1', $file_source); $file_size = get_filesize($row[bf_filesize]); if (!in_array($file_type, array('jpg', 'jpeg', 'gif', 'bmp', 'png'))){ //이미지는 제외 echo "<li class=\"pr_btn\" style=\"margin-top:0px\"><a href=\"".$down_link."\" title=\"".$file_source."\">파일다운로드</a></li>"; } } ?> <!-- 10레벨만 보임 시작 --> <?php if ($is_admin) { ?> <a href="<?php echo G5_BBS_URL.'/write.php?w=u&bo_table='.$bo_table.'&wr_id='.$list[$i]['wr_id'];?>"> <li class="pr_btn">파일수정</li> </a> <?php } ?></div><?php } ?></div></div>
답변에 대한 댓글 1개
답변을 작성하려면 로그인이 필요합니다.