검색 페이지에서 토렌트 파일의 마그넷 링크 가져오기

검색 페이지에서 토렌트 파일의 마그넷 링크 가져오기

QA

검색 페이지에서 토렌트 파일의 마그넷 링크 가져오기

본문

                <!-- 마그넷링크 시작-->
                <?php if($list[$i][file][0]){?>
<?php
    $dest_file = G5_DATA_PATH.'/file/'.$bo_table.'/'.$list[$i][file][0][file];
    if (file_exists($dest_file) && get_extension($dest_file) == 'torrent')
    {
        $torrent_array = get_torrent_info($dest_file);
        $magnet = "magnet:?xt=urn:btih:".$torrent_array['hash'];

        echo "<a href='".$magnet."'>";
        echo sprintf('<i class="fa fa-magnet"></i>');
        echo "</a> ";

    }
?>
                <?php } ?>
                <!-- 마그넷링크 끝-->
                <!-- 마그넷링크 시작-->
                <?php if($list[$i][file][1]){?>
<?php
    $dest_file = G5_DATA_PATH.'/file/'.$bo_table.'/'.$list[$i][file][1][file];
    if (file_exists($dest_file) && get_extension($dest_file) == 'torrent')
    {
        $torrent_array = get_torrent_info($dest_file);
        $magnet = "magnet:?xt=urn:btih:".$torrent_array['hash'];

        echo "<a href='".$magnet."'>";
        echo sprintf('<i class="fa fa-magnet"></i>');
        echo "</a> ";

    }
?>
                <?php } ?>
                <!-- 마그넷링크 끝-->
                <!-- 마그넷링크 시작-->
                <?php if($list[$i][file][2]){?>
<?php
    $dest_file = G5_DATA_PATH.'/file/'.$bo_table.'/'.$list[$i][file][2][file];
    if (file_exists($dest_file) && get_extension($dest_file) == 'torrent')
    {
        $torrent_array = get_torrent_info($dest_file);
        $magnet = "magnet:?xt=urn:btih:".$torrent_array['hash'];

        echo "<a href='".$magnet."'>";
        echo sprintf('<i class="fa fa-magnet"></i>');
        echo "</a> ";

    }
?>
                <?php } ?>
                <!-- 마그넷링크 끝-->
                <!-- 마그넷링크 시작-->
                <?php if($list[$i][file][3]){?>
<?php
    $dest_file = G5_DATA_PATH.'/file/'.$bo_table.'/'.$list[$i][file][3][file];
    if (file_exists($dest_file) && get_extension($dest_file) == 'torrent')
    {
        $torrent_array = get_torrent_info($dest_file);
        $magnet = "magnet:?xt=urn:btih:".$torrent_array['hash'];

        echo "<a href='".$magnet."'>";
        echo sprintf('<i class="fa fa-magnet"></i>');
        echo "</a> ";

    }
?>
                <?php } ?>
                <!-- 마그넷링크 끝-->
                <!-- 마그넷링크 시작-->
                <?php if($list[$i][file][4]){?>
<?php
    $dest_file = G5_DATA_PATH.'/file/'.$bo_table.'/'.$list[$i][file][4][file];
    if (file_exists($dest_file) && get_extension($dest_file) == 'torrent')
    {
        $torrent_array = get_torrent_info($dest_file);
        $magnet = "magnet:?xt=urn:btih:".$torrent_array['hash'];

        echo "<a href='".$magnet."'>";
        echo sprintf('<i class="fa fa-magnet"></i>');
        echo "</a> ";

    }
?>
                <?php } ?>
                <!-- 마그넷링크 끝-->
                <!-- 마그넷링크 시작-->
                <?php if($list[$i][file][5]){?>
<?php
    $dest_file = G5_DATA_PATH.'/file/'.$bo_table.'/'.$list[$i][file][5][file];
    if (file_exists($dest_file) && get_extension($dest_file) == 'torrent')
    {
        $torrent_array = get_torrent_info($dest_file);
        $magnet = "magnet:?xt=urn:btih:".$torrent_array['hash'];

        echo "<a href='".$magnet."'>";
        echo sprintf('<i class="fa fa-magnet"></i>');
        echo "</a> ";

    }
?>
                <?php } ?>
                <!-- 마그넷링크 끝-->
                <!-- 마그넷링크 시작-->
                <?php if($list[$i][file][6]){?>
<?php
    $dest_file = G5_DATA_PATH.'/file/'.$bo_table.'/'.$list[$i][file][6][file];
    if (file_exists($dest_file) && get_extension($dest_file) == 'torrent')
    {
        $torrent_array = get_torrent_info($dest_file);
        $magnet = "magnet:?xt=urn:btih:".$torrent_array['hash'];

        echo "<a href='".$magnet."'>";
        echo sprintf('<i class="fa fa-magnet"></i>');
        echo "</a> ";

    }
?>
                <?php } ?>
                <!-- 마그넷링크 끝-->
                <!-- 마그넷링크 시작-->
                <?php if($list[$i][file][7]){?>
<?php
    $dest_file = G5_DATA_PATH.'/file/'.$bo_table.'/'.$list[$i][file][7][file];
    if (file_exists($dest_file) && get_extension($dest_file) == 'torrent')
    {
        $torrent_array = get_torrent_info($dest_file);
        $magnet = "magnet:?xt=urn:btih:".$torrent_array['hash'];

        echo "<a href='".$magnet."'>";
        echo sprintf('<i class="fa fa-magnet"></i>');
        echo "</a> ";

    }
?>
                <?php } ?>
                <!-- 마그넷링크 끝-->
                <!-- 마그넷링크 시작-->
                <?php if($list[$i][file][8]){?>
<?php
    $dest_file = G5_DATA_PATH.'/file/'.$bo_table.'/'.$list[$i][file][8][file];
    if (file_exists($dest_file) && get_extension($dest_file) == 'torrent')
    {
        $torrent_array = get_torrent_info($dest_file);
        $magnet = "magnet:?xt=urn:btih:".$torrent_array['hash'];

        echo "<a href='".$magnet."'>";
        echo sprintf('<i class="fa fa-magnet"></i>');
        echo "</a> ";

    }
?>
                <?php } ?>
                <!-- 마그넷링크 끝-->
                <!-- 마그넷링크 시작-->
                <?php if($list[$i][file][9]){?>
<?php
    $dest_file = G5_DATA_PATH.'/file/'.$bo_table.'/'.$list[$i][file][9][file];
    if (file_exists($dest_file) && get_extension($dest_file) == 'torrent')
    {
        $torrent_array = get_torrent_info($dest_file);
        $magnet = "magnet:?xt=urn:btih:".$torrent_array['hash'];

        echo "<a href='".$magnet."'>";
        echo sprintf('<i class="fa fa-magnet"></i>');
        echo "</a> ";

    }
?>
                <?php } ?>
                <!-- 마그넷링크 끝-->
                <!-- 마그넷 시작-->
