테스트 사이트 - 개발 중인 베타 버전입니다

그룹최신갤러리 링크가 이상해요. 채택완료

bossbug 2년 전 조회 1,465

안녕하세요.

그룹최신갤러리하려고 검색해 보니 아래와 같은것이 있어서 적용했습니다.

그런데 문제는 썸네일 링크가 이상합니다.

원래 도메인이 abc.com 이면 auj.abc.com 어떤 날은 bjk.abc.com

이런식으로 나옵니다. 왜 그러는 건지 말씀 부탁드립니다.

감사합니다.

소스입니다.

latest.lib.php

</p>

<p><?php

if (!defined('_GNUBOARD_')) exit;

@include_once(G5_LIB_PATH.'/thumbnail.lib.php');</p>

<p>// 최신글 추출

// $cache_time 캐시 갱신시간

function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time=1, $options='')

{

    global $g5;</p>

<p>    if (!$skin_dir) $skin_dir = 'basic';

    

    $time_unit = 3600;  // 1시간으로 고정</p>

<p>    if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {

        if (G5_IS_MOBILE) {

            $latest_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];

            if(!is_dir($latest_skin_path))

                $latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];

            $latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);

        } else {

            $latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];

            $latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);

        }

        $skin_dir = $match[1];

    } else {

        if(G5_IS_MOBILE) {

            $latest_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;

            $latest_skin_url  = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;

        } else {

            $latest_skin_path = G5_SKIN_PATH.'/latest/'.$skin_dir;

            $latest_skin_url  = G5_SKIN_URL.'/latest/'.$skin_dir;

        }

    }</p>

<p>    $caches = false;</p>

<p>    if(G5_USE_CACHE) {

        $cache_file_name = "latest-{$bo_table}-{$skin_dir}-{$rows}-{$subject_len}-".g5_cache_secret_key();

        $caches = g5_get_cache($cache_file_name, (int) $time_unit * (int) $cache_time);

        $cache_list = isset($caches['list']) ? $caches['list'] : array();

        g5_latest_cache_data($bo_table, $cache_list);

    }</p>

<p>    if( $caches === false ){</p>

<p>        $list = array();</p>

<p>        $board = get_board_db($bo_table, true);</p>

<p>        if( ! $board ){

            return '';

        }</p>

<p>        $bo_subject = get_text($board['bo_subject']);</p>

<p>        $tmp_write_table = $g5['write_prefix'] . $bo_table; // 게시판 테이블 전체이름

        $sql = " select * from {$tmp_write_table} where wr_is_comment = 0 order by wr_num limit 0, {$rows} ";

        

        $result = sql_query($sql);

        for ($i=0; $row = sql_fetch_array($result); $i++) {

            try {

                unset($row['wr_password']);     //패스워드 저장 안함( 아예 삭제 )

            } catch (Exception $e) {

            }

            $row['wr_email'] = '';              //이메일 저장 안함

            if (strstr($row['wr_option'], 'secret')){           // 비밀글일 경우 내용, 링크, 파일 저장 안함

                $row['wr_content'] = $row['wr_link1'] = $row['wr_link2'] = '';

                $row['file'] = array('count'=>0);

            }

            $list[$i] = get_list($row, $board, $latest_skin_url, $subject_len);</p>

<p>            $list[$i]['first_file_thumb'] = (isset($row['wr_file']) && $row['wr_file']) ? get_board_file_db($bo_table, $row['wr_id'], 'bf_file, bf_content', "and bf_type in (1, 2, 3, 18) ", true) : array('bf_file'=>'', 'bf_content'=>'');

            $list[$i]['bo_table'] = $bo_table;

            // 썸네일 추가

            if($options && is_string($options)) {

                $options_arr = explode(',', $options);

                $thumb_width = $options_arr[0];

                $thumb_height = $options_arr[1];

                $thumb = get_list_thumbnail($bo_table, $row['wr_id'], $thumb_width, $thumb_height, false, true);

                // 이미지 썸네일

                if($thumb['src']) {

                    $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$thumb_width.'" height="'.$thumb_height.'">';

                    $list[$i]['img_thumbnail'] = '<a href="'.$list[$i]['href'].'" class="lt_img">'.$img_content.'</a>';

                // } else {

                //     $img_content = '<img src="'. G5_IMG_URL.'/no_img.png'.'" alt="'.$thumb['alt'].'" width="'.$thumb_width.'" height="'.$thumb_height.'" class="no_img">';

                }

            }</p>

<p>            if(! isset($list[$i]['icon_file'])) $list[$i]['icon_file'] = '';

        }

        g5_latest_cache_data($bo_table, $list);</p>

<p>        if(G5_USE_CACHE) {</p>

<p>            $caches = array(

                'list' => $list,

                'bo_subject' => sql_escape_string($bo_subject),

            );</p>

<p>            g5_set_cache($cache_file_name, $caches, (int) $time_unit * (int) $cache_time);

        }

    } else {

        $list = $cache_list;

        $bo_subject = (is_array($caches) && isset($caches['bo_subject'])) ? $caches['bo_subject'] : '';

    }</p>

