스크립트오류 500 질문드립니다.

스크립트오류 500 질문드립니다.

QA

스크립트오류 500 질문드립니다.

본문

안녕하세요 소스사용법일 적용하던중 안되는 부분이 있어서 질문드리겠습니다.

https://sir.kr/yc5_plugin/366

위링크 소스를 사용하고 자합니다

우선 저의 버전은 5.4 버전입니다.

덮어쓰기 해야하는 페이지가 2페이지가 겹치는 부분인데 

categoryformupdate.php / categoryform.php 해당부분인데 

덮어쓰기를 하면 수정이나 등록시 페이지가 넘어가지않고 하얀색 페이지로 나옵니다.

1794703588_1672359905.1747.png

 

팁에서 제공하는 소스중에 어떤부분을 넣어야 원활하게 소스가 작동할까요?

정말 필요한소스인데 팁좀 주시면 감사하겠습니다.

 


<?php
$sub_menu = '400200';
include_once('./_common.php');
auth_check_menu($auth, $sub_menu, "w");
$ca_include_head = isset($_POST['ca_include_head']) ? trim($_POST['ca_include_head']) : '';
$ca_include_tail = isset($_POST['ca_include_tail']) ? trim($_POST['ca_include_tail']) : '';
$ca_id = isset($_REQUEST['ca_id']) ? preg_replace('/[^0-9a-z]/i', '', $_REQUEST['ca_id']) : '';
if( ! $ca_id ){
    alert('', G5_SHOP_URL);
}
if ($file = $ca_include_head) {
    $file_ext = pathinfo($file, PATHINFO_EXTENSION);
    if (! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) || !preg_match("/\.(php|htm[l]?)$/i", $file)) {
        alert("상단 파일 경로가 php, html 파일이 아닙니다.");
    }
}
if ($file = $ca_include_tail) {
    $file_ext = pathinfo($file, PATHINFO_EXTENSION);
    if (! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) || !preg_match("/\.(php|htm[l]?)$/i", $file)) {
        alert("하단 파일 경로가 php, html 파일이 아닙니다.");
    }
}
if( $ca_id ){
    $sql = " select * from {$g5['g5_shop_category_table']} where ca_id = '$ca_id' ";
    $ca = sql_fetch($sql);
    if ($ca && ($ca['ca_include_head'] !== $ca_include_head || $ca['ca_include_tail'] !== $ca_include_tail) && function_exists('get_admin_captcha_by') && get_admin_captcha_by()){
        include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
        if (!chk_captcha()) {
            alert('자동등록방지 숫자가 틀렸습니다.');
        }
    }
}
$check_str_keys = array(
'ca_order'=>'int',
'ca_img_width'=>'int',
'ca_img_height'=>'int',
'ca_name'=>'str',
'ca_mb_id'=>'str',
'ca_nocoupon'=>'str',
'ca_mobile_skin_dir'=>'str',
'ca_skin'=>'str',
'ca_mobile_skin'=>'str',
'ca_list_mod'=>'int',
'ca_list_row'=>'int',
'ca_mobile_img_width'=>'int',
'ca_mobile_img_height'=>'int',
'ca_mobile_list_mod'=>'int',
'ca_mobile_list_row'=>'int',
'ca_sell_email'=>'str',
'ca_use'=>'int',
'ca_stock_qty'=>'int',
'ca_explan_html'=>'int',
'ca_cert_use'=>'int',
'ca_adult_use'=>'int',
'ca_skin_dir'=>'str'
);
for($i=0;$i<=10;$i++){
    $check_str_keys['ca_'.$i.'_subj'] = 'str';
    $check_str_keys['ca_'.$i] = 'str';
}
foreach( $check_str_keys as $key=>$val ){
    if( $val === 'int' ){
        $value = isset($_POST[$key]) ? (int) $_POST[$key] : 0;
    } else {
        $value = isset($_POST[$key]) ? clean_xss_tags($_POST[$key], 1, 1) : '';
    }
    $$key = $_POST[$key] = $value;
}
$ca_head_html = isset($_POST['ca_head_html']) ? $_POST['ca_head_html'] : '';
$ca_tail_html = isset($_POST['ca_tail_html']) ? $_POST['ca_tail_html'] : '';
$ca_mobile_head_html = isset($_POST['ca_mobile_head_html']) ? $_POST['ca_mobile_head_html'] : '';
$ca_mobile_tail_html = isset($_POST['ca_mobile_tail_html']) ? $_POST['ca_mobile_tail_html'] : '';
if(!is_include_path_check($ca_include_head, 1)) {
    alert('상단 파일 경로에 포함시킬수 없는 문자열이 있습니다.');
}
if(!is_include_path_check($ca_include_tail, 1)) {
    alert('하단 파일 경로에 포함시킬수 없는 문자열이 있습니다.');
}
$check_keys = array('ca_skin_dir', 'ca_mobile_skin_dir', 'ca_skin', 'ca_mobile_skin'); 
foreach( $check_keys as $key ){
    if( isset($$key) && preg_match('#\.+(\/|\\\)#', $$key) ){
        alert('스킨명 또는 경로에 포함시킬수 없는 문자열이 있습니다.');
    }
}
if( function_exists('filter_input_include_path') ){
    $ca_include_head = filter_input_include_path($ca_include_head);
    $ca_include_tail = filter_input_include_path($ca_include_tail);
}
if ($w == "u" || $w == "d")
    check_demo();
