다운로드 문제.. download.php의 문제? orderinquiry.sub.php의 문제?

다운로드 문제.. download.php의 문제? orderinquiry.sub.php의 문제?

QA

다운로드 문제.. download.php의 문제? orderinquiry.sub.php의 문제?

본문

안녕하세요 선배님들.. 저는 이제 그누보드로 개발을 하고 있는 초보 개발자 입니다 사실 기능적으로 문제를 여쭈어볼때 좋고 명확한 질문을 던져야 선배님들이 잘 도와주실수 있을텐데 아직 지식이 부족하여 그래도 현재 겪고 있는.. 문제를 도움을 받고자 합니다.. 도움을 받아 해결할수있었으면 좋겠네요

 

현재는 다운로드를 하면 다운로드가 되지 않는 문제를 겪고 있습니다 download.php가 문제인지 orderinquiry.sub.php 가 문제인지 명확하게는 잘 모르겠습니다 컴파일 에러처럼 무엇이 문제인지 명확하게 나오지 않기 때문에 구글링을 해보려고 해도 잘 모르겠습니다 홈페이지를 올려도 되는지는 모르겠지만 너무 답답한 마음에 조언을 구해봅니다.. 감사합니다

 


<?
include_once('./_common.php');
include_once(G5_LIB_PATH.'/Api.php');    
$api = new Api();
$iid =  $_GET["iid"];
$od_id=  $_GET["id"];
$iid= preg_replace('/[^a-z0-9_\-]/i', '', $iid);
$od_id =preg_replace('/[^a-z0-9_\-]/i', '', $od_id);
        $sql = " select it_id, it_name, ct_send_cost, it_sc_type, ct_status
                    from {$g5['g5_shop_cart_table']}
                    where od_id = '$od_id' AND mb_id='{$member["mb_id"]}' and it_id = '{$iid}'";
        $row= sql_fetch($sql);
    $api->downloadContent($row["it_id"], $member["mb_id"]);
    if($row["ct_status"] == '完了' || $row["ct_status"] == '完了'|| $row["ct_status"] == '완료')
    {
        $sql = " select *
                from {$g5['g5_shop_item_table']}
                where it_id = '{$row['it_id']}' ";
        $item= sql_fetch($sql);
        $arr= explode(".", $item["it_1"]);
        $ext = $arr[sizeof($arr)-1];
        $ext= strtolower($ext);
        $exts = array("php","php3","php4", "php5","html", "inc","htm", "sql");
        if(in_array($exts, $ext))
        {
            exit;
        }
        $data = file_get_contents($item["it_1"]);
        
        header("Content-Disposition: attachment; filename=" . urlencode($item["it_1_subj"]));   
        header("Content-Type: application/force-download");
        header("Content-Type: application/octet-stream");
        header("Content-Type: application/download");
        header("Content-Description: File Transfer");            
        //header("Content-Length: " . filesize($file));
        print file_get_contents($item["it_1"]);
        flush(); // this doesn't really matter.
    }
    
                    // 합계금액 계산
 

 

 


<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if (!defined("_ORDERINQUIRY_")) exit; // 개별 페이지 접근 불가
// 테마에 orderinquiry.sub.php 있으면 include
if(defined('G5_THEME_SHOP_PATH')) {
    $theme_inquiry_file = G5_THEME_SHOP_PATH.'/orderinquiry.sub.php';
    if(is_file($theme_inquiry_file)) {
        include_once($theme_inquiry_file);
        return;
        unset($theme_inquiry_file);
    }
}
?>
<!-- 注文内訳 목록 시작 { -->
<?php if (!$limit) { ?>全 <?php echo $cnt; ?> 件<?php } ?>
<div class="tbl_head03 tbl_wrap">
    <table>
    <thead>
    <tr>
        <th scope="col">注文書番号</th>
        <th scope="col">注文日時</th>
        <th scope="col">注文金額</th>
        <th scope="col">入金額</th>
        <th scope="col">未入金額</th>
        <th scope="col">常態</th>
    </tr>
    </thead>
    <tbody>
    <?php
    $sql = " select *
               from {$g5['g5_shop_order_table']}
              where mb_id = '{$member['mb_id']}'
              order by od_id desc
              $limit ";
    $result = sql_query($sql);
    $ids = array();
    for ($i=0; $row=sql_fetch_array($result); $i++)
    {
        $uid = md5($row['od_id'].$row['od_time'].$row['od_ip']);
    $ids[]=$row["od_id"];
        switch($row['od_status']) {
            case '주문':
                $od_status = '<span class="status_01">入金確認中</span>';
                break;
            case '입금':
                $od_status = '<span class="status_02">入金済み</span>';
                break;
            case '준비':
                $od_status = '<span class="status_03">商品準備中</span>';
                break;
            case '배송':
                $od_status = '<span class="status_04">商品配送</span>';
                break;
            case '배송완료':
                $od_status = '<span class="status_05">配送完了</span>';
                break;
            case '완료':
                $od_status = '<span class="status_05">完了</span>';
                break;
            default:
                $od_status = '<span class="status_06">注文キャンセル</span>';
                break;
        }
    ?>
    <tr>
        <td>
            <a href="<?php echo G5_SHOP_URL; ?>/orderinquiryview.php?od_id=<?php echo $row['od_id']; ?>&uid=<?php echo $uid; ?>"><?php echo $row['od_id']; ?></a>
        </td>
        <td><?php echo substr($row['od_time'],2,14); ?> (<?php echo get_yoil($row['od_time']); ?>)</td>
        <td class="td_numbig text_right"><?php echo display_price($row['od_cart_price'] + $row['od_send_cost'] + $row['od_send_cost2']); ?></td>
        <td class="td_numbig text_right"><?php echo display_price($row['od_receipt_price']); ?></td>
        <td class="td_numbig text_right"><?php echo display_price($row['od_misu']); ?></td>
        <td><?php echo $od_status; ?></td>
    </tr>
    <?php
    }
    if ($i == 0)
        echo '<tr><td colspan="7" class="empty_table">注文履歴がありません。</td></tr>';
    ?>
    </tbody>
    </table>
</div>
<!-- } 注文内訳 목록 끝 -->
 

 

 

3695395493_1621301091.8711.png

3695395493_1621301047.3232.png

이 질문에 댓글 쓰기 :

답변 2

https://sir.kr/qa/295738

우선 에러 메시지가 있는지 확인해 보시고

$item["it_1"]

여기에 뭐가 들어 있나요?

안녕하세요 선생님 부족한 글인데 답변을 주셔서 너무너무 감사드립니다 제가 아직 실력이 부족해서 위 링크로 들어가서 시키는데로 했지만 FTP에러가.. 발생해서 그렇게는 못했고요.. $item["it_1"] 는 혹시 어떻게 확인할수있는지 부끄럽지만 여쭈어봅니다..

        $data = file_get_contents($item["it_1"]);
        
        header("Content-Disposition: attachment; filename=" . urlencode($item["it_1_subj"]));   
        header("Content-Type: application/force-download");
        header("Content-Type: application/octet-stream");
        header("Content-Type: application/download");
        header("Content-Description: File Transfer");            
        //header("Content-Length: " . filesize($file));
        print file_get_contents($item["it_1"]); 이 부분이 파일을 읽어서 브라우저로 전송하게 됩니다.

추측이지만

$item["it_1"]

여기에는 파일 경로가 있을 것으로 예상합니다.

        if(in_array($exts, $ext))
        {
            exit;
        }

이 다음에 echo $item["it_1"];

하셔서 무엇이 나오는지 확인해 보세요.

 

 

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

회원로그인

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