<p>    ob_start();

    include $latest_skin_path.'/latest.skin.php';

    $content = ob_get_contents();

    ob_end_clean();</p>

<p>    return $content;

}</p>

<p>//그룹추출</p>

<p>function latest2($skin_dir='', $gr_id, $rows=10, $subject_len=40, $cache_time=1, $options='')

{

    global $g5;

    if (!$skin_dir) $skin_dir = 'basic';

    if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {

        if (G5_IS_MOBILE) {

            $latest_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];

            if(!is_dir($latest_skin_path))

                $latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];

            $latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);

        } else {

            $latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];

            $latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);

        }

        $skin_dir = $match[1];

    } else {

        if(G5_IS_MOBILE) {

            $latest_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;

            $latest_skin_url  = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;

        } else {

            $latest_skin_path = G5_SKIN_PATH.'/latest/'.$skin_dir;

            $latest_skin_url  = G5_SKIN_URL.'/latest/'.$skin_dir;

        }

    }

    $caches = false;

    if(G5_USE_CACHE) {

        $cache_file_name = "latest-{$gr_id}-{$skin_dir}-{$rows}-{$subject_len}-".g5_cache_secret_key();

        $caches = g5_get_cache($cache_file_name);

        $cache_list = isset($caches['list']) ? $caches['list'] : array();

        g5_latest_cache_data($bo_table, $cache_list);

    }

    if( $caches === false ){

        $list = array();

        $sql = "select a.*, b.bo_subject, c.gr_subject, c.gr_id from g5_board_new a, g5_board b, g5_group c where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = 1 and c.gr_id = '{$gr_id}' and a.wr_id = a. wr_parent order by a.bn_id desc limit 0, {$rows}";

       

        $result = sql_query($sql);

        for ($i=0; $row=sql_fetch_array($result); $i++) {

  

   $sql = " select * from {$g5['board_table']} where bo_table = '{$row['bo_table']}' ";

   $board = sql_fetch($sql);     

  

   $tmp_write_table = $g5['write_prefix'].$row['bo_table'];

   $row2 = sql_fetch(" select * from {$tmp_write_table} where wr_id = '{$row['wr_id']}' ");

   

   $list[$i] = $row2;

   $list[$i] = get_list($row2, $board, $latest_skin_url, $subject_len);

   $list[$i]['subject'] = "[".$row['bo_subject']."] ".$list[$i]['subject'];

   $list[$i]['bo_table'] = $row['bo_table'];

  }</p>

<p>        if(G5_USE_CACHE) {

            $caches = array(

                'list' => $list,

                'bo_subject' => sql_escape_string($bo_subject),

            );

            g5_set_cache($cache_file_name, $caches, 3600 * $cache_time);

        }

    } else {

        $list = $cache_list;

        $bo_subject = (is_array($caches) && isset($caches['bo_subject'])) ? $caches['bo_subject'] : '';

    }

    ob_start();

    include $latest_skin_path.'/latest.skin.php';

    $content = ob_get_contents();

    ob_end_clean();

    return $content;

}

?></p>

<p>

댓글을 작성하려면 로그인이 필요합니다.

답변 2개

채택된 답변
+20 포인트
2년 전

안녕하세요.

해당 소스와 상관없이 DNS부분과 서버 설정에서 가상호스트 부분을 확인해야 하지 않을까요?

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

b
bossbug
2년 전
의견 감사합니다.
latest.skin.php에서
아래 처럼 넣으면 링크가 제대로 나오고요.
[code]
echo "<a href=\"".$list[$i]['href']."\"> ";
if ($list[$i]['is_notice'])
echo $img_content;
echo "<strong>".$list[$i]['subject']."</strong>";
else
echo $img_content;
echo $list[$i]['subject'];
echo "</a>";
[/code]
이렇게 넣었더니 도메인에 이상한게 붙어서 나옵니다.
[code]
<a href="<?php echo $list[$i]['href'] ?>" class="lt_img"><?php echo $img_content; ?></a>
[/code]
왜 그런지 모르겠습니다.
시간내서 답변해 주셔서 대단히 감사합니다.

댓글을 작성하려면 로그인이 필요합니다.

2년 전

운영도메인과 전혀 상관없는 도메인이라면

실제로 DB 에 그렇게 값이 들어가 있는지 먼저 확인되어야 할것 같고

 

그렇지도 않은데 매번 랜덤하게 바뀐다면

해당 페이지에서 소스보기해서 이상한 스크립트가 포함되어 있지 않나 확인해보세요

여기에 해당하는 경우라면 서버 또는 서비스의 보안이 뚫렸을수도 있을것 같습니다.

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

b
bossbug
2년 전
제이앤 님께서 먼저 답변을 주셔서 채택 못드렸습니다.
답변 감사합니다.

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인