auth_check_menu($auth, $sub_menu, "d");
check_admin_token();
if ($w == 'd' && $is_admin != 'super')
    alert("최고관리자만 분류를 삭제할 수 있습니다.");
if ($w == "" || $w == "u")
{
    if ($ca_mb_id)
    {
        $sql = " select mb_id from {$g5['member_table']} where mb_id = '$ca_mb_id' ";
        $row = sql_fetch($sql);
        if (!$row['mb_id'])
            alert("\'$ca_mb_id\' 은(는) 존재하는 회원아이디가 아닙니다.");
    }
}
if( $ca_skin && ! is_include_path_check($ca_skin) ){
    alert('오류 : 데이터폴더가 포함된 path 를 포함할수 없습니다.');
}
$sql_common = " ca_order                = '$ca_order',
                ca_skin_dir             = '$ca_skin_dir',
                ca_mobile_skin_dir      = '$ca_mobile_skin_dir',
                ca_skin                 = '$ca_skin',
                ca_mobile_skin          = '$ca_mobile_skin',
                ca_img_width            = '$ca_img_width',
                ca_img_height           = '$ca_img_height',
                ca_list_mod             = '$ca_list_mod',
                ca_list_row             = '$ca_list_row',
                ca_mobile_img_width     = '$ca_mobile_img_width',
                ca_mobile_img_height    = '$ca_mobile_img_height',
                ca_mobile_list_mod      = '$ca_mobile_list_mod',
                ca_mobile_list_row      = '$ca_mobile_list_row',
                ca_sell_email           = '$ca_sell_email',
                ca_use                  = '$ca_use',
                ca_stock_qty            = '$ca_stock_qty',
                ca_explan_html          = '$ca_explan_html',
                ca_head_html            = '$ca_head_html',
                ca_tail_html            = '$ca_tail_html',
                ca_mobile_head_html     = '$ca_mobile_head_html',
                ca_mobile_tail_html     = '$ca_mobile_tail_html',
                ca_include_head         = '$ca_include_head',
                ca_include_tail         = '$ca_include_tail',
                ca_mb_id                = '$ca_mb_id',
                ca_cert_use             = '$ca_cert_use',
                ca_adult_use            = '$ca_adult_use',
                ca_nocoupon             = '$ca_nocoupon',
                ca_1_subj               = '$ca_1_subj',
                ca_2_subj               = '$ca_2_subj',
                ca_3_subj               = '$ca_3_subj',
                ca_4_subj               = '$ca_4_subj',
                ca_5_subj               = '$ca_5_subj',
                ca_6_subj               = '$ca_6_subj',
                ca_7_subj               = '$ca_7_subj',
                ca_8_subj               = '$ca_8_subj',
                ca_9_subj               = '$ca_9_subj',
                ca_10_subj              = '$ca_10_subj',
                ca_1                    = '$ca_1',
                ca_2                    = '$ca_2',
                ca_3                    = '$ca_3',
                ca_4                    = '$ca_4',
                ca_5                    = '$ca_5',
                ca_6                    = '$ca_6',
                ca_7                    = '$ca_7',
                ca_8                    = '$ca_8',
                ca_9                    = '$ca_9',
                ca_10                   = '$ca_10' ";

