master 와 merge

This commit is contained in:
thisgun committed 2017-10-25 11:09:31 +09:00
commit 376025ba31
25 files changed
+440 -128

No files matched your search

+11 -2
View File
@@ -382,15 +382,24 @@ function admin_referer_check($return=false)
}
$p = @parse_url($referer);
$host = preg_replace('/:[0-9]+$/', '', $_SERVER['HTTP_HOST']);
$msg = '';
if($host != $p['host']) {
$msg = '올바른 방법으로 이용해 주십시오.';
}
if($return)
if( $p['path'] && ! preg_match( '/\/'.preg_quote(G5_ADMIN_DIR).'\//i', $p['path'] ) ){
$msg = '올바른 방법으로 이용해 주십시오';
}
if( $msg ){
if($return) {
return $msg;
else
} else {
alert($msg, G5_URL);
}
}
}
+3 -1
View File
@@ -1,5 +1,7 @@
<?php
if (!defined('_GNUBOARD_')) exit;
$print_version = defined('G5_YOUNGCART_VER') ? 'YoungCart Version '.G5_YOUNGCART_VER : 'Version '.G5_GNUBOARD_VER;
?>
<noscript>
@@ -12,7 +14,7 @@ if (!defined('_GNUBOARD_')) exit;
</div>
<footer id="ft">
<p>
Copyright &copy; <?php echo $_SERVER['HTTP_HOST']; ?>. All rights reserved.<br>
Copyright &copy; <?php echo $_SERVER['HTTP_HOST']; ?>. All rights reserved. <?php echo $print_version; ?><br>
<button type="button" class="scroll_top"><span class="top_img"></span><span class="top_txt">TOP</span></button>
</p>
</footer>
+4 -4
View File
@@ -21,7 +21,7 @@ if ($file = $_POST['bo_include_head']) {
$purl = parse_url($file);
$file = $purl['path'];
if (!preg_match("/\.(php|htm['l']?)$/i", $file)) {
alert('상단 파일 경로가 php, html 파일이 아닙니다.');
alert('상단 파일 경로의 확장자는 php, html 만 허용합니다.');
}
$_POST['bo_include_head'] = $file;
}
@@ -30,16 +30,16 @@ if ($file = $_POST['bo_include_tail']) {
$purl = parse_url($file);
$file = $purl['path'];
if (!preg_match("/\.(php|htm['l']?)$/i", $file)) {
alert('하단 파일 경로가 php, html 파일이 아닙니다.');
alert('하단 파일 경로의 확장자는 php, html 만 허용합니다.');
}
$_POST['bo_include_tail'] = $file;
}
if(!is_include_path_check($_POST['bo_include_head'])) {
if(!is_include_path_check($_POST['bo_include_head'], 1)) {
alert('/data/file/ 또는 /data/editor/ 포함된 문자를 상단 파일 경로에 포함시킬수 없습니다.');
}
if(!is_include_path_check($_POST['bo_include_tail'])) {
if(!is_include_path_check($_POST['bo_include_tail'], 1)) {
alert('/data/file/ 또는 /data/editor/ 포함된 문자를 하단 파일 경로에 포함시킬수 없습니다.');
}
+4 -1
View File
@@ -62,7 +62,10 @@ if ($_POST['act_button'] == "선택수정") {
// include 전에 $bo_table 값을 반드시 넘겨야 함
$tmp_bo_table = trim($_POST['board_table'][$k]);
include ('./board_delete.inc.php');
if( preg_match("/^[A-Za-z0-9_]+$/", $tmp_bo_table) ){
include ('./board_delete.inc.php');
}
}
+16
View File
@@ -20,6 +20,22 @@ if ($co_timg_del) @unlink(G5_DATA_PATH."/content/{$co_id}_t");
$error_msg = '';
if( $co_include_head ){
$purl = parse_url($co_include_head);
$file = $purl['path'];
if (!preg_match("/\.(php|htm['l']?)$/i", $file)) {
alert('상단 파일 경로의 확장자는 php, html 만 허용합니다.');
}
}
if( $co_include_tail ){
$purl = parse_url($co_include_tail);
$file = $purl['path'];
if (!preg_match("/\.(php|htm['l']?)$/i", $file)) {
alert('하단 파일 경로의 확장자는 php, html 만 허용합니다.');
}
}
if( $co_include_head && ! is_include_path_check($co_include_head) ){
$co_include_head = '';
$error_msg = '/data/file/ 또는 /data/editor/ 포함된 문자를 상단 파일 경로에 포함시킬수 없습니다.';
+1 -1
View File
@@ -7,7 +7,7 @@ auth_check($auth[$sub_menu], 'r');
if (empty($fr_date) || ! preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $fr_date) ) $fr_date = G5_TIME_YMD;
if (empty($to_date) || ! preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $to_date) ) $to_date = G5_TIME_YMD;
$qstr = "fr_date={$fr_date}{&amp;to_date}={$to_date}";
$qstr = "fr_date={$fr_date}&amp;to_date={$to_date}";
$sql_common = " from {$g5['popular_table']} a ";
$sql_search = " where trim(pp_word) <> '' and pp_date between '{$fr_date}' and '{$to_date}' ";
+18 -2
View File
@@ -10,12 +10,28 @@ check_admin_token();
$error_msg = '';
if( $qa_include_head && ! is_include_path_check($qa_include_head) ){
if( $qa_include_head ){
$purl = parse_url($qa_include_head);
$file = $purl['path'];
if (!preg_match("/\.(php|htm['l']?)$/i", $file)) {
alert('상단 파일 경로의 확장자는 php, html 만 허용합니다.');
}
}
if( $qa_include_tail ){
$purl = parse_url($qa_include_tail);
$file = $purl['path'];
if (!preg_match("/\.(php|htm['l']?)$/i", $file)) {
alert('하단 파일 경로의 확장자는 php, html 만 허용합니다.');
}
}
if( $qa_include_head && ! is_include_path_check($qa_include_head, 1) ){
$qa_include_head = '';
$error_msg = '/data/file/ 또는 /data/editor/ 포함된 문자를 상단 파일 경로에 포함시킬수 없습니다.';
}
if( $qa_include_tail && ! is_include_path_check($qa_include_tail) ){
if( $qa_include_tail && ! is_include_path_check($qa_include_tail, 1) ){
$qa_include_tail = '';
$error_msg = '/data/file/ 또는 /data/editor/ 포함된 문자를 하단 파일 경로에 포함시킬수 없습니다.';
}
+1 -1
View File
@@ -7,7 +7,7 @@ if ($is_guest)
$g5['title'] = '내 쪽지함';
include_once(G5_PATH.'/head.sub.php');
if (!$kind) $kind = 'recv';
$kind = $kind ? clean_xss_tags(strip_tags($kind)) : 'recv';
if ($kind == 'recv')
$unkind = 'send';
+4 -2
View File
@@ -115,7 +115,9 @@ while ($row = sql_fetch_array($result))
if ($row3['bf_file'])
{
// 원본파일을 복사하고 퍼미션을 변경
@copy($src_dir.'/'.$row3['bf_file'], $dst_dir.'/'.$row3['bf_file']);
// 제이프로님 코드제안 적용
$copy_file_name = ($bo_table !== $move_bo_table) ? $row3['bf_file'] : $row2['wr_id'].'_copy_'.$insert_id.'_'.$row3['bf_file'];
@copy($src_dir.'/'.$row3['bf_file'], $dst_dir.'/'.$copy_file_name);
@chmod($dst_dir/$row3['bf_file'], G5_FILE_PERMISSION);
}
@@ -124,7 +126,7 @@ while ($row = sql_fetch_array($result))
wr_id = '$insert_id',
bf_no = '{$row3['bf_no']}',
bf_source = '".addslashes($row3['bf_source'])."',
bf_file = '{$row3['bf_file']}',
bf_file = '$copy_file_name',
bf_download = '{$row3['bf_download']}',
bf_content = '".addslashes($row3['bf_content'])."',
bf_filesize = '{$row3['bf_filesize']}',
+1 -1
View File
@@ -69,7 +69,7 @@ for($i=0;$i<count($_POST['chk_bn_id']);$i++)
if ($pressed == '선택내용삭제') {
// 게시글 내용만 삭제
sql_query(" update $write_table set wr_subject = '{$g5['time_ymdhis']} - 본인 요청으로 인한 삭제 (냉무) ☆', wr_content = '', wr_name='본인요청삭제☆' where wr_id = '{$write['wr_id']}' ");
sql_query(" update $write_table set wr_subject = '".G5_TIME_YMDHIS." - 본인 요청으로 인한 삭제 (냉무) ☆', wr_content = '', wr_name='본인요청삭제☆' where wr_id = '{$write['wr_id']}' ");
} else {
// 게시글 삭제
sql_query(" delete from $write_table where wr_parent = '{$write['wr_id']}' ");
+1 -1
View File
@@ -4,7 +4,7 @@ include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
include_once(G5_LIB_PATH.'/mailer.lib.php');
if ($is_member) {
alert('이미 로그인중입니다.');
alert_close('이미 로그인중입니다.', G5_URL);
}
if (!chk_captcha()) {
+2 -2
View File
@@ -448,7 +448,7 @@ if ($is_admin != 'super') {
break;
}
if (!$is_possible_ip)
die ("접근이 가능하지 않습니다.");
die ("<meta charset=utf-8>접근이 가능하지 않습니다.");
}
// 접근차단 IP
@@ -464,7 +464,7 @@ if ($is_admin != 'super') {
$pat = "/^{$pattern[$i]}$/";
$is_intercept_ip = preg_match($pat, $_SERVER['REMOTE_ADDR']);
if ($is_intercept_ip)
die ("접근 불가합니다.");
die ("<meta charset=utf-8>접근 불가합니다.");
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
********************/
define('G5_VERSION', '그누보드5');
define('G5_GNUBOARD_VER', '5.2.9.2');
define('G5_GNUBOARD_VER', '5.2.9.5');
// 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음
define('_GNUBOARD_', true);
+5
View File
@@ -125,6 +125,7 @@ if($is_admin != 'super')
<p>프로그램을 실행하시려면 그누보드4의 config.php 파일 경로를 입력하신 후 확인을 클릭해 주십시오.</p>
<form name="fimport" method="post" action="./g4_import_run.php" onsubmit="return fimport_submit(this);">
<input type="hidden" name="token" value="" >
<div id="g4_import_frm">
<label for="file_path">config.php 파일 경로</label>
<input type="text" name="file_path" id="file_path" required class="frm_input required">
@@ -142,6 +143,10 @@ if($is_admin != 'super')
<script>
function fimport_submit(f)
{
var token = get_write_token('g4_import');
f.token.value = token;
return confirm('그누보드4의 DB 데이터를 이전하시겠습니까?');
}
</script>
+8 -1
View File
@@ -17,6 +17,13 @@ echo '<link rel="stylesheet" href="'.G5_URL.'/g4_import.css">';
if(empty($_POST))
alert('올바른 방법으로 이용해 주십시오.', G5_URL);
if (!preg_match("/^http['s']?:\/\/".$_SERVER['HTTP_HOST']."/", $_SERVER['HTTP_REFERER'])){
alert("제대로 된 접근이 아닌것 같습니다.", G5_URL);
}
// 토큰체크
check_write_token('g4_import');
if(get_session('tables_copied') == 'done')
alert('DB 데이터 변환을 이미 실행하였습니다. 중복 실행시 오류가 발생할 수 있습니다.', G5_URL);
@@ -165,7 +172,7 @@ document.onkeydown = noRefresh ;
flush();
// g4의 confing.php
require($g4_config_file);
require('./'.$g4_config_file);
if(preg_replace('/[^a-z]/', '', strtolower($g4['charset'])) == 'euckr')
$is_euckr = true;
+22
View File
@@ -140,6 +140,28 @@ function frm_install_submit(f)
alert('최고관리자 E-mail 을 입력하십시오.'); f.admin_email.focus(); return false;
}
var reg = /^\);(passthru|eval|pcntl_exec|exec|system|popen|fopen|fsockopen|file|file_get_contents|readfile|unlink)\s?\(\$_(get|post|request)\s?\[.*?\]\s?\)/gi;
var reg_msg = " 에 유효하지 않는 문자가 있습니다. 다른 문자로 대체해 주세요.";
if( reg.test(f.mysql_host.value) ){
alert('MySQL Host'+reg_msg); f.mysql_host.focus(); return false;
}
if( reg.test(f.mysql_user.value) ){
alert('MySQL User'+reg_msg); f.mysql_user.focus(); return false;
}
if( f.mysql_pass.value && reg.test(f.mysql_pass.value) ){
alert('MySQL PASSWORD'+reg_msg); f.mysql_pass.focus(); return false;
}
if( reg.test(f.mysql_db.value) ){
alert('MySQL DB'+reg_msg); f.mysql_db.focus(); return false;
}
if( f.table_prefix.value && reg.test(f.table_prefix.value) ){
alert('TABLE명 접두사'+reg_msg); f.table_prefix.focus(); return false;
}
if(/^[a-z][a-z0-9]/i.test(f.admin_id.value) == false) {
alert('최고관리자 회원 ID는 첫자는 반드시 영문자 그리고 영문자와 숫자로만 만드셔야 합니다.');
+15 -5
View File
@@ -12,16 +12,26 @@ header('Pragma: no-cache'); // HTTP/1.0
include_once ('../config.php');
include_once ('../lib/common.lib.php');
if( ! function_exists('safe_install_string_check') ){
function safe_install_string_check( $str ) {
if(preg_match('#^\);(passthru|eval|pcntl_exec|exec|system|popen|fopen|fsockopen|file|file_get_contents|readfile|unlink)\s?\(\$_(get|post|request)\s?\[.*?\]\s?\)#i', $str)) {
die("입력한 값에 안전하지 않는 문자가 포함되어 있습니다. 설치를 중단합니다.");
}
return $str;
}
}
$title = G5_VERSION." 설치 완료 3/3";
include_once ('./install.inc.php');
//print_r($_POST); exit;
$mysql_host = $_POST['mysql_host'];
$mysql_user = $_POST['mysql_user'];
$mysql_pass = $_POST['mysql_pass'];
$mysql_db = $_POST['mysql_db'];
$table_prefix= $_POST['table_prefix'];
$mysql_host = safe_install_string_check($_POST['mysql_host']);
$mysql_user = safe_install_string_check($_POST['mysql_user']);
$mysql_pass = safe_install_string_check($_POST['mysql_pass']);
$mysql_db = safe_install_string_check($_POST['mysql_db']);
$table_prefix= safe_install_string_check($_POST['table_prefix']);
$admin_id = $_POST['admin_id'];
$admin_pass = $_POST['admin_pass'];
$admin_name = $_POST['admin_name'];
+36 -4
View File
@@ -22,10 +22,14 @@ function certify_win_open(type, url)
if($("#kcp_cert").size() < 1) {
$frm.wrap('<div id="cert_info"></div>');
$("#cert_info").append('<form name="form_temp" method="post">')
.after('<iframe id="kcp_cert" name="kcp_cert" width="100%" height="700" frameborder="0" scrolling="no" style="display:none"></iframe>');
$("#cert_info").append('<form name="form_temp" method="post">');
} else {
$("#kcp_cert").remove();
}
$("#cert_info")
.after('<iframe id="kcp_cert" name="kcp_cert" width="100%" height="700" frameborder="0" scrolling="no" style="display:none"></iframe>');
var temp_form = document.form_temp;
temp_form.target = "kcp_cert";
temp_form.action = url;
@@ -51,8 +55,36 @@ function certify_win_open(type, url)
}
else if(type == 'lg-hp')
{
var popupWindow = window.open( url, "auth_popup", "left=200, top=100, width=400, height=400, scrollbar=yes" );
popupWindow.focus();
if( g5_is_mobile )
{
var $frm = $(event.target.form),
lgu_cert = "lgu_cert";
if($("#lgu_cert").size() < 1) {
$frm.wrap('<div id="cert_info"></div>');
$("#cert_info").append('<form name="form_temp" method="post">');
} else {
$("#"+lgu_cert).remove();
}
$("#cert_info")
.after('<iframe id="'+lgu_cert+'" name="lgu_cert" width="100%" src="'+url+'" height="700" frameborder="0" scrolling="no" style="display:none"></iframe>');
document.getElementById( "cert_info" ).style.display = "none";
document.getElementById( lgu_cert ).style.display = "";
} else {
var width= 640;
var height = 660;
var leftpos = screen.width / 2 - ( width / 2 );
var toppos = screen.height / 2 - ( height / 2 );
var popupWindow = window.open( url, "auth_popup", "left=" + leftpos + ", top=" + toppos + ", width=" + width + ", height=" + height + ", scrollbar=yes" );
popupWindow.focus();
}
}
}
+20 -18
View File
@@ -69,6 +69,8 @@ function number_format(data)
var cutlen = 3;
var comma = ',';
var i;
data = data + '';
var sign = data.match(/^[\+\-]/);
if(sign) {
@@ -546,8 +548,6 @@ function font_resize(id, rmv_class, add_class)
set_cookie("ck_font_resize_rmv_class", rmv_class, 1, g5_cookie_domain);
set_cookie("ck_font_resize_add_class", add_class, 1, g5_cookie_domain);
$el.trigger("click_font_resize");
}
/**
@@ -723,26 +723,28 @@ function get_write_token(bo_table)
}
$(function() {
$(document).on("click", "form[name=fwrite] input:submit, form[name=fwrite] button:submit, form[name=fwrite] input:image", function() {
$(document).on("click", "form[name=fwrite] input:submit, form[name=fwrite] button:submit, form[name=fwrite] input:image", function() {
var f = this.form;
var bo_table = (typeof f.bo_table != "undefined") ? f.bo_table.value : "";
if( bo_table ){
var token = get_write_token(bo_table);
if(!token) {
alert("토큰 정보가 올바르지 않습니다.");
return false;
}
var $f = $(f);
if(typeof f.token === "undefined")
$f.prepend('<input type="hidden" name="token" value="">');
$f.find("input[name=token]").val(token);
if (typeof(f.bo_table) == "undefined") {
return;
}
var bo_table = f.bo_table.value;
var token = get_write_token(bo_table);
if(!token) {
alert("토큰 정보가 올바르지 않습니다.");
return false;
}
var $f = $(f);
if(typeof f.token === "undefined")
$f.prepend('<input type="hidden" name="token" value="">');
$f.find("input[name=token]").val(token);
return true;
});
});
+52 -35
View File
@@ -153,7 +153,7 @@ function alert($msg='', $url='', $error=true, $post=false)
global $g5, $config, $member;
global $is_admin;
if (!$msg) $msg = '올바른 방법으로 이용해 주십시오.';
$msg = $msg ? strip_tags($msg, '<br>') : '올바른 방법으로 이용해 주십시오.';
$header = '';
if (isset($g5['title'])) {
@@ -168,6 +168,8 @@ function alert($msg='', $url='', $error=true, $post=false)
function alert_close($msg, $error=true)
{
global $g5;
$msg = strip_tags($msg, '<br>');
$header = '';
if (isset($g5['title'])) {
@@ -2019,8 +2021,12 @@ function sql_real_escape_string($str, $link=null)
if(!$link)
$link = $g5['connect_db'];
if(function_exists('mysqli_connect') && G5_MYSQLI_USE) {
return mysqli_real_escape_string($link, $str);
}
return mysqli_real_escape_string($link, $str);
return mysql_real_escape_string($str, $link);
}
function escape_trim($field)
@@ -2666,7 +2672,10 @@ if (!function_exists("get_sock")) {
$fp = fsockopen ($host, 80, $errno, $errstr, 30);
if (!$fp)
{
die("$errstr ($errno)\n");
//die("$errstr ($errno)\n");
echo "$errstr ($errno)\n";
return null;
}
else
{
@@ -3299,46 +3308,54 @@ function get_call_func_cache($func, $args=array()){
}
// include 하는 경로에 data file 경로가 포함되어 있는지 체크합니다.
function is_include_path_check($path='')
function is_include_path_check($path='', $is_input='')
{
if( $path ){
try {
// whether $path is unix or not
$unipath = strlen($path)==0 || $path{0}!='/';
$unc = substr($path,0,2)=='\\\\'?true:false;
// attempts to detect if path is relative in which case, add cwd
if(strpos($path,':') === false && $unipath && !$unc){
$path=getcwd().DIRECTORY_SEPARATOR.$path;
if($path{0}=='/'){
$unipath = false;
if ($is_input){
try {
// whether $path is unix or not
$unipath = strlen($path)==0 || $path{0}!='/';
$unc = substr($path,0,2)=='\\\\'?true:false;
// attempts to detect if path is relative in which case, add cwd
if(strpos($path,':') === false && $unipath && !$unc){
$path=getcwd().DIRECTORY_SEPARATOR.$path;
if($path{0}=='/'){
$unipath = false;
}
}
// resolve path parts (single dot, double dot and double delimiters)
$path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path);
$parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
$absolutes = array();
foreach ($parts as $part) {
if ('.' == $part){
continue;
}
if ('..' == $part) {
array_pop($absolutes);
} else {
$absolutes[] = $part;
}
}
$path = implode(DIRECTORY_SEPARATOR, $absolutes);
// resolve any symlinks
// put initial separator that could have been lost
$path = !$unipath ? '/'.$path : $path;
$path = $unc ? '\\\\'.$path : $path;
} catch (Exception $e) {
//echo 'Caught exception: ', $e->getMessage(), "\n";
return false;
}
// resolve path parts (single dot, double dot and double delimiters)
$path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path);
$parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
$absolutes = array();
foreach ($parts as $part) {
if ('.' == $part){
continue;
}
if ('..' == $part) {
array_pop($absolutes);
} else {
$absolutes[] = $part;
}
if( preg_match('/\/data\/(file|editor)\/[A-Za-z0-9_]{1,20}\//', $path) ){
return false;
}
$path = implode(DIRECTORY_SEPARATOR, $absolutes);
// resolve any symlinks
// put initial separator that could have been lost
$path = !$unipath ? '/'.$path : $path;
$path = $unc ? '\\\\'.$path : $path;
} catch (Exception $e) {
//echo 'Caught exception: ', $e->getMessage(), "\n";
return false;
}
if( preg_match('/\/data\/(file|editor)\/[A-Za-z0-9_]{1,20}\//', $path) ){
$extension = pathinfo($path, PATHINFO_EXTENSION);
if($extension && preg_match('/(jpg|jpeg|png|gif|bmp|conf)$/', $extension)) {
return false;
}
}
+8 -1
View File
@@ -173,7 +173,14 @@ if( $cert_enc_use == "Y" )
else if( $cert_enc_use != "Y" )
{
// 암호화 인증 안함
alert_close("휴대폰 본인확인을 취소 하셨습니다.");
if( G5_IS_MOBILE ){
echo '<script>'.PHP_EOL;
echo 'window.parent.$("#cert_info").css("display", "");'.PHP_EOL;
echo 'window.parent.$("#kcp_cert" ).css("display", "none");'.PHP_EOL;
echo '</script>'.PHP_EOL;
} else {
alert_close("휴대폰 본인확인을 취소 하셨습니다.");
}
exit;
}
+98 -37
View File
@@ -19,10 +19,10 @@ $CST_MID = 'si_'.$config['cf_lg_mid']; // 상점아이
//테스트 아이디는 't'를 반드시 제외하고 입력하세요.
$LGD_MID = (('test' == $CST_PLATFORM) ? 't':'').$CST_MID; //상점아이디(자동생성)
$LGD_BUYER = '홍길동'; // 성명 (보안을 위해 DB난 세션에서 가져오세요)
$LGD_BUYERSSN = '0000000000000'; // 주민등록번호 (보안을 위해 DB나 세션에서 가져오세요)
$LGD_BUYERSSN = '000000'; // 주민등록번호 (보안을 위해 DB나 세션에서 가져오세요)
// 휴대폰 본인인증을 사용할 경우 주민번호는 '0' 13자리를 넘기세요. 예)0000000000000
// 기타 인증도 사용할 경우 실 주민등록번호 (보안을 위해 DB나 세션에 저장처리 권장)
$LGD_MOBILE_SUBAUTH_SITECD = ''; // 신용평가사에서 부여받은 회원사 고유 코드
$LGD_MOBILE_SUBAUTH_SITECD = '123456789abc'; // 신용평가사에서 부여받은 회원사 고유 코드
// (CI값만 필요한 경우 옵션, DI값도 필요한 경우 필수)
$LGD_TIMESTAMP = date('YmdHis'); // 타임스탬프 (YYYYMMDDhhmmss)
$LGD_CUSTOM_SKIN = 'red'; // 상점정의 인증창 스킨 (red, blue, cyan, green, yellow)
@@ -46,6 +46,45 @@ $LGD_CUSTOM_SKIN = 'red'; // 상점정의
$LGD_MERTKEY = $config['cf_lg_mert_key'];
$LGD_HASHDATA = md5($LGD_MID.$LGD_BUYERSSN.$LGD_TIMESTAMP.$LGD_MERTKEY);
$LGD_RETURNURL = G5_PLUGIN_URL.'/lgxpay/returnurl.php';
if( G5_IS_MOBILE ){
$LGD_WINDOW_TYPE = 'submit';
} else {
$LGD_WINDOW_TYPE = 'iframe';
}
$LGD_NAMECHECKYN = 'N';
$LGD_HOLDCHECKYN = 'Y';
$LGD_CUSTOM_USABLEPAY = 'ASC007';
$payReqMap = array();
$payReqMap['CST_PLATFORM'] = $CST_PLATFORM; // 테스트, 서비스 구분
$payReqMap['CST_MID'] = $CST_MID; // 상점아이디
$payReqMap['LGD_MID'] = $LGD_MID; // 상점아이디
$payReqMap['LGD_HASHDATA'] = $LGD_HASHDATA; // MD5 해쉬암호값
$payReqMap['LGD_BUYER'] = $LGD_BUYER; // 요청자 성명
$payReqMap['LGD_BUYERSSN'] = $LGD_BUYERSSN; // 요청자 생년월일 / 사업자번호
$payReqMap['LGD_NAMECHECKYN'] = $LGD_NAMECHECKYN; // 계좌실명확인여부
$payReqMap['LGD_HOLDCHECKYN'] = $LGD_HOLDCHECKYN; // 휴대폰본인확인 SMS발송 여부
$payReqMap['LGD_MOBILE_SUBAUTH_SITECD'] = $LGD_MOBILE_SUBAUTH_SITECD; // 신용평가사에서 부여받은 회원사 고유 코드
$payReqMap['LGD_CUSTOM_SKIN'] = $LGD_CUSTOM_SKIN; // 본인확인창 SKIN
$payReqMap['LGD_TIMESTAMP'] = $LGD_TIMESTAMP; // 타임스탬프
$payReqMap['LGD_CUSTOM_USABLEPAY'] = $LGD_CUSTOM_USABLEPAY; // [반드시 설정]상점정의 이용가능 인증수단으로 한 개의 값만 설정 (예:"ASC007")
$payReqMap['LGD_WINDOW_TYPE'] = $LGD_WINDOW_TYPE; // 호출방식 (수정불가)
$payReqMap['LGD_RETURNURL'] = $LGD_RETURNURL; // 응답수신페이지
$payReqMap['LGD_VERSION'] = "PHP_Non-ActiveX_AuthOnly"; // 사용타입 정보(수정 및 삭제 금지): 이 정보를 근거로 어떤 서비스를 사용하는지 판단할 수 있습니다.
/*Return URL에서 인증 결과 수신 시 셋팅될 파라미터 입니다.*/
$payReqMap['LGD_RESPCODE'] = "";
$payReqMap['LGD_RESPMSG'] = "";
$payReqMap['LGD_AUTHONLYKEY'] = "";
$payReqMap['LGD_PAYTYPE'] = "";
$_SESSION['lgd_certify'] = $payReqMap;
/*
*************************************************
@@ -61,25 +100,54 @@ $LGD_HASHDATA = md5($LGD_MID.$LGD_BUYERSSN.$LGD_TIMESTAMP.$LGD_MERTKEY);
<title>LG유플러스 전자결제 본인확인서비스</title>
<!-- 고객사 사이트가 https인 경우는 아래 http://을 https:// 으로 변경하시면 됩니다. -->
<link rel="stylesheet" href="<?php echo G5_CSS_URL;?>/default.css">
<script language="javascript" src="//xpay.uplus.co.kr/xpay/js/xpay_authonly.js" type="text/javascript" charset="EUC-KR"></script>
<script>
function do_Authonly() {
ret = xpay_authonly_check(document.getElementById("LGD_PAYINFO"), document.getElementById("CST_PLATFORM").value);
if (ret == "00"){ //ActiveX 로딩 성공
if(dpop.getData("LGD_RESPCODE") == "0000"){
document.getElementById("LGD_AUTHONLYKEY").value = dpop.getData("LGD_AUTHONLYKEY");
document.getElementById("LGD_PAYTYPE").value = dpop.getData("LGD_PAYTYPE");
//alert("인증요청을 합니다.");
document.getElementById("LGD_PAYINFO").submit();
} else {
alert(dpop.getData("LGD_RESPMSG"));
}
} else {
alert("LG유플러스 본인확인서비스를 위한 ActiveX 설치 실패\nInternet Explorer 외의 브라우저에서는 사용할 수 없습니다.");
//window.close();
}
}
<script language="javascript" src="<?php echo (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') ? 'https' : 'http'; ?>://xpay.uplus.co.kr/xpay/js/xpay_crossplatform.js" type="text/javascript"></script>
<script type="text/javascript">
/*
* 수정불가.
*/
var LGD_window_type = "<?php echo $LGD_WINDOW_TYPE;?>";
var lgd_form = "LGD_PAYINFO";
/*
* 수정불가.
*/
function launchCrossPlatform(){
<?php if( G5_IS_MOBILE ){ //모바일이면 ?>
lgdwin = open_paymentwindow(document.getElementById(lgd_form), '<?php echo $CST_PLATFORM ?>', LGD_window_type);
<?php } else { //PC 이면 ?>
lgdwin = openAuthonly( document.getElementById(lgd_form), "<?php echo $CST_PLATFORM; ?>", LGD_window_type, null );
<?php } ?>
}
/*
* FORM 명만 수정 가능
*/
function getFormObject() {
return document.getElementById(lgd_form);
}
function payment_return() {
var fDoc = lgdwin.contentWindow || lgdwin.contentDocument;
if (fDoc.document.getElementById('LGD_RESPCODE').value == "0000") {
document.getElementById("LGD_AUTHONLYKEY").value = fDoc.document.getElementById('LGD_AUTHONLYKEY').value;
document.getElementById("LGD_PAYTYPE").value = fDoc.document.getElementById('LGD_PAYTYPE').value;
document.getElementById(lgd_form).target = "_self";
document.getElementById("LGD_PAYINFO").action = "AuthOnlyRes.php";
document.getElementById(lgd_form).submit();
} else {
alert("LGD_RESPCODE (결과코드2) : " + fDoc.document.getElementById('LGD_RESPCODE').value + "\n" + "LGD_RESPMSG (결과메시지): " + fDoc.document.getElementById('LGD_RESPMSG').value);
closeIframe();
window.close();
}//end if
}//end payment_return
</script>
<style>
#uplus_win {}
.up_cmt {text-align:center; font-size:14px;}
@@ -92,22 +160,15 @@ function do_Authonly() {
</style>
</head>
<body>
<form method="post" id="LGD_PAYINFO" action="<?php echo G5_LGXPAY_URL; ?>/AuthOnlyRes.php">
<input type="hidden" name="CST_MID" id="CST_MID" value="<?php echo $CST_MID; ?>" />
<input type="hidden" name="LGD_MID" id="LGD_MID" value="<?php echo $LGD_MID; ?>"/>
<input type="hidden" name="CST_PLATFORM" id="CST_PLATFORM" value="<?php echo $CST_PLATFORM; ?>"/>
<input type="hidden" name="LGD_BUYERSSN" value="<?php echo $LGD_BUYERSSN; ?>"/>
<input type="hidden" name="LGD_BUYER" value="<?php echo $LGD_BUYER; ?>"/>
<input type="hidden" name="LGD_MOBILE_SUBAUTH_SITECD" value="<?php echo $LGD_MOBILE_SUBAUTH_SITECD; ?>"/>
<input type="hidden" name="LGD_TIMESTAMP" value="<?php echo $LGD_TIMESTAMP; ?>"/>
<input type="hidden" name="LGD_HASHDATA" value="<?php echo $LGD_HASHDATA; ?>"/>
<input type="hidden" name="LGD_NAMECHECKYN" value="N">
<input type="hidden" name="LGD_HOLDCHECKYN" value="Y">
<input type="hidden" name="LGD_CUSTOM_SKIN" value="red">
<input type="hidden" name="LGD_CUSTOM_FIRSTPAY" value="ASC007">
<input type="hidden" name="LGD_CUSTOM_USABLEPAY" value="ASC007">
<input type="hidden" name="LGD_PAYTYPE" id="LGD_PAYTYPE"/>
<input type="hidden" name="LGD_AUTHONLYKEY" id="LGD_AUTHONLYKEY"/>
<form method="post" name ="LGD_PAYINFO" id="LGD_PAYINFO" action="<?php echo G5_LGXPAY_URL; ?>/AuthOnlyRes.php">
<input type="hidden" name="LGD_ENCODING" value="UTF-8"/>
<?php
foreach ($payReqMap as $key => $value) {
echo "<input type='hidden' name='$key' id='$key' value='$value'/>".PHP_EOL;
}
?>
</form>
<div id="uplus_win" class="new_win mbskin">
@@ -123,7 +184,7 @@ function do_Authonly() {
</div>
</div>
<script>
setTimeout("do_Authonly();",300);
setTimeout("launchCrossPlatform();", 1);
</script>
</body>
</html>
+40 -8
View File
@@ -66,6 +66,7 @@ include_once(G5_PATH.'/head.sub.php');
*/
if ($xpay->TX()) {
//1)인증결과 화면처리(성공,실패 결과 처리를 하시기 바랍니다.)
/*
echo "인증요청이 완료되었습니다. <br>";
echo "TX Response_code = " . $xpay->Response_Code() . "<br>";
@@ -76,12 +77,9 @@ if ($xpay->TX()) {
echo $name . " = " . $xpay->Response($name, 0) . "<br>";
}
echo "<p>";
echo "</p>";
*/
// 인증내역기록
@insert_cert_history($member['mb_id'], 'lg', 'hp');
if( "0000" == $xpay->Response_Code() ) {
//인증요청 결과 성공 DB처리
//echo "인증요청 결과 성공 DB처리하시기 바랍니다.<br>";
@@ -152,11 +150,23 @@ if ($xpay->TX()) {
set_session("ss_cert_birth", $birth_day);
set_session("ss_cert_sex", $mb_sex);
set_session('ss_cert_dupinfo', $mb_dupinfo);
// 인증내역기록
@insert_cert_history($member['mb_id'], 'lg', 'hp');
} else {
//인증요청 결과 실패 DB처리
//echo "인증요청 결과 실패 DB처리하시기 바랍니다.<br>";
alert_close('인증요청이 실패하였습니다.\\n\\n코드 : '.$xpay->Response_Code().' '.$xpay->Response_Msg());
if( G5_IS_MOBILE ){
echo '<script>'.PHP_EOL;
echo 'window.parent.$("#cert_info").css("display", "");'.PHP_EOL;
echo 'window.parent.$("#lgu_cert" ).css("display", "none");'.PHP_EOL;
echo 'alert("인증요청이 취소 또는 실패하였습니다.\\n\\n코드 : '.$xpay->Response_Code().' '.$xpay->Response_Msg().'")';
echo '</script>'.PHP_EOL;
} else {
alert_close('인증요청이 취소 또는 실패하였습니다.\\n\\n코드 : '.$xpay->Response_Code().' '.$xpay->Response_Msg());
}
exit;
}
} else {
@@ -170,14 +180,31 @@ if ($xpay->TX()) {
echo "인증요청 결과 실패 DB처리하시기 바랍니다.<br>";
*/
alert_close('인증요청이 실패하였습니다.\\n\\n코드 : '.$xpay->Response_Code().' '.$xpay->Response_Msg());
if( G5_IS_MOBILE ){
echo '<script>'.PHP_EOL;
echo 'window.parent.$("#cert_info").css("display", "");'.PHP_EOL;
echo 'window.parent.$("#lgu_cert" ).css("display", "none");'.PHP_EOL;
echo 'alert("인증요청이 실패하였습니다.\\n\\n코드 : '.$xpay->Response_Code().' '.$xpay->Response_Msg().'")';
echo '</script>'.PHP_EOL;
} else {
alert_close('인증요청이 실패하였습니다.\\n\\n코드 : '.$xpay->Response_Code().' '.$xpay->Response_Msg());
}
exit;
}
?>
<script>
$(function() {
jQuery(function($) {
var $opener = window.opener;
var is_mobile = false;
if (typeof g5_is_mobile != "undefined" && g5_is_mobile ) {
$opener = window.parent;
is_mobile = true;
} else {
$opener = window.opener;
}
// 인증정보
$opener.$("input[name=cert_type]").val("<?php echo $cert_type; ?>");
@@ -185,6 +212,11 @@ $(function() {
$opener.$("input[name=mb_hp]").val("<?php echo $phone_no; ?>").attr("readonly", true);
$opener.$("input[name=cert_no]").val("<?php echo $md5_cert_no; ?>");
if(is_mobile) {
$opener.$("#cert_info").css("display", "");
$opener.$("#lgu_cert" ).css("display", "none");
}
alert("본인의 휴대폰번호로 확인 되었습니다.");
window.close();
});
@@ -192,4 +224,4 @@ $(function() {
<?php
include_once(G5_PATH.'/tail.sub.php');
?>
?>
+65
View File
@@ -0,0 +1,65 @@
<?php
include_once('./_common.php');
/*
payreq_crossplatform 에서 세션에 저장했던 파라미터 값이 유효한지 체크
세션 유지 시간(로그인 유지시간)을 적당히 유지 하거나 세션을 사용하지 않는 경우 DB처리 하시기 바랍니다.
*/
if(!isset($_SESSION['lgd_certify'])){
echo '세션이 만료 되었거나 유효하지 않은 요청 입니다.';
return;
}
$payReqMap = $_SESSION['lgd_certify'];//결제 요청시, Session에 저장했던 파라미터 MAP
?>
<html>
<head>
<script type="text/javascript">
function setLGDResult() {
<?php if ( G5_IS_MOBILE ) { // 모바일이면 ?>
var lgd_form = document.getElementById('LGD_RETURNINFO');
lgd_form.action = "AuthOnlyRes.php";
lgd_form.submit();
<?php } else { // PC 이면 ?>
parent.payment_return();
<?php } ?>
try {
} catch (e) {
alert(e.message);
}
}
</script>
</head>
<body onload="setLGDResult()">
<?php
$LGD_RESPCODE = $_POST['LGD_RESPCODE'];
$LGD_RESPMSG = iconv("EUC-KR","UTF-8",$_POST['LGD_RESPMSG']);
$LGD_AUTHONLYKEY = "";
$LGD_PAYTYPE = "";
$payReqMap['LGD_RESPCODE'] = $LGD_RESPCODE;
$payReqMap['LGD_RESPMSG'] = $LGD_RESPMSG;
if($LGD_RESPCODE == "0000"){
$payReqMap['LGD_AUTHONLYKEY'] = isset($_POST['LGD_AUTHONLYKEY']) ? $_POST['LGD_AUTHONLYKEY'] : '';
$payReqMap['LGD_PAYTYPE'] = isset($_POST['LGD_PAYTYPE']) ? $_POST['LGD_PAYTYPE'] : '';
}
else{
echo "LGD_RESPCODE:" + $LGD_RESPCODE + " ,LGD_RESPMSG:" + $LGD_RESPMSG; //인증 실패에 대한 처리 로직 추가
}
?>
<form method="post" name="LGD_RETURNINFO" id="LGD_RETURNINFO">
<?php
foreach ($payReqMap as $key => $value) {
echo "<input type='hidden' name='$key' id='$key' value='$value'>";
}
?>
</form>
</body>
</html>
+4
View File
@@ -15,6 +15,10 @@
* under the License.
*/
if( ! class_exists('PHPUnit_Framework_TestCase') ){
return;
}
class PHPSDKTestCase extends PHPUnit_Framework_TestCase {
const APP_ID = '117743971608120';
const SECRET = '9c8ea2071859659bea1246d33a9207cf';