From fc43e26c14f292c04031664c897a931b14f7d33f Mon Sep 17 00:00:00 2001 From: kit rio Date: Fri, 3 Jun 2022 11:00:02 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C=20PHP=205.?= =?UTF-8?q?1=20=EC=9D=B4=ED=95=98=20=EC=BD=94=EB=93=9C=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit json_encode, json_decode 는 PHP 5.2 부터 PHP 코어에 내장되어있습니다. https://php-legacy-docs.zend.com/manual/php5/en/json.requirements https://php-legacy-docs.zend.com/manual/php5/en/book.json --- adm/ajax.token.php | 1 - adm/theme_config_load.php | 3 +- bbs/ajax.comment_token.php | 3 +- bbs/ajax.write.token.php | 21 +++++---- bbs/write_token.php | 3 +- install/ajax.install.check.php | 8 ++-- lib/json.lib.php | 78 --------------------------------- shop/ajax.coupondownload.php | 3 +- shop/ajax.list.php | 3 +- shop/inicis/makesignature.php | 3 +- shop/kakaopay/makesignature.php | 74 ++++++++++++++++--------------- shop/lg/xpay_request.php | 3 +- 12 files changed, 58 insertions(+), 145 deletions(-) delete mode 100644 lib/json.lib.php diff --git a/adm/ajax.token.php b/adm/ajax.token.php index 158961c44..2e678cfaf 100644 --- a/adm/ajax.token.php +++ b/adm/ajax.token.php @@ -1,6 +1,5 @@ $token))); \ No newline at end of file +die(json_encode(array('token'=>$token))); diff --git a/bbs/ajax.write.token.php b/bbs/ajax.write.token.php index bc7b41dcc..1fe7b8df2 100644 --- a/bbs/ajax.write.token.php +++ b/bbs/ajax.write.token.php @@ -1,11 +1,10 @@ -'', 'token'=>$token, 'url'=>''))); -} \ No newline at end of file +'', 'token'=>$token, 'url'=>''))); +} diff --git a/bbs/write_token.php b/bbs/write_token.php index b14245b5d..e7c9520b1 100644 --- a/bbs/write_token.php +++ b/bbs/write_token.php @@ -1,6 +1,5 @@ '게시판 정보가 올바르지 않습니다.', 'url'=>G5_URL))); @@ -9,4 +8,4 @@ set_session('ss_write_'.$bo_table.'_token', ''); $token = get_write_token($bo_table); -die(json_encode(array('error'=>'', 'token'=>$token, 'url'=>''))); \ No newline at end of file +die(json_encode(array('error'=>'', 'token'=>$token, 'url'=>''))); diff --git a/install/ajax.install.check.php b/install/ajax.install.check.php index 8bd7306e0..038ff461d 100644 --- a/install/ajax.install.check.php +++ b/install/ajax.install.check.php @@ -1,12 +1,10 @@ $v) $result[] = json_encode($k).':'.json_encode($v); - return '{' . join(',', $result) . '}'; - } - } -} - -if(!function_exists('json_decode')) -{ - function json_decode($json) - { - $comment = false; - $out = '$x='; - for ($i=0; $i '회원 로그인 후 이용해 주십시오.'))); @@ -66,4 +65,4 @@ if($result && $cp['cz_type']) // 다운로드 증가 sql_query(" update {$g5['g5_shop_coupon_zone_table']} set cz_download = cz_download + 1 where cz_id = '$cz_id' "); -die(json_encode(array('error' => ''))); \ No newline at end of file +die(json_encode(array('error' => ''))); diff --git a/shop/ajax.list.php b/shop/ajax.list.php index 22816a9c5..93871146a 100644 --- a/shop/ajax.list.php +++ b/shop/ajax.list.php @@ -1,6 +1,5 @@ '', 'mKey'=>$mKey, 'timestamp'=>$timestamp, 'sign'=>$sign))); \ No newline at end of file +die(json_encode(array('error'=>'', 'mKey'=>$mKey, 'timestamp'=>$timestamp, 'sign'=>$sign))); diff --git a/shop/kakaopay/makesignature.php b/shop/kakaopay/makesignature.php index d0e8549a5..4a15c149e 100644 --- a/shop/kakaopay/makesignature.php +++ b/shop/kakaopay/makesignature.php @@ -1,36 +1,38 @@ -'올바른 방법으로 이용해 주십시오.'))); -} - -$orderNumber = get_session('ss_order_id'); -$price = preg_replace('#[^0-9]#', '', $_POST['price']); - -if(strlen($price) < 1) - die(json_encode(array('error'=>'가격이 올바르지 않습니다.'))); - -// -//################################### -// 2. 가맹점 확인을 위한 signKey를 해시값으로 변경 (SHA-256방식 사용) -//################################### -$mKey = hash("sha256", $default['de_kakaopay_key']); - -/* - //*** 위변조 방지체크를 signature 생성 *** - oid, price, timestamp 3개의 키와 값을 - key=value 형식으로 하여 '&'로 연결한 하여 SHA-256 Hash로 생성 된값 - ex) oid=INIpayTest_1432813606995&price=819000×tamp=2012-02-01 09:19:04.004 - * key기준 알파벳 정렬 - * timestamp는 반드시 signature생성에 사용한 timestamp 값을 timestamp input에 그대로 사용하여야함 - */ -$params = "oid=" . $orderNumber . "&price=" . $price . "×tamp=" . $timestamp; -$sign = hash("sha256", $params); - -die(json_encode(array('error'=>'', 'mKey'=>$mKey, 'timestamp'=>$timestamp, 'sign'=>$sign))); \ No newline at end of file + '올바른 방법으로 이용해 주십시오.'))); +} + +$orderNumber = get_session('ss_order_id'); +$price = preg_replace('#[^0-9]#', '', $_POST['price']); + +if (strlen($price) < 1) { + die(json_encode(array('error' => '가격이 올바르지 않습니다.'))); +} + +// +//################################### +// 2. 가맹점 확인을 위한 signKey를 해시값으로 변경 (SHA-256방식 사용) +//################################### +$mKey = hash("sha256", $default['de_kakaopay_key']); + +/* + //*** 위변조 방지체크를 signature 생성 *** + oid, price, timestamp 3개의 키와 값을 + key=value 형식으로 하여 '&'로 연결한 하여 SHA-256 Hash로 생성 된값 + ex) oid=INIpayTest_1432813606995&price=819000×tamp=2012-02-01 09:19:04.004 + * key기준 알파벳 정렬 + * timestamp는 반드시 signature생성에 사용한 timestamp 값을 timestamp input에 그대로 사용하여야함 + */ +$params = "oid=" . $orderNumber . "&price=" . $price . "×tamp=" . $timestamp; +$sign = hash("sha256", $params); + +die(json_encode(array('error'=>'', 'mKey'=>$mKey, 'timestamp'=>$timestamp, 'sign'=>$sign))); diff --git a/shop/lg/xpay_request.php b/shop/lg/xpay_request.php index 3e487d534..e5861f021 100644 --- a/shop/lg/xpay_request.php +++ b/shop/lg/xpay_request.php @@ -1,6 +1,5 @@ $LGD_HASHDATA, 'error' => ''))); \ No newline at end of file +die(json_encode(array('LGD_HASHDATA' => $LGD_HASHDATA, 'error' => '')));