if ($w == "")
{
    if (!trim($ca_id))
        alert("분류 코드가 없으므로 분류를 추가하실 수 없습니다.");
    // 소문자로 변환
    $ca_id = strtolower($ca_id);
    $sql = " insert {$g5['g5_shop_category_table']}
                set ca_id   = '$ca_id',
                    ca_name = '$ca_name',
                    $sql_common ";
    sql_query($sql);
}
else if ($w == "u")
{
    $sql = " update {$g5['g5_shop_category_table']}
                set ca_name = '$ca_name',
                    $sql_common
              where ca_id = '$ca_id' ";
    sql_query($sql);
    // 하위분류를 똑같은 설정으로 반영
    if (isset($_POST['sub_category']) && $_POST['sub_category']) {
        $len = strlen($ca_id);
        $sql = " update {$g5['g5_shop_category_table']}
                    set $sql_common
                  where SUBSTRING(ca_id,1,$len) = '$ca_id' ";
        if ($is_admin != 'super')
            $sql .= " and ca_mb_id = '{$member['mb_id']}' ";
        sql_query($sql);
    }
}
else if ($w == "d")
{
    // 분류의 길이
    $len = strlen($ca_id);
    $sql = " select COUNT(*) as cnt from {$g5['g5_shop_category_table']}
              where SUBSTRING(ca_id,1,$len) = '$ca_id'
                and ca_id <> '$ca_id' ";
    $row = sql_fetch($sql);
    if ($row['cnt'] > 0)
        alert("이 분류에 속한 하위 분류가 있으므로 삭제 할 수 없습니다.\\n\\n하위분류를 우선 삭제하여 주십시오.");
    $str = $comma = "";
    $sql = " select it_id from {$g5['g5_shop_item_table']} where ca_id = '$ca_id' ";
    $result = sql_query($sql);
    $i=0;
    while ($row = sql_fetch_array($result))
    {
        $i++;
        if ($i % 10 == 0) $str .= "\\n";
        $str .= "$comma{$row['it_id']}";
        $comma = " , ";
    }
    if ($str)
        alert("이 분류와 관련된 상품이 총 {$i} 건 존재하므로 상품을 삭제한 후 분류를 삭제하여 주십시오.\\n\\n$str");
    /* 상품분류 이미지 삭제 : s ........................................... */
    $_categoryformupdate_file_adm_inc_mode = 'd';
    include (G5_ADMIN_PATH.'/shop_admin/inc/setup/categoryformupdate_file_adm.inc.php'); // 상품분류 이미지 삭제
    /* 상품분류 이미지 삭제 : e ........................................... */
    // 분류 삭제
    $sql = " delete from {$g5['g5_shop_category_table']} where ca_id = '$ca_id' ";
    sql_query($sql);
}
if(function_exists('get_admin_captcha_by'))
    get_admin_captcha_by('remove');
if ($w == "" || $w == "u")
{

    /* 상품분류 이미지 삭제 : s ........................................... */
    $_categoryformupdate_file_adm_inc_mode = 'w';
    include (G5_ADMIN_PATH.'/shop_admin/inc/setup/categoryformupdate_file_adm.inc.php'); // 상품분류 이미지 추가
    /* 상품분류 이미지 삭제 : e ........................................... */

    goto_url("./categoryform.php?w=u&ca_id=$ca_id&$qstr");
} else {
    goto_url("./categorylist.php?$qstr");
}

이 질문에 댓글 쓰기 :

답변 3

categoryformupdate.php의 최상단에 아래 코드 넣고 해보시겠어요

 


ini_set('display_errors', 0);
register_shutdown_function('error_alert');
 
function error_alert()
{
        if(is_null($e = error_get_last()) === false)
        {
            print_r($e); 
 
        }
}

우선 답변감사드립니다.
Array ( [type] => 1 [message] => Call to undefined function auth_check_menu() [file] => /home/hosting_users/neo8255/www/adm/shop_admin/categoryformupdate.php [line] => 15 )

이렇게나옵니다.

auth_check_menu($auth, $sub_menu, "w");
이게 15번줄 입니다.

<?php
$sub_menu = '400200';
include_once('./_common.php');
ini_set('display_errors', 0);
register_shutdown_function('error_alert');
 
function error_alert()
{
        if(is_null($e = error_get_last()) === false)
        {
            print_r($e);
 
        }
}
auth_check_menu($auth, $sub_menu, "w");

$ca_include_head = isset($_POST['ca_include_head']) ? trim($_POST['ca_include_head']) : '';
$ca_include_tail = isset($_POST['ca_include_tail']) ? trim($_POST['ca_include_tail']) : '';
$ca_id = isset($_REQUEST['ca_id']) ? preg_replace('/[^0-9a-z]/i', '', $_REQUEST['ca_id']) : '';

if( ! $ca_id ){
    alert('', G5_SHOP_URL);
}

auth_check_menu function이 없다는데 adm/admin.lib.php가 잘 불러와지고 있나요?  shop_admin 경로 내에 _common.php가 있는지, 내용이 날아가진 않았는지 보셔야될거 같습니다.

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

회원로그인

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