<?php
    $dest_file = G5_DATA_PATH.'/file/'.$bo_table.'/'.$list[$i][file][0][file];
    $dest_file1 = G5_DATA_PATH.'/file/'.$bo_table.'/'.$list[$i][file][1][file];
    $dest_file2 = G5_DATA_PATH.'/file/'.$bo_table.'/'.$list[$i][file][2][file];
    $dest_file3 = G5_DATA_PATH.'/file/'.$bo_table.'/'.$list[$i][file][3][file];
    $dest_file4 = G5_DATA_PATH.'/file/'.$bo_table.'/'.$list[$i][file][4][file];
    $dest_file5 = G5_DATA_PATH.'/file/'.$bo_table.'/'.$list[$i][file][5][file];
    $dest_file6 = G5_DATA_PATH.'/file/'.$bo_table.'/'.$list[$i][file][6][file];
    $dest_file7 = G5_DATA_PATH.'/file/'.$bo_table.'/'.$list[$i][file][7][file];
    $dest_file8 = G5_DATA_PATH.'/file/'.$bo_table.'/'.$list[$i][file][8][file];
    $dest_file9 = G5_DATA_PATH.'/file/'.$bo_table.'/'.$list[$i][file][9][file];
    if (file_exists($dest_file) && get_extension($dest_file) == 'torrent' || file_exists($dest_file1) && get_extension($dest_file1) == 'torrent' || file_exists($dest_file2) && get_extension($dest_file2) == 'torrent' || file_exists($dest_file3) && get_extension($dest_file3) == 'torrent' || file_exists($dest_file4) && get_extension($dest_file4) == 'torrent' || file_exists($dest_file5) && get_extension($dest_file5) == 'torrent' || file_exists($dest_file6) && get_extension($dest_file6) == 'torrent' || file_exists($dest_file7) && get_extension($dest_file7) == 'torrent' || file_exists($dest_file8) && get_extension($dest_file8) == 'torrent' || file_exists($dest_file9) && get_extension($dest_file9) == 'torrent')
    {
?>

 

위에 소스는 목록에서 마그넷 링크 불러오는 소스입니다.

이걸 마그넷 링크를 검색 결과에서 불러오려고 하는데요.

$list[$i] 를 $list[$idx][$i] 로 고쳐도 안되네요.

뭘 수정해야 할까요?

이 질문에 댓글 쓰기 :

답변 2

common.lib.php 보시면

 

해당 파일의 정보를 구하는 것은

 

function get_file($bo_table, $wr_id)

 

이렇게 정의 되어 있습니다.

 

만약

 

<? print_r($list[$i]['file']) ?>

 

을 해보시고 안뜨신다면

 

<? $list[$i]['file']  = get_file(보드,글번호) ; ?>

 

를 해주어야 합니다.

 

그리고 리스트에서 파일을 계속 읽을 경우

 

서버에 많은 무리가 갈 것으로 예상 됩니다.

 

마그넷 주소는 변경 되는 값이 아니므로

 

글을 적을때 한번 여분 필드 wr1 ~ wr_10 중에 하나에 등록 해두는 것을 추천 드립니다.

 

보통 토렌트 사이트는 여분 필드에 파일 용량, 마그넷 주소를 적어 두는 것으로 알고 있습니다.

 

wr_3 에 마그넷 링크 저장해서 사용하고 있습니다.
한번 해볼께요. 감사합니다. 근데 서버에 무리가 많이 갈까요? 아직 방문자 수가 적어서 어느 정도는 버틸 수 있을 것 같은데... 나중에 삭제하던지 해야 겠어요. 감사합니다.

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

회원로그인

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