g5 merge 충돌수정

This commit is contained in:
chicpro
2014-03-20 14:56:39 +09:00
70 changed files with 8342 additions and 14 deletions

16
adm/admin.menu900.php Normal file
View File

@ -0,0 +1,16 @@
<?php
$menu["menu900"] = array (
array('900000', 'SMS 관리', ''.G5_SMS5_ADMIN_URL.'/config.php', 'sms5'),
array('900100', 'SMS 기본설정', ''.G5_SMS5_ADMIN_URL.'/config.php', 'sms5_config'),
array('900200', '회원정보업데이트', ''.G5_SMS5_ADMIN_URL.'/member_update.php', 'sms5_mb_update'),
array('900300', '문자 보내기', ''.G5_SMS5_ADMIN_URL.'/sms_write.php', 'sms_write'),
array('900400', '전송내역-건별', ''.G5_SMS5_ADMIN_URL.'/history_list.php', 'sms_history' , 1),
array('900500', '전송내역-번호별', ''.G5_SMS5_ADMIN_URL.'/history_num.php', 'sms_history_num' , 1),
array('900600', '전송내역-회원', ''.G5_SMS5_ADMIN_URL.'/history_member.php', 'sms_history_mb' , 1),
array('900700', '이모티콘 그룹', ''.G5_SMS5_ADMIN_URL.'/form_group.php' , 'emoticon_group'),
array('900710', '이모티콘 관리', ''.G5_SMS5_ADMIN_URL.'/form_list.php', 'emoticon_list'),
array('900720', '휴대폰번호 그룹', ''.G5_SMS5_ADMIN_URL.'/num_group.php' , 'hp_group', 1),
array('900730', '휴대폰번호 관리', ''.G5_SMS5_ADMIN_URL.'/num_book.php', 'hp_manage', 1),
array('900740', '휴대폰번호 파일', ''.G5_SMS5_ADMIN_URL.'/num_book_file.php' , 'hp_file', 1)
);
?>

View File

@ -46,7 +46,7 @@ h3 {margin:0 20px}
#tnb #tnb_logout a {color:#ff3061}
#tnb span {position:absolute;bottom:10px;left:0;width:100%;text-align:center}
/* gnb js off */
/* gnb */
#gnb {position:relative;z-index:12;min-width:999px;background:#383a3f}
#gnb h2 {margin:0;padding:0;font-size:0;line-height:0;overflow:hidden}
#gnb_1dul {position:relative;margin:0 20px;padding:0;zoom:1}
@ -72,7 +72,7 @@ h3 {margin:0 20px}
#lnb:after {display:block;visibility:hidden;clear:both;content:""}
#lnb li {float:left}
#lnb a {display:inline-block;margin:0 0 0 10px;padding:0 10px 0 0;border-right:1px solid #ccc;font-size:0.95em;letter-spacing:-0.1em}
#lnb a {display:inline-block;padding:0 10px;border-right:1px solid #ccc;font-size:0.95em;letter-spacing:-0.1em}
/* 중간 레이아웃 */
#wrapper {z-index:5;margin:20px 0;min-width:1000px;zoom:1}
@ -133,10 +133,8 @@ h3 {margin:0 20px}
.btn_confirm02 a:focus {background:#555}
.btn_confirm03 {clear:both;margin-top:10px;text-align:right}
.btn_submit {margin:0;padding:0;border:0;background:#ff3061;color:#fff;cursor:pointer}
.btn_submit {background:#ff3061;cursor:pointer}
.btn_confirm .btn_submit {padding:0 15px;border:0;height:30px;color:#fff}
.btn_cancel {display:inline-block;padding:0 15px;height:30px;border:0;background:#617d46;color:#fff;text-decoration:none}
a.btn_cancel {line-height:2.5em;vertical-align:middle}
@ -159,7 +157,7 @@ a.btn_cancel {line-height:2.5em;vertical-align:middle}
.btn_list {margin:0 20px 10px} /* 목록용 */
.btn_list01 {}
.btn_list01 input, .btn_list01 button, .btn_list01 a {display:inline-block;padding:10px;border:1px solid #ccc;background:#fafafa;text-decoration:none;cursor:pointer}
.btn_list01 input, .btn_list01 button, .btn_list01 a {display:inline-block;margin:0;padding:10px;border:1px solid #ccc;background:#fafafa;text-decoration:none;cursor:pointer}
.btn_list01 a:focus {background:#555}
.btn_list02 {}
@ -211,7 +209,7 @@ legend {position:absolute;width:0;height:0;font-size:0;line-height:0;text-indent
/* 하단 레이아웃 */
#ft {margin:20px 0;padding:10px 20px;min-width:960px;border-top:1px solid #d0d6d8}
#ft {clear:both;margin:20px 0;padding:10px 20px;min-width:960px;border-top:1px solid #d0d6d8}
/* 페이지 내 검색 */
@ -229,7 +227,7 @@ legend {position:absolute;width:0;height:0;font-size:0;line-height:0;text-indent
.local_sch02 strong {display:inline-block;width:80px}
.local_sch02 strong.sch_long {width:160px}
.local_sch02 label {display:inline-block;margin:0 5px 0 0}
.local_sch02 button {margin:0;padding:3px 5px;border:1px solid #ced9de;background:#f6f9fa;font-size:0.95em;cursor:pointer}
.local_sch02 button {margin:0;padding:5px;border:1px solid #ced9de;background:#f6f9fa;font-size:0.95em;vertical-align:middle;cursor:pointer}
/* 페이지 내 실행 */
.local_cmd {min-width:960px}
@ -248,7 +246,7 @@ legend {position:absolute;width:0;height:0;font-size:0;line-height:0;text-indent
.local_desc01 a {text-decoration:underline}
.local_desc02 {margin:0 20px 10px;min-width:960px} /* 주로 온라인 서식 관련 안내 내용에 사용 */
.local_desc02 p {padding:0}
.local_desc02 p {padding:0;line-height:1.8em}
/* 페이지 내 카운트 */
.local_ov {min-width:960px}
@ -437,6 +435,9 @@ td.td_grpset {width:160px;border-left:1px solid #e9ecee;text-align:center}
.txt_true {color:#e8180c}
.txt_false {color:#ccc}
.txt_succeed {color:#40b300}
.txt_fail {color:#ce4242}
.banner_or_img {margin:10px 0 0}
.banner_or_img button {display:block;margin:5px 0 0}
@ -774,6 +775,14 @@ strong.sodr_nonpay {display:block;padding:5px 0;text-align:right}
.new_win .tbl_wrap {margin:0 20px 20px;padding:0}
.new_win .win_btn {clear:both;padding:20px;text-align:center} /* 새창용 */
.new_win .win_btn button {display:inline-block;padding:0 10px;height:30px;border:0;background:#4b545e;color:#fff;line-height:2em;cursor:pointer}
.new_win .win_btn input {padding:0 10px;height:30px;line-height:2em}
.new_win .win_btn a {display:inline-block;padding:0 10px;height:30px;background:#4b545e;color:#fff;vertical-align:middle;line-height:2.4em}
.new_win .win_btn a:focus, .new_win .win_btn a:hover {text-decoration:none}
.new_win .local_sch, .new_win .local_cmd, .new_win .local_desc01, .new_win .local_desc02, .new_win .local_ov {min-width:320px}
/* 자바스크립트 alert 대안 */
@ -816,4 +825,4 @@ strong.sodr_nonpay {display:block;padding:5px 0;text-align:right}
#post_code #result ul {margin:0;padding:0;border-bottom:1px solid #dde4e9;background:#f0f5fc;list-style:none}
#post_code #result li {padding:10px;border:1px solid #dde4e9;border-bottom:0}
#post_code #result li div {margin:4px 0 0;color:#738D94}
#post_code #result li div:before {content:"▶ "}
#post_code #result li div:before {content:"▶ "}

View File

@ -13,7 +13,7 @@ check_token();
$mb_id = trim($_POST['mb_id']);
// 휴대폰번호 체크
$mb_hp = $_POST['mb_hp'];
$mb_hp = hyphen_hp_number($_POST['mb_hp']);
if($mb_hp) {
$result = exist_mb_hp($mb_hp, $mb_id);
if ($result)
@ -34,7 +34,7 @@ $sql_common = " mb_name = '{$_POST['mb_name']}',
mb_email = '{$_POST['mb_email']}',
mb_homepage = '{$_POST['mb_homepage']}',
mb_tel = '{$_POST['mb_tel']}',
mb_hp = '{$_POST['mb_hp']}',
mb_hp = '{$mb_hp}',
mb_certify = '{$mb_certify}',
mb_adult = '{$mb_adult}',
mb_zip1 = '{$_POST['mb_zip1']}',

View File

@ -77,7 +77,7 @@ $colspan = 16;
<form id="fsearch" name="fsearch" class="local_sch01 local_sch" method="get">
<label for="sfl" class="sound_only">검색대상</label>
<select name="sfl">
<select name="sfl" id="sfl">
<option value="mb_id"<?php echo get_selected($_GET['sfl'], "mb_id"); ?>>회원아이디</option>
<option value="mb_nick"<?php echo get_selected($_GET['sfl'], "mb_nick"); ?>>닉네임</option>
<option value="mb_name"<?php echo get_selected($_GET['sfl'], "mb_name"); ?>>이름</option>

15
adm/sms_admin/_common.php Normal file
View File

@ -0,0 +1,15 @@
<?php
define('G5_IS_ADMIN', true);
include_once ('../../common.php');
include_once(G5_ADMIN_PATH.'/admin.lib.php');
if (!strstr($_SERVER['PHP_SELF'], 'install.php')) {
if(!mysql_num_rows(mysql_query("show tables like '{$g5['sms5_config_table']}'")))
goto_url('install.php');
// SMS 설정값 배열변수
//$sms5 = sql_fetch("select * from ".$g5['sms5_config_table'] );
}
add_stylesheet('<link rel="stylesheet" href="'.G5_SMS5_ADMIN_URL.'/css/sms5.css">', 0);
?>

View File

@ -0,0 +1,48 @@
<?php
include_once("./_common.php");
@include_once(G5_PLUGIN_PATH."/sms5/JSON.php");
if( !function_exists('json_encode') ) {
function json_encode($data) {
$json = new Services_JSON();
return( $json->encode($data) );
}
}
$err = '';
$arr_ajax_msg = array();
$exist_hplist = array();
if( !$bk_hp )
$err = '휴대폰번호를 입력해 주십시오.';
$bk_hp = get_hp($bk_hp);
$sql = " select count(*) as cnt from {$g5['sms5_book_table']} where bk_hp = '$bk_hp' ";
if($w == 'u' && $bk_no)
$sql .= " and bk_no <> '$bk_no' ";
$row = sql_fetch($sql);
if($row['cnt'])
$err = '같은 번호가 존재합니다.';
// 수정일 때 회원정보에서 중복체크
if(!$row['cnt'] && $w == 'u') {
$sql = " select mb_id from {$g5['member_table']} where mb_hp = '{$bk_hp}' and mb_hp <> '' ";
if( $mb_id )
$sql .= " and mb_id <> '{$mb_id}' ";
$result = sql_query($sql);
while($row = sql_fetch_array($result)){
$exist_hplist[] = $row['mb_id'];
}
}
$arr_ajax_msg['error'] = $err;
$arr_ajax_msg['exist'] = $exist_hplist;
die( json_encode($arr_ajax_msg) );
?>

View File

@ -0,0 +1,82 @@
<?php
include_once("./_common.php");
@include_once(G5_PLUGIN_PATH."/sms5/JSON.php");
if( !function_exists('json_encode') ) {
function json_encode($data) {
$json = new Services_JSON();
return( $json->encode($data) );
}
}
$page_size = 6;
auth_check($auth[$sub_menu], "r");
if (!$page) $page = 1;
if (is_numeric($fg_no))
$sql_group = " and fg_no='$fg_no' ";
else
$sql_group = "";
if ($st == 'all') {
$sql_search = "and (fo_name like '%{$sv}%' or fo_content like '%{$sv}%')";
} else if ($st == 'name') {
$sql_search = "and fo_name like '%{$sv}%'";
} else if ($st == 'content') {
$sql_search = "and fo_content like '%{$sv}%'";
} else {
$sql_search = '';
}
$total_res = sql_fetch("select count(*) as cnt from {$g5['sms5_form_table']} where 1 $sql_group $sql_search");
$total_count = $total_res['cnt'];
$total_page = (int)($total_count/$page_size) + ($total_count%$page_size==0 ? 0 : 1);
$page_start = $page_size * ( $page - 1 );
$vnum = $total_count - (($page-1) * $page_size);
$group = array();
$qry = sql_query("select * from {$g5['sms5_form_group_table']} order by fg_name");
while ($res = sql_fetch_array($qry)) array_push($group, $res);
$res = sql_fetch("select count(*) as cnt from {$g5['sms5_form_table']} where fg_no=0");
$no_count = $res['cnt'];
$count = 1;
$qry = sql_query("select * from {$g5['sms5_form_table']} where 1 $sql_group $sql_search order by fo_no desc limit $page_start, $page_size");
$list_text = "";
if( !$total_count ){
$list_text .="
<li class=\"empty_list\">
데이터가 없습니다.
</li>
";
}
while($res = sql_fetch_array($qry))
{
$tmp = sql_fetch("select fg_name from {$g5['sms5_form_group_table']} where fg_no='{$res['fg_no']}'");
if (!$tmp)
$group_name = '미분류';
else
$group_name = $tmp['fg_name'];
$list_text .="
<li class=\"screen_list sms5_box\">
<span class=\"box_ico\"></span>
<textarea readonly class=\"sms_textarea box_txt box_square\" onclick=\"emoticon_list.go({$res['fo_no']})\">{$res['fo_content']}</textarea>
<textarea id=\"fo_contents_{$res['fo_no']}\" style=\"display:none\">{$res['fo_content']}</textarea>
<strong class=\"emo_tit\">".cut_str($res['fo_name'],20)."</strong>
</li>
";
}
$arr_ajax_msg['error'] = "";
$arr_ajax_msg['list_text'] = $list_text;
$arr_ajax_msg['page'] = $page;
$arr_ajax_msg['total_count'] = $total_count;
$arr_ajax_msg['total_page'] = $total_page;
die( json_encode($arr_ajax_msg) );
?>

View File

@ -0,0 +1,42 @@
<?php
include_once("./_common.php");
$colspan = 3;
auth_check($auth[$sub_menu], "r");
$no_group = sql_fetch("select * from {$g5['sms5_book_group_table']} where bg_no=1");
$group = array();
$qry = sql_query("select * from {$g5['sms5_book_group_table']} where bg_no>1 order by bg_name");
while ($res = sql_fetch_array($qry)) array_push($group, $res);
?>
<div class="tbl_head01 tbl_wrap">
<table>
<thead>
<tr>
<th scope="col">그룹명</th>
<th scope="col">수신가능</th>
<th scope="col">추가</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="javascript:sms_obj.person(1)"><?php echo $no_group['bg_name']?></a></td>
<td class="td_num"><?php echo number_format($no_group['bg_receipt'])?></td>
<td class="td_mngsmall"><button type="button" class="btn_frmline" onclick="sms_obj.group_add(1, '<?php echo $no_group['bg_name']?>', '<?php echo number_format($no_group['bg_receipt'])?>')">추가</button></td>
</tr>
<?php
$line = 1;
for ($i=0; $i<count($group); $i++) {
$bg = 'bg'.($line++%2);
?>
<tr class="<?php echo $bg; ?>">
<td><a href="javascript:sms_obj.person(<?php echo $group[$i]['bg_no']?>)"><?php echo $group[$i]['bg_name']?></a></td>
<td class="td_num"><?php echo number_format($group[$i]['bg_receipt'])?></td>
<td class="td_mngsmall"><button type="button" class="btn_frmline" onclick="sms_obj.group_add(<?php echo $group[$i]['bg_no']?>, '<?php echo $group[$i]['bg_name']?>', '<?php echo number_format($group[$i]['bg_receipt'])?>')">추가</button></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>

View File

@ -0,0 +1,56 @@
<?php
include_once("./_common.php");
@include_once(G5_PLUGIN_PATH."/sms5/JSON.php");
if( !function_exists('json_encode') ) {
function json_encode($data) {
$json = new Services_JSON();
return( $json->encode($data) );
}
}
auth_check($auth[$sub_menu], "r");
$lev = array();
for ($i=1; $i<=10; $i++)
{
$lev[$i] = 0;
}
$qry = sql_query("select mb_level, count(*) as cnt from {$g5['member_table']} where mb_sms=1 and not (mb_hp='') group by mb_level");
while ($row = sql_fetch_array($qry))
{
$lev[$row['mb_level']] = $row['cnt'];
}
$str_json = array();
$tmp_str = '';
$tmp_str .= '
<div class="tbl_head01 tbl_wrap">
<table>
<thead>
<tr>
<th scope="col">권한</th>
<th scope="col">수신가능</th>
<th scope="col">추가</th>
</tr>
</thead>
<tbody>';
for ($i=1; $i<=10; $i++) {
$bg = 'bg'.($line++%2);
$tmp_str .= '
<tr class="'.$bg.'">
<td>'.$i.' 레벨</td>
<td class="td_numbig">'.number_format($lev[$i]).'</td>
<td class="td_mng"><button type="button" class="btn_frmline" onclick="sms_obj.level_add('.$i.', \''.number_format($lev[$i]).'\')">추가</button></td>
</tr>';
}
$tmp_str .= '
</tbody>
</table>
</div>';
$str_json['html'] = $tmp_str;
echo json_encode($str_json);
?>

View File

@ -0,0 +1,165 @@
<?php
include_once("./_common.php");
$page_size = 10;
$colspan = 5;
auth_check($auth[$sub_menu], "r");
$g5['title'] = "휴대폰번호 관리";
if (!$page) $page = 1;
if (is_numeric($bg_no))
$sql_group = " and bg_no='$bg_no' ";
else
$sql_group = "";
if ($st == 'all') {
$sql_search = "and (bk_name like '%{$sv}%' or bk_hp like '%{$sv}%')";
} else if ($st == 'name') {
$sql_search = "and bk_name like '%{$sv}%'";
} else if ($st == 'hp') {
$sql_search = "and bk_hp like '%{$sv}%'";
} else {
$sql_search = '';
}
if ($ap > 0)
$sql_korean = korean_index('bk_name', $ap-1);
else {
$sql_korean = '';
$ap = 0;
}
if ($no_hp == 'yes') {
set_cookie('cookie_no_hp', 'yes', 60*60*24*365);
$no_hp_checked = 'checked';
} else if ($no_hp == 'no') {
set_cookie('cookie_no_hp', '', 0);
$no_hp_checked = '';
} else {
if (get_cookie('cookie_no_hp') == 'yes')
$no_hp_checked = 'checked';
else
$no_hp_checked = '';
}
//if ($no_hp_checked == 'checked')
$sql_no_hp = "and bk_hp <> '' and bk_receipt=1";
$total_res = sql_fetch("select count(*) as cnt from {$g5['sms5_book_table']} where 1 $sql_group $sql_search $sql_korean $sql_no_hp");
$total_count = $total_res['cnt'];
$total_page = (int)($total_count/$page_size) + ($total_count%$page_size==0 ? 0 : 1);
$page_start = $page_size * ( $page - 1 );
$vnum = $total_count - (($page-1) * $page_size);
$res = sql_fetch("select count(*) as cnt from {$g5['sms5_book_table']} where bk_receipt=1 $sql_group $sql_search $sql_korean $sql_no_hp");
$receipt_count = $res['cnt'];
$reject_count = $total_count - $receipt_count;
$res = sql_fetch("select count(*) as cnt from {$g5['sms5_book_table']} where mb_id='' $sql_group $sql_search $sql_korean $sql_no_hp");
$no_member_count = $res['cnt'];
$member_count = $total_count - $no_member_count;
$no_group = sql_fetch("select * from {$g5['sms5_book_group_table']} where bg_no=1");
$group = array();
$qry = sql_query("select * from {$g5['sms5_book_group_table']} where bg_no>1 order by bg_name");
while ($res = sql_fetch_array($qry)) array_push($group, $res);
?>
<div class="tbl_head01 tbl_wrap">
<table>
<thead>
<tr>
<th scope="col">
<label for="all_checked" class="sound_only">회원 전체</label>
<input type="checkbox" id="all_checked" onclick="sms_obj.book_all_checked(this.checked)">
</th>
<th scope="col">이름</th>
<th scope="col">휴대폰번호</th>
<th scope="col">등급</th>
<th scope="col">추가</th>
</tr>
</thead>
<tbody>
<?php if (!$total_count) { ?>
<tr>
<td colspan="<?php echo $colspan?>" class="td_mbstat">데이터가 없습니다.</td>
</tr>
<?php
}
$line = 0;
$qry = sql_query("select * from {$g5['sms5_book_table']} where 1 $sql_group $sql_search $sql_korean $sql_no_hp order by bk_no desc limit $page_start, $page_size");
while($res = sql_fetch_array($qry))
{
$bg = 'bg'.($line++%2);
$tmp = sql_fetch("select bg_name from {$g5['sms5_book_group_table']} where bg_no='{$res['bg_no']}'");
if (!$tmp)
$group_name = '미분류';
else
$group_name = $tmp['bg_name'];
?>
<tr class="<?php echo $bg; ?>">
<td class="td_chk">
<label for="bk_no_<?php echo $res['bk_no']; ?>" class="sound_only"><?php echo $res['bk_name']?></label>
<input type="checkbox" name="bk_no" value="<?php echo $res['bk_no']?>" id="bk_no_<?php echo $res['bk_no']; ?>">
</td>
<!-- <td class="td_name"><?php echo $group_name?></td> -->
<td class="td_mbname"><?php echo $res['bk_name']?></td>
<td><?php echo $res['bk_hp']?></td>
<!-- <td class="td_boolean"><?php echo $res['bk_receipt'] ? '수신' : '거부'?></td> -->
<!-- <td class="td_boolean"><?php echo $res['bk_receipt'] ? '예' : ''?></td> -->
<td class="td_boolean"><?php echo $res['mb_id'] ? '회원' : '비회원'?></td>
<td class="td_mngsmall"><button type="button" class="btn_frmline" onclick="sms_obj.person_add(<?php echo $res['bk_no']?>, '<?php echo $res['bk_name']?>', '<?php echo $res['bk_hp']?>')">추가</button></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="btn_list01 btn_list">
<button type="button" onclick="sms_obj.person_multi_add()">선택추가</button>
<button type="button" onclick="sms_obj.triggerclick('#book_group')" >그룹목록</button>
</div>
<nav class="pg_wrap">
<span class="pg" id="person_pg"></span>
</nav>
<form name="search_form" id="sms_person_form" method="get" action="<?php echo $_SERVER['PHP_SELF']?>">
<input type="hidden" name="total_pg" value="<?php echo $total_page?>">
<input type="hidden" name="page" value="<?php echo $page?>">
<input type="hidden" name="bg_no" value="<?php echo $bg_no?>">
<label for="bg_no" class="sound_only">그룹</label>
<select name="bg_no" id="bg_no">
<option value="" <?php echo $bg_no?'':'selected'?>> 전체 </option>
<option value="1" <?php echo $bg_no=='1'?'selected':''?>> <?php echo $no_group['bg_name']?> (<?php echo number_format($no_group['bg_receipt'])?> 명) </option>
<?php for($i=0; $i<count($group); $i++) {?>
<option value="<?php echo $group[$i]['bg_no']?>" <?php echo ($bg_no==$group[$i]['bg_no'])?'selected':''?>> <?php echo $group[$i]['bg_name']?> (<?php echo number_format($group[$i]['bg_receipt'])?> 명) </option>
<?php } ?>
</select>
<label for="stt" class="sound_only">검색대상</label>
<select name="st" id="stt">
<option value="all" <?php echo $st=='all'?'selected':''?>>이름 + 번호</option>
<option value="name" <?php echo $st=='name'?'selected':''?>>이름</option>
<option value="hp" <?php echo $st=='hp'?'selected':''?>>번호</option>
</select>
<label for="svv" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" size="15" name="sv" id="svv" class="frm_input" value="<?php echo $sv?>">
<input type="submit" value="검색" class="btn_submit">
</form>
<!--
총 건수 : <?php echo number_format($total_count)?> /
회원 : <?php echo number_format($member_count)?> /
비회원 : <?php echo number_format($no_member_count)?> /
수신 : <?php echo number_format($receipt_count)?> /
거부 : <?php echo number_format($reject_count)?>
-->

181
adm/sms_admin/config.php Normal file
View File

@ -0,0 +1,181 @@
<?php
$sub_menu = "900100";
include_once("./_common.php");
auth_check($auth[$sub_menu], "r");
$g5['title'] = "SMS 기본설정";
if (!$config['cf_icode_server_ip']) $config['cf_icode_server_ip'] = '211.172.232.124';
if (!$config['cf_icode_server_port']) $config['cf_icode_server_port'] = '7295';
if ($config['cf_icode_id'] && $config['cf_icode_pw'])
{
$res = get_sock("http://www.icodekorea.com/res/userinfo.php?userid=".$config['cf_icode_id']."&userpw=".$config['cf_icode_pw']);
$res = explode(';', $res);
$userinfo = array(
'code' => $res[0], // 결과코드
'coin' => $res[1], // 고객 잔액 (충전제만 해당)
'gpay' => $res[2], // 고객의 건수 별 차감액 표시 (충전제만 해당)
'payment' => $res[3] // 요금제 표시, A:충전제, C:정액제
);
}
if (!$config['cf_icode_id'])
$config['cf_icode_id'] = 'sir_';
if (!$sms5['cf_skin'])
$sms5['cf_skin'] = 'basic';
include_once(G5_ADMIN_PATH.'/admin.head.php');
?>
<?php if (!$config['cf_icode_pw']) { ?>
<div class="local_desc01 local_desc">
<p>
SMS 기능을 사용하시려면 먼저 아이코드에 서비스 신청을 하셔야 합니다.<br>
<a href="http://icodekorea.com/res/join_company_fix_a.php?sellid=sir2" target="_blank">아이코드 서비스 신청하기</a>
</p>
</div>
<?php } ?>
<?php
if ($config['cf_sms_use'] == 'icode') { // 아이코드 사용
?>
<form name="fconfig" method="post" action="./config_update.php" enctype="multipart/form-data" >
<input type="hidden" name="cf_icode_server_ip" value="<?php echo $config['cf_icode_server_ip']?>">
<input type="hidden" name="cf_sms_use" value="<?php echo $config['cf_sms_use']?>">
<div class="tbl_frm01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?></caption>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="cf_icode_id">아이코드 회원아이디<strong class="sound_only"> 필수</strong></label></th>
<td>
<?php echo help("아이코드에서 사용하시는 회원아이디를 입력합니다."); ?>
<input type="text" name="cf_icode_id" value="<?php echo $config['cf_icode_id']; ?>" id="cf_icode_id" required class="frm_input required">
</td>
</tr>
<tr>
<th scope="row"><label for="cf_icode_pw">아이코드 비밀번호<strong class="sound_only"> 필수</strong></label></th>
<td>
<?php echo help("아이코드에서 사용하시는 비밀번호를 입력합니다."); ?>
<input type="password" name="cf_icode_pw" value="<?php echo $config['cf_icode_pw']; ?>" id="cf_icode_pw" required class="frm_input required">
<?php if (!$config['cf_icode_pw']) { ?>현재 비밀번호가 입력되어 있지 않습니다.<?php } ?>
</td>
</tr>
<tr>
<th scope="row">요금제</th>
<td>
<?php
if ($userinfo['payment'] == 'A') {
echo '충전제';
echo '<input type="hidden" name="cf_icode_server_port" value="7295">';
} else if ($userinfo['payment'] == 'C') {
echo '정액제';
echo '<input type="hidden" name="cf_icode_server_port" value="7296">';
} else {
echo '가입해주세요.';
echo '<input type="hidden" name="cf_icode_server_port" value="7295">';
}
?>
</td>
</tr>
<?php if ($userinfo['payment'] == 'A') { ?>
<tr>
<th scope="row">충전 잔액</th>
<td>
<?php echo number_format($userinfo['coin'])?> 원
<input type="button" value="충전하기" class="btn_frmline" onclick="window.open('http://icodekorea.com/company/credit_card_input.php?icode_id=<?php echo $config['cf_icode_id']?>&icode_passwd=<?php echo $config['cf_icode_pw']?>','icode_payment','width=650,height=500')">
</td>
</tr>
<tr>
<th scope="row">건별 금액</th>
<td><?php echo number_format($userinfo['gpay'])?> 원</td>
</tr>
<?php } ?>
<tr>
<th scope="row"><label for="cf_phone">회신번호<strong class="sound_only"> 필수</strong></label></th>
<td>
<?php echo help("회신받을 휴대폰 번호를 입력하세요. '-' 를 꼭 입력하세요.<br>예) 010-123-4567"); ?>
<input type="text" name="cf_phone" value="<?php echo $sms5['cf_phone']; ?>" id="cf_phone" required class="frm_input required" size="12">
</td>
</tr>
<!--
<tr>
<th scope="row"><label for="cf_register">프로그램 등록번호</label></th>
<td>
<?php echo help("정식구입자께만 발급해 드리고 있습니다.\n등록번호가 틀린 경우 문자메시지를 보내실 수 없습니다.\n등록번호는 서버 IP, MYSQL USER, DB 를 알려주셔야 발급이 가능합니다."); ?>
<input type="text" name="cf_register" value="<?php echo $sms5['cf_register']; ?>" id="cf_register" required class="frm_input required">
</td>
</tr>
-->
<tr>
<th scope="row"><label for="cf_member">회원간 문자전송</label></th>
<td>
<?php echo help("허용에 체크하면 회원끼리 문자전송이 가능합니다.");?>
<input type="checkbox" name="cf_member" id="cf_member" <?php if ($sms5['cf_member']) echo 'checked'?>> 허용
</td>
</tr>
<tr>
<th scope="row"><label for="cf_level">문자전송가능 레벨</label></th>
<td>
<?php echo help("문자전송을 허용할 회원레벨을 선택해주세요.");?>
<select name="cf_level" id="cf_level">
<?php for ($i=1; $i<=10; $i++) { ?>
<option value='<?php echo $i?>' <?php if ($sms5['cf_level'] == $i) echo 'selected';?> > <?php echo $i?> </option>
<?php } ?>
</select>
레벨 이상
</td>
</tr>
<tr>
<th scope="row"><label for="cf_point">문자전송 차감 포인트<strong class="sound_only"> 필수</strong></label></th>
<td>
<?php echo help("회원이 문자를 전송할시에 차감할 포인트를 입력해주세요. 0이면 포인트를 차감하지 않습니다.");?>
<input type="text" name="cf_point" value="<?php echo $sms5['cf_point']; ?>" id="cf_point" required class="frm_input required" size="5">
</td>
</tr>
<tr>
<th scope="row"><label for="cf_day_count">문자전송 하루제한 갯수<strong class="sound_only"> 필수</strong></label></th>
<td>
<?php echo help("회원이 하루에 보낼수 있는 문자 갯수를 입력해주세요. 0이면 제한하지 않습니다.");?>
<input type="text" name="cf_day_count" value="<?php echo $sms5['cf_day_count']; ?>" id="cf_day_count" required class="frm_input required" size="5">
</td>
</tr>
<tr>
<th scope="row"><label for="cf_skin">스킨 디렉토리<strong class="sound_only">필수</strong></label></th>
<td>
<?php echo get_sms5_skin_select('skin', 'cf_skin', 'cf_skin', $sms5['cf_skin'], 'required'); ?>
</td>
</tr>
</tbody>
</table>
</div>
<div class="btn_confirm01 btn_confirm">
<input type="submit" value="확인" class="btn_submit" accesskey="s">
</div>
</form>
<?php } else { ?>
<section>
<h2 class="h2_frm">SMS 문자전송 서비스를 사용할 수 없습니다.</h2>
<div class="local_desc01 local_desc">
<p>
SMS 를 사용하지 않고 있기 때문에, 문자 전송을 할 수 없습니다.<br>
SMS 사용 설정은 <a href="../config_form.php#anc_cf_sms" class="btn_frmline">환경설정 &gt; 기본환경설정 &gt; SMS설정</a> 에서 SMS 사용을 아이코드로 변경해 주셔야 사용하실수 있습니다.
</p>
</div>
</section>
<?php } ?>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,49 @@
<?php
$sub_menu = "900100";
include_once("./_common.php");
auth_check($auth[$sub_menu], "w");
check_demo();
$g5['title'] = "SMS 기본설정";
$res = get_sock("http://www.icodekorea.com/res/userinfo.php?userid=$cf_icode_id&userpw=$cf_icode_pw");
$res = explode(';', $res);
$userinfo = array(
'code' => $res[0], // 결과코드
'coin' => $res[1], // 고객 잔액 (충전제만 해당)
'gpay' => $res[2], // 고객의 건수 별 차감액 표시 (충전제만 해당)
'payment' => $res[3] // 요금제 표시, A:충전제, C:정액제
);
if ($userinfo['code'] == '202')
alert('아이코드 아이디와 패스워드가 맞지 않습니다.');
if ($cf_member == 'on')
$cf_member = 1;
else
$cf_member = 0;
$res = sql_fetch("select * from ".$g5['sms5_config_table']." limit 1");
if (!$res)
$sql = "insert into ";
else
$sql = "update ";
$sql .= $g5['sms5_config_table']." set cf_phone='$cf_phone', cf_register='$cf_register', cf_member='$cf_member', cf_level='$cf_level', cf_point='$cf_point', cf_day_count='$cf_day_count', cf_skin = '$cf_skin' ";
sql_query($sql);
// 아이코드 설정
$sql = " update {$g5['config_table']}
set cf_sms_use = '$cf_sms_use',
cf_icode_id = '$cf_icode_id',
cf_icode_pw = '$cf_icode_pw',
cf_icode_server_ip = '$cf_icode_server_ip',
cf_icode_server_port = '$cf_icode_server_port' ";
sql_query($sql);
goto_url("./config.php");
?>

133
adm/sms_admin/css/sms5.css Normal file
View File

@ -0,0 +1,133 @@
@charset "utf-8";
/* SIR 지운아빠 */
/* 공통 */
.sms5_txt_success {color:blue}
.sms5_txt_fail {color:red}
/* 회원정보업데이트 */
#sms5_mbup dl {zoom:1}
#sms5_mbup dl:after {display:block;visibility:hidden;clear:both;content:''}
#sms5_mbup dt {clear:both;float:left;margin:0 0 5px;width:100px}
#sms5_mbup dd {float:left;margin:0 0 5px}
#sms5_mbup p {clear:both}
/* SMS BOX */
.sms5_box {position:relative;padding:10px;border-radius:5px;background:#fbec99}
.sms5_box .box_ico {position:absolute;top:20px;left:-7px;width:7px;height:13px;background:url('../img/box_ico.gif') no-repeat}
.sms5_box .box_txt {border:0;background:transparent;word-break:break-all;resize:none;overflow:hidden}
.sms5_box .box_square {width:100px;height:90px}
#write_wrap {z-index:9}
#wr_message_lbl {position:absolute;top:50px;left:50px;color:#999;font-size:0.95em;letter-spacing:-0.1em}
.write_scemo_btn {position:absolute;right:10px !important;right:50px;margin:0;padding:0;width:28px;height:28px;border:0;background:transparent;color:#999;font-size:0.95em}
#write_sc_btn {top:15px}
#write_emo_btn {top:50px}
.write_scemo {display:none;z-index:10;position:absolute;left:150px;border:1px solid #e9e9e9;background:#f7f7f7}
.scemo_ico {position:absolute;top:10px;left:-7px;width:7px;height:13px;background:url('../img/scemo_ico.gif') no-repeat}
.write_scemo .scemo_list {z-index:11;margin:0;padding:0;width:190px;height:150px;background:#fff;overflow-y:scroll}
.write_scemo .scemo_add {margin:0;padding:0;height:25px;border:0;background:transparent}
#write_sc {top:10px}
#write_sc .scemo_add {width:25px}
#write_emo {top:45px}
#write_emo .scemo_add {width:50px}
#write_emo .emo_long {width:80px}
.write_scemo .scemo_cls {text-align:right}
.write_scemo .scemo_cls button {margin:5px;padding:0;border:0;background:transparent;color:#666;font-size:0.95em}
/* 문자보내기 */
#sms5_send {position:relative;margin:-10px 0 0 20px;padding:0 0 0 490px;height:600px}
#sms5_send h2 {font-size:1em}
#sms5_send ul {margin:0;padding:0;list-style:none;zoom:1}
#sms5_send ul:after {display:block;visibility:hidden;clear:both;content:''}
#sms5_send #send_emo {position:absolute;top:0;left:0;padding:20px 0 0;width:280px}
#sms5_send #send_emo h2 {padding:0 0 10px}
#sms5_send #send_write {position:absolute;top:0;left:290px;padding:20px 20px 0 !important;padding:20px 0 0 20px;width:160px;height:600px;border-left:1px solid #efefef}
#sms5_send #send_write h2 {padding:0 0 10px}
#sms5_send #send_book {position:relative;margin:0 0 0 -1px;padding:20px 0 0;width:100%;height:600px;border-left:1px solid #efefef}
#sms5_send #send_book h2 {padding-bottom:10px}
#sms5_send .tmp_loading {display:block;padding:180px 0 0;text-align:center}
#sms5_send #send_emo #emo_sel {position:absolute;top:20px;right:10px;margin:0}
#sms5_send #send_emo li {float:left;margin:0 10px 10px 0 !important;margin:0 5px 10px 0;width:110px}
#sms5_send #send_emo .sms5_box {background:#f7f7f7}
#sms5_send #send_emo .box_ico {display:none}
#sms5_send #send_emo .box_txt {cursor:pointer}
#sms5_send #send_emo .emo_tit {display:block;height:20px;line-height:2em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#sms5_send #send_emo .btn_submit {padding:0 5px;height:24px;border:1px solid #ccc;background:#fafafa;color:#000;font-size:0.95em;vertical-align:middle;cursor:pointer}
#sms5_send #send_write {z-index:3}
#sms5_send .write_inner {position:relative;left:-20px;padding:15px 20px;width:160px;border-top:1px solid #efefef}
#sms5_send .write_inner h2 {margin:0;padding:0 0 10px !important}
#sms5_send .write_floater {position:absolute;top:15px;right:20px;text-align:right}
#sms5_send .write_floater_btn {margin:0;padding:0;border:0;background:transparent;color:#999;font-size:0.95em;letter-spacing:-0.1em}
#sms5_send .write_inner label, #sms5_send .write_inner input {margin:0 0 3px}
#sms5_send .write_inner label {display:inline-block}
#sms5_send #send_write .sms5_box {margin:0 0 5px}
#sms5_send #sms_byte {position:absolute;top:-37px;right:0;color:#999}
#sms5_send #write_preset {margin:10px 0;color:#999;font-size:0.95em;letter-spacing:-0.1em}
#sms5_send #write_reply {margin:0 0 15px}
#sms5_send #hp_list {width:100%;margin:0 0 5px}
#sms5_send #recv_add {position:relative}
#sms5_send #recv_add button {position:absolute;top:0;right:0 !important;right:20px;margin:0;padding:0;width:45px;height:51px;border:1px solid #ccc;background:#fafafa}
#sms5_send #write_rsv {line-height:1.8em}
#sms5_send #send_book {z-index:2}
#sms5_send #num_book {margin:0 0 10px;width:auto !important;width:95%;height:500px;overflow-y:auto !important;overflow-y:scroll}
#sms5_send #book_tab {margin:0 35px 10px;text-align:right}
#sms5_send #book_tab a {display:inline-block;width:30px;text-align:center}
#sms5_send #sms_person_form {margin:0 20px}
#sms5_send #send_book .btn_submit {padding:0 5px;height:24px}
#sms5_send #book_desc {margin:0 20px;color:#999;font-size:0.95em;letter-spacing:-0.1em}
/* 문자전송상세내역 */
#sms5_sent {}
#sms5_sent #sent_overlap {margin:0 20px 20px;padding:0;border-top:1px solid #e9e9e9;list-style:none}
#sms5_sent #sent_overlap li {padding:10px 0;border-bottom:1px solid #e9e9e9}
#sms5_sent #con_sms {margin:0 20px 20px}
/* 이모티콘 관리 */
.sms_preset_sch form {display:inline-block}
#sms5_preset_sel {float:left;padding:8px 20px 0}
.btn_add {float:right}
#sms5_preset {clear:both;margin:0 0 10px;padding:30px 20px 20px 40px;background:#363a3d;list-style:none;zoom:1}
#sms5_preset:after {display:block;visibility:hidden;clear:both;content:''}
#sms5_preset li {float:left;margin:0 20px 20px 0;width:270px;height:125px;background:#fbec99;zoom:1}
#sms5_preset li:after {display:block;visibility:hidden;clear:both;content:''}
#sms5_preset .li_chk {position:absolute;bottom:10px;left:10px;}
#sms5_preset .li_preview {float:left;width:110px}
#sms5_preset .box_square {padding-right:7px;border-right:1px solid #e2d693}
#sms5_preset .li_info {float:left;margin:0 0 0 10px;width:150px;line-height:1.5em}
#sms5_preset .li_date {position:absolute;bottom:10px;left:30px;color:#86857d}
#sms5_preset .li_cmd {position:absolute;bottom:10px;right:10px}
#sms5_preset .li_cmd a {color:#86857d;font-size:0.95em;letter-spacing:-0.1em}
#sms5_emo_add {position:relative}
#sms5_emo_add .sms5_box {padding:10px !important;padding:10px 5px;width:160px}
#sms5_emo_add .box_txt {margin:0 0 5px}
#sms5_emo_add .write_scemo_btn {right:10px}
#sms5_emo_add .write_scemo {left:170px}
/* 휴대폰번호 관리 */
#hp_check_el {width:148px}
#hp_check_el ul {margin:5px 0 0;padding:0;border:1px solid #f7c3cf;background:#f8e8eb;list-style:none}
#hp_check_el li {position:relative;padding:5px;border-bottom:1px solid #f6dae1}
#hp_check_el strong {position:absolute;top:6px;right:5px;color:#ff3061;font-size:0.95em;font-weight:normal;letter-spacing:-0.1em}
/* 휴대폰번호 파일 */
#sms5_fileup_frm {margin:0 0 10px;padding:0 20px 5px;border-bottom:1px solid #e9e9e9}
#sms5_fileup_frm div {padding:0 0 5px;margin:0 0 5px;border-bottom:1px solid #f4f4f4}
#sms5_fileup_frm div.sch_last {margin:0;border:0}
#sms5_fileup_frm strong {display:inline-block;width:80px}
#sms5_fileup_frm strong.sch_long {width:160px}
#sms5_fileup_frm label {display:inline-block;margin:0 5px 0 0}
#sms5_fileup_frm .btn_submit {padding:0 5px;height:24px}
#sms5_fileup_frm #sms5_fileup {border:0}
#sms5_fileup_frm #upload_info {margin:20px 0}
#sms5_fileup_frm #upload_result {margin:0;padding:10px 0;border-top:3px solid #383838;border-bottom:3px solid #383838;list-style:none}
#sms5_fileup_frm #upload_result li {margin:0 0 5px}
#sms5_fileup_frm #upload_result .local_desc01 {margin:5px 0;padding:10px}
#sms5_fileup_frm #btn_fileup {margin:5px 0 0}
#sms5_fileup_frm .sms_fileup_hide {display:none;border:0}

View File

@ -0,0 +1,114 @@
<?php
$sub_menu = "900600";
include_once('./_common.php');
if ($sw != 'move'){
alert('sw 값이 제대로 넘어오지 않았습니다.');
}
auth_check($auth[$sub_menu], "r");
$g5['title'] = '이모티콘그룹 이동';
include_once(G5_PATH.'/head.sub.php');
$fo_no_list = implode(',', $_POST['fo_no']);
$sql = " select * from {$g5['sms5_form_group_table']} order by fg_no ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$list[$i] = $row;
}
?>
<div id="copymove" class="new_win">
<h1 id="win_title"><?php echo $g5['title'] ?></h1>
<form name="fboardmoveall" method="post" action="./emoticon_move_update.php" onsubmit="return fboardmoveall_submit(this);">
<input type="hidden" name="sw" value="<?php echo $sw ?>">
<input type="hidden" name="fo_no_list" value="<?php echo $fo_no_list ?>">
<input type="hidden" name="url" value="<?php echo $_SERVER['HTTP_REFERER'] ?>">
<div class="tbl_head01 tbl_wrap">
<table>
<caption>이동할 그룹을 한개 이상 선택하여 주십시오.</caption>
<thead>
<tr>
<th scope="col">선택</th>
<th scope="col">그룹</th>
</tr>
</thead>
<tbody>
<?php for ($i=0; $i<count($list); $i++) { ?>
<tr>
<td class="td_chk">
<input type="radio" value="<?php echo $list[$i]['fg_no'] ?>" id="chk<?php echo $i ?>" name="chk_fg_no[]">
</td>
<td>
<label for="chk<?php echo $i ?>"><?php echo $list[$i]['fg_name'] ?></label>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="win_btn">
<input type="submit" value="이동" id="btn_submit" class="btn_submit">
<button type="button" class="btn_cancel">창닫기</button>
</div>
</form>
</div>
<script>
(function($) {
$(".win_btn button").click(function(e) {
window.close();
return false;
});
})(jQuery);
function all_checked(sw) {
var f = document.fboardmoveall;
for (var i=0; i<f.length; i++) {
if (f.elements[i].name == "chk_fg_no[]")
f.elements[i].checked = sw;
}
}
function fboardmoveall_submit(f)
{
var check = false;
if (typeof(f.elements['chk_fg_no[]']) == 'undefined')
;
else {
if (typeof(f.elements['chk_fg_no[]'].length) == 'undefined') {
if (f.elements['chk_fg_no[]'].checked)
check = true;
} else {
for (i=0; i<f.elements['chk_fg_no[]'].length; i++) {
if (f.elements['chk_fg_no[]'][i].checked) {
check = true;
break;
}
}
}
}
if (!check) {
alert('이모티콘을 '+f.act.value+'할 그룹을 한개 이상 선택해 주십시오.');
return false;
}
document.getElementById('btn_submit').disabled = true;
return true;
}
</script>
<?php
include_once(G5_PATH.'/tail.sub.php');
?>

View File

@ -0,0 +1,60 @@
<?php
include_once('./_common.php');
auth_check($auth[$sub_menu], "r");
if(!count($_POST['chk_fg_no']))
alert('이모티콘을 이동할 그룹을 한개 이상 선택해 주십시오.', $url);
$sql = "select * from {$g5['sms5_form_table']} where fo_no in ($fo_no_list) order by fo_no desc ";
$result = sql_query($sql);
$save = array();
for ($kk=0;$row = sql_fetch_array($result);$kk++)
{
$fo_no = $row['fo_no'];
for ($i=0; $i<count($_POST['chk_fg_no']); $i++)
{
$fg_no = $_POST['chk_fg_no'][$i];
if( !$fg_no ) continue;
$group = sql_fetch("select * from {$g5['sms5_form_group_table']} where fg_no = '$fg_no'");
$sql = " insert into {$g5['sms5_form_table']}
set fg_no='$fg_no',
fg_member='".$group['fg_member']."',
fo_name='".addslashes($row['fo_name'])."',
fo_content='".addslashes($row['fo_content'])."',
fo_datetime='".G5_TIME_YMDHIS."' ";
sql_query($sql);
sql_query("update {$g5['sms5_form_group_table']} set fg_count = fg_count + 1 where fg_no='$fg_no'");
}
$save[$kk]['fo_no'] = $row['fo_no'];
$save[$kk]['fg_no'] = $row['fg_no'];
}
if ($sw == 'move')
{
foreach ($save as $v)
{
if( empty($v['fo_no']) ) continue;
sql_query(" delete from {$g5['sms5_form_table']} where fo_no = '{$v['fo_no']}' ");
sql_query("update {$g5['sms5_form_group_table']} set fg_count = fg_count - 1 where fg_no='{$v['fg_no']}'");
}
}
$msg = '해당 이모티콘을 선택한 그룹으로 이동 하였습니다.';
$opener_href = './form_list.php?page='.$page;
echo <<<HEREDOC
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script>
alert("$msg");
opener.document.location.href = "$opener_href";
window.close();
</script>
<noscript>
<p>
"$msg"
</p>
<a href="$opener_href">돌아가기</a>
</noscript>
HEREDOC;
?>

View File

@ -0,0 +1,177 @@
<?php
$sub_menu = "900500";
include_once("./_common.php");
$colspan = 5;
auth_check($auth[$sub_menu], "r");
$g5['title'] = "이모티콘 그룹";
$res = sql_fetch("select count(*) as cnt from {$g5['sms5_form_group_table']}");
$total_count = $res['cnt'];
$group = array();
$qry = sql_query("select * from {$g5['sms5_form_group_table']} order by fg_name");
while ($res = sql_fetch_array($qry)) array_push($group, $res);
include_once(G5_ADMIN_PATH.'/admin.head.php');
?>
<script>
function move(fg_no, fg_name, sel) {
var msg = '';
if (sel.value)
{
msg = "'" + fg_name + "' 그룹에 속한 모든 데이터를\n\n'";
msg += sel.options[sel.selectedIndex].text + "' 그룹으로 이동하시겠습니까?";
if (confirm(msg))
location.href = 'form_group_move.php?fg_no=' + fg_no + '&move_no=' + sel.value;
else
sel.selectedIndex = 0;
}
}
function empty(fg_no) {
if (confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n그룹에 속한 데이터를 정말로 비우시겠습니까?"))
location.href = 'form_group_update.php?w='+ fg_no +'&fg_no=' + fg_no;
}
function grouplist_submit(f)
{
if (!is_checked("chk[]")) {
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
return false;
}
if(document.pressed == "선택삭제") {
if(confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n삭제되는 그룹에 속한 자료는 '미분류'로 이동됩니다.\n\n그래도 삭제하시겠습니까?")) {
f.w.value = "de";
} else {
return false;
}
}
if(document.pressed == "선택비우기") {
if(confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n그룹에 속한 데이터를 정말로 비우시겠습니까?")) {
f.w.value = "em";
} else {
return false;
}
}
return true;
}
</script>
<form name="group<?php echo $res['fg_no']?>" method="post" action="./form_group_update.php" class="local_sch02 local_sch">
<input type="hidden" name="fg_no" value="<?php echo $res['fg_no']?>">
<div>
<label for="fg_name">그룹명<strong class="sound_only"> 필수</strong></label>
<input type="text" id="fg_name" name="fg_name" required class="required frm_input">
<input type="submit" value="추가" class="btn_submit">
</div>
<div class="sch_last">
<span class="count_add01">건수 : <?php echo $total_count ?></span>
</div>
</form>
<div class="local_desc01 local_desc">
<p>그룹명순으로 정렬됩니다.</p>
</div>
<form name="group<?php echo $group[$i]['fg_no']?>" method="post" action="./form_group_update.php" onsubmit="return grouplist_submit(this);">
<input type="hidden" name="w" value="u">
<div class="tbl_head01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?> 목록</caption>
<thead>
<tr>
<th scope="col">
<label for="chkall" class="sound_only">그룹 전체</label>
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
</th>
<th scope="col">그룹명</th>
<th scope="col">이모티콘수</th>
<th scope="col">이동</th>
<th scope="col">보기</th>
</tr>
</thead>
<tbody>
<?php
$qry = sql_query("select count(*) as cnt from {$g5['sms5_form_table']} where fg_no=0");
$res = sql_fetch_array($qry);
?>
<tr>
<td></td>
<td>미분류</td>
<td class="td_numbig"><?php echo number_format($res['cnt'])?></td>
<td class="td_mng">
<label for="select_fg_no_999" class="sound_only">그룹명</label>
<select name="select_fg_no_999" id="select_fg_no_999" onchange="move(0, '미분류', this);">
<option value=""></option>
<?php for ($i=0; $i<count($group); $i++) { ?>
<option value="<?php echo $group[$i]['fg_no']?>"> <?php echo $group[$i]['fg_name']?> </option>
<?php } ?>
</select>
</td>
<td class="td_mng">
<a href="./form_list.php?fg_no=0">보기</a>
<!-- <button type="button" onclick="empty('no');">비우기</button> -->
</td>
</tr>
<?php
for ($i=0; $i<count($group); $i++) {
$bg = 'bg'.(($i + 1)%2);
?>
<tr class="<?php echo $bg; ?>">
<td class="td_mng">
<input type="hidden" name="fg_no[<?php echo $i ?>]" value="<?php echo $group[$i]['fg_no']?>" id="fg_no_<?php echo $i ?>">
<label for="chk_<?php echo $i ?>" class="sound_only">그룹명</label>
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i ?>">
</td>
<td>
<label for="fg_name_<?php echo $i; ?>" class="sound_only">그룹명</label>
<input type="text" name="fg_name[<?php echo $i; ?>]" value="<?php echo $group[$i]['fg_name']?>" id="fg_name_<?php echo $i; ?>" class="frm_input">
<input type="checkbox" name="fg_member[<?php echo $i; ?>]" value="1" id="fg_member_<?php echo $i; ?>" <?php if ($group[$i]['fg_member']) echo 'checked';?>>
<label for="fg_member_<?php echo $i; ?>">회원</label>
</td>
<td class="td_numbig">
<?php echo number_format($group[$i]['fg_count'])?>
</td>
<td class="td_mng">
<label for="select_fg_no_<?php echo $i; ?>" class="sound_only">그룹명</label>
<select name="select_fg_no[<?php echo $i; ?>]" id="select_fg_no_<?php echo $i; ?>" onchange="move(<?php echo $group[$i]['fg_no']?>, '<?php echo $group[$i]['fg_name']?>', this);">
<option value=''></option>
<option value='0'>미분류</option>
<?php for ($j=0; $j<count($group); $j++) { ?>
<?php if ($group[$i]['fg_no']==$group[$j]['fg_no']) continue; ?>
<option value="<?php echo $group[$j]['fg_no']?>"> <?php echo $group[$j]['fg_name']?></option>
<?php } ?>
</select>
</td>
<td class="td_mng">
<a href="./form_list.php?fg_no=<?php echo $group[$i]['fg_no']?>">보기</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="btn_list01 btn_list">
<input type="submit" name="act_button" value="선택수정" onclick="document.pressed=this.value">
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value">
<input type="submit" name="act_button" value="선택비우기" onclick="document.pressed=this.value">
</div>
</form>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,30 @@
<?php
// 이모티콘 그룹 이동
$sub_menu = "900500";
include_once("./_common.php");
auth_check($auth[$sub_menu], "w");
if ($fg_no)
{
$res = sql_fetch("select * from {$g5['sms5_form_group_table']} where fg_no = '$fg_no'");
if ($res)
$fg_count = $res['fg_count'];
else
$fg_count = 0;
sql_query("update {$g5['sms5_form_group_table']} set fg_count = fg_count + $fg_count where fg_no = '$move_no'");
sql_query("update {$g5['sms5_form_group_table']} set fg_count = 0 where fg_no='$fg_no'");
}
else
{
$fg_count = sql_fetch("select count(*) as cnt from {$g5['sms5_form_table']} where fg_no = 0");
$fg_count = $fg_count['cnt'];
sql_query("update {$g5['sms5_form_group_table']} set fg_count = fg_count + $fg_count where fg_no = '$move_no'");
}
$group = sql_fetch("select * from {$g5['sms5_form_group_table']} where fg_no = '$move_no'");
sql_query("update {$g5['sms5_form_table']} set fg_no = '$move_no', fg_member = '{$group['fg_member']}' where fg_no = '$fg_no'");
goto_url('./form_group.php');
?>

View File

@ -0,0 +1,92 @@
<?php
$sub_menu = "900500";
include_once("./_common.php");
auth_check($auth[$sub_menu], "w");
if ($w == 'u') // 업데이트
{
for ($i=0; $i<count($_POST['chk']); $i++)
{
// 실제 번호를 넘김
$k = $_POST['chk'][$i];
$fg_no = $_POST['fg_no'][$k];
$fg_name = $_POST['fg_name'][$k];
$fg_member = $_POST['fg_member'][$k];
if (!is_numeric($fg_no))
alert('그룹 고유번호가 없습니다.');
$res = sql_fetch("select * from {$g5['sms5_form_group_table']} where fg_no='$fg_no'");
if (!$res)
alert('존재하지 않는 그룹입니다.');
if (!strlen(trim($fg_name)))
alert('그룹명을 입력해주세요');
$res = sql_fetch("select fg_name from {$g5['sms5_form_group_table']} where fg_no<>'$fg_no' and fg_name='$fg_name'");
if ($res)
alert('같은 그룹명이 존재합니다.');
sql_query("update {$g5['sms5_form_group_table']} set fg_name='$fg_name', fg_member='$fg_member' where fg_no='$fg_no'");
sql_query("update {$g5['sms5_form_table']} set fg_member = '$fg_member' where fg_no = '$fg_no'");
}
}
else if ($w == 'de') // 그룹삭제
{
for ($i=0; $i<count($_POST['chk']); $i++)
{
// 실제 번호를 넘김
$k = $_POST['chk'][$i];
$fg_no = $_POST['fg_no'][$k];
if (!is_numeric($fg_no))
alert('그룹 고유번호가 없습니다.');
$res = sql_fetch("select * from {$g5['sms5_form_group_table']} where fg_no='$fg_no'");
if (!$res)
alert('존재하지 않는 그룹입니다.');
sql_query("delete from {$g5['sms5_form_group_table']} where fg_no='$fg_no'");
sql_query("update {$g5['sms5_form_table']} set fg_no = 0, fg_member = 0 where fg_no='$fg_no'");
}
}
else if ($w == 'em')
{
for ($i=0; $i<count($_POST['chk']); $i++)
{
// 실제 번호를 넘김
$k = $_POST['chk'][$i];
$fg_no = $_POST['fg_no'][$k];
if ($fg_no == 'no') $fg_no = 0;
if ($fg_no)
sql_query("update {$g5['sms5_form_group_table']} set fg_count = 0 where fg_no = '$fg_no'");
sql_query("delete from {$g5['sms5_form_table']} where fg_no = '$fg_no'");
}
}
else if ($w == 'no')
{
if ($fg_no == 'no') $fg_no = 0;
if ($fg_no)
sql_query("update {$g5['sms5_form_group_table']} set fg_count = 0 where fg_no = '$fg_no'");
sql_query("delete from {$g5['sms5_form_table']} where fg_no = '$fg_no'");
}
else // 등록
{
if (!strlen(trim($fg_name)))
alert('그룹명을 입력해주세요');
$res = sql_fetch("select fg_name from {$g5['sms5_form_group_table']} where fg_name = '$fg_name'");
if ($res)
alert('같은 그룹명이 존재합니다.');
sql_query("insert into {$g5['sms5_form_group_table']} set fg_name = '$fg_name'");
}
goto_url('./form_group.php');
?>

238
adm/sms_admin/form_list.php Normal file
View File

@ -0,0 +1,238 @@
<?php
$sub_menu = "900600";
include_once("./_common.php");
$page_size = 12;
$colspan = 2;
auth_check($auth[$sub_menu], "r");
$token = get_token();
$g5['title'] = "이모티콘 관리";
if (!$page) $page = 1;
if (is_numeric($fg_no))
$sql_group = " and fg_no='$fg_no' ";
else
$sql_group = "";
if ($st == 'all') {
$sql_search = "and (fo_name like '%{$sv}%' or fo_content like '%{$sv}%')";
} else if ($st == 'name') {
$sql_search = "and fo_name like '%{$sv}%'";
} else if ($st == 'content') {
$sql_search = "and fo_content like '%{$sv}%'";
} else {
$sql_search = '';
}
$total_res = sql_fetch("select count(*) as cnt from {$g5['sms5_form_table']} where 1 $sql_group $sql_search");
$total_count = $total_res[cnt];
$total_page = (int)($total_count/$page_size) + ($total_count%$page_size==0 ? 0 : 1);
$page_start = $page_size * ( $page - 1 );
$vnum = $total_count - (($page-1) * $page_size);
$group = array();
$qry = sql_query("select * from {$g5['sms5_form_group_table']} order by fg_name");
while ($res = sql_fetch_array($qry)) array_push($group, $res);
$res = sql_fetch("select count(*) as cnt from {$g5['sms5_form_table']} where fg_no=0");
$no_count = $res[cnt];
include_once(G5_ADMIN_PATH.'/admin.head.php');
?>
<script>
function book_all_checked(chk)
{
if (chk) {
jQuery('[name="fo_no[]"]').attr('checked', true);
} else {
jQuery('[name="fo_no[]"]').attr('checked', false);
}
}
function book_del(fo_no)
{
if (confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n그래도 삭제하시겠습니까?"))
location.href = "./form_update.php?w=d&fo_no=" + fo_no + "&page=<?php echo $page?>&fg_no=<?php echo $fg_no?>&st=<?php echo $st?>&sv=<?php echo $sv?>";
}
function multi_update(sel)
{
var fo_no = document.getElementsByName('fo_no');
var ck_no = '';
var count = 0;
if (!sel.value) {
sel.selectedIndex = 0;
return;
}
for (i=0; i<fo_no.length; i++) {
if (fo_no[i].checked==true) {
count++;
ck_no += fo_no[i].value + ',';
}
}
if (!count) {
alert('하나이상 선택해주세요.');
sel.selectedIndex = 0;
return;
}
if (sel.value == 'del') {
if (!confirm("선택한 이모티콘를 삭제합니다.\n\n비회원만 삭제됩니다.\n\n회원을 삭제하려면 회원관리 메뉴를 이용해주세요.\n\n실행하시겠습니까?"))
{
sel.selectedIndex = 0;
return;
}
} else if (!confirm("선택한 이모티콘를 " + sel.options[sel.selectedIndex].innerHTML + "\n\n실행하시겠습니까?")) {
sel.selectedIndex = 0;
return;
}
location.href = "./form_multi_update.php?w=" + sel.value + "&ck_no=" + ck_no;
}
</script>
<div class="local_ov01 local_ov">
건수 : <?php echo number_format($total_count);?>
</div>
<div class="local_sch01 local_sch sms_preset_sch">
<form>
<label for="fg_no" class="sound_only">그룹명</label>
<select name="fg_no" onchange="location.href='<?php echo $_SERVER['PHP_SELF']?>?fg_no='+this.value;">
<option value="" <?php echo $fg_no?'':'selected'?>> 전체 </option>
<option value="0" <?php echo $fg_no=='0'?'selected':''?>> 미분류 (<?php echo number_format($no_count)?>) </option>
<?php for($i=0; $i<count($group); $i++) {?>
<option value="<?php echo $group[$i]['fg_no']?>" <?php echo ($fg_no==$group[$i]['fg_no'])?'selected':''?>> <?php echo $group[$i]['fg_name']?> (<?php echo number_format($group[$i]['fg_count'])?>) </option>
<?php } ?>
</select>
</form>
<form name="search_form" method="get" action="<?php echo $_SERVER['PHP_SELF']?>">
<input type="hidden" name="fg_no" value="<?php echo $fg_no;?>">
<label for="st" class="sound_only">검색대상</label>
<select name="st" id="st">
<option value="all" <?php echo $st=='all'?'selected':''?>>제목 + 이모티콘</option>
<option value="name" <?php echo $st=='name'?'selected':''?>>제목</option>
<option value="content" <?php echo $st=='content'?'selected':''?>>이모티콘</option>
</select>
<label for="sv" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="sv" value="<?php echo $sv;?>" id="sv" required class="frm_input required" >
<input type="submit" value="검색" class="btn_submit">
</form>
</div>
<div id="sms5_preset_sel">
<input type="checkbox" id="book_all" onclick="book_all_checked(this.checked);">
<label for="book_all">전체선택</label>
</div>
<div class="btn_add01 btn_add">
<a href="./form_write.php?page=<?php echo $page?>&amp;fg_no=<?php echo $fg_no?>">이모티콘 추가</a>
</div>
<form name="emoticonlist" id="emoticonlist" method="post" action="./form_multi_update.php" onsubmit="return emoticonlist_submit(this);" >
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="hidden" name="sw" value="">
<input type="hidden" name="atype" value="del">
<ul id="sms5_preset" class="sms5_box">
<?php
$count = 1;
$qry = sql_query("select * from {$g5['sms5_form_table']} where 1 $sql_group $sql_search order by fo_no desc limit $page_start, $page_size");
for($i=0;$res = sql_fetch_array($qry);$i++)
{
$tmp = sql_fetch("select fg_name from {$g5['sms5_form_group_table']} where fg_no='{$res['fg_no']}'");
if (!$tmp)
$group_name = '미분류';
else
$group_name = $tmp['fg_name'];
if ($i == 0) $li_i = 1;
else {
if ($li_i < 12) $li_i += 1;
else if ($li_i == 12) $li_i = 1;
}
?>
<li class="li_<?php echo $li_i; ?> sms5_box">
<span class="box_ico"></span>
<div class="li_chk">
<label for="fo_no_<?php echo $i; ?>" class="sound_only"><?php echo $group_name?>의 <?php echo cut_str($res['fo_name'],10)?></label>
<input type="checkbox" name="fo_no[]" value="<?php echo $res['fo_no']?>" id="fo_no_<?php echo $i; ?>">
</div>
<div class="li_preview">
<textarea readonly class="box_txt box_square"><?php echo $res['fo_content']?></textarea>
</div>
<div class="li_info">
<span class="sound_only">그룹 </span><b><?php echo $group_name?></b><br>
<span class="sound_only">제목 </span><?php echo cut_str($res['fo_name'],10)?><br>
</div>
<div class="li_date">
<span class="sound_only">등록 </span><?php echo date('Y-m-d', strtotime($res['fo_datetime']))?>
</div>
<div class="li_cmd">
<a href="./form_write.php?w=u&amp;fo_no=<?php echo $res['fo_no']?>&amp;page=<?php echo $page;?>&amp;fg_no=<?php echo $fg_no;?>&amp;st=<?php echo $st;?>&amp;sv=<?php echo $sv;?>">수정</a>
<a href="javascript:void(book_del('<?php echo $res['fo_no']?>'));">삭제</a>
<a href="./sms_write.php?fo_no=<?php echo $res['fo_no']?>">보내기</a>
</div>
</li>
<?php } ?>
</ul>
<div class="btn_list01 btn_list" style="position:relative">
<input type="submit" name="act_button" value="선택이동" onclick="document.pressed=this.value">
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value">
</div>
</form>
<script>
function emoticonlist_submit(f){
if (!is_checked("fo_no[]")) {
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
return false;
}
if(document.pressed == "선택이동") {
select_copy("move", f);
return;
}
if(document.pressed == "선택삭제") {
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
return false;
}
}
return true;
}
// 선택한 이모티콘 그룹 이동
function select_copy(sw, f) {
if( !f ){
var f = document.emoticonlist;
}
if (sw == "copy")
str = "복사";
else
str = "이동";
var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1");
f.sw.value = sw;
f.target = "move";
f.action = "./emoticon_move.php";
f.submit();
}
</script>
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, $_SERVER['PHP_SELF']."?fg_no=$fg_no&amp;st=$st&amp;sv=$sv&amp;page="); ?>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,27 @@
<?php
$sub_menu = "900600";
include_once("./_common.php");
auth_check($auth[$sub_menu], "w");
check_token();
if($atype == "del"){
$count = count($_POST['fo_no']);
if(!$count)
alert('선택삭제 하실 항목을 하나이상 선택해 주세요.');
for ($i=0; $i<$count; $i++)
{
// 실제 번호를 넘김
$fo_no = $_POST['fo_no'][$i];
if (!trim($fo_no)) continue;
$res = sql_fetch("select * from {$g5['sms5_form_table']} where fo_no='$fo_no'");
if (!$res) continue;
sql_query("delete from {$g5['sms5_form_table']} where fo_no='$fo_no'");
sql_query("update {$g5['sms5_form_group_table']} set fg_count = fg_count - 1 where fg_no='{$res['fg_no']}'");
}
}
goto_url('./form_list.php');

View File

@ -0,0 +1,78 @@
<?php
$sub_menu = "900600";
include_once("./_common.php");
auth_check($auth[$sub_menu], "w");
$g5['title'] = "이모티콘 업데이트";
if ($w == 'u') // 업데이트
{
if (!$fg_no) $fg_no = 0;
if (!$fo_receipt) $fo_receipt = 0; else $fo_receipt = 1;
if (!strlen(trim($fo_name)))
alert('이름을 입력해주세요');
if (!strlen(trim($fo_content)))
alert('이모티콘을 입력해주세요');
/*
$res = sql_fetch("select * from {$g5['sms5_form_table']} where fo_no<>'$fo_no' and fo_content='$fo_content'");
if ($res)
alert('같은 이모티콘이 존재합니다.');
*/
$res = sql_fetch("select * from {$g5['sms5_form_table']} where fo_no='$fo_no'");
if (!$res)
alert('존재하지 않는 데이터 입니다.');
if ($fg_no != $res['fg_no']) {
if ($res['fg_no'])
sql_query("update {$g5['sms5_form_group_table']} set fg_count = fg_count - 1 where fg_no='{$res[fg_no]}'");
sql_query("update {$g5['sms5_form_group_table']} set fg_count = fg_count + 1 where fg_no='$fg_no'");
}
$group = sql_fetch("select * from {$g5['sms5_form_group_table']} where fg_no = '$fg_no'");
sql_query("update {$g5['sms5_form_table']} set fg_no='$fg_no', fg_member='{$group['fg_member']}', fo_name='$fo_name', fo_content='$fo_content', fo_datetime='".G5_TIME_YMDHIS."' where fo_no='$fo_no'");
}
else if ($w == 'd') // 삭제
{
if (!is_numeric($fo_no))
alert('고유번호가 없습니다.');
$res = sql_fetch("select * from {$g5['sms5_form_table']} where fo_no='$fo_no'");
if (!$res)
alert('존재하지 않는 데이터 입니다.');
sql_query("delete from {$g5['sms5_form_table']} where fo_no='$fo_no'");
sql_query("update {$g5['sms5_form_group_table']} set fg_count = fg_count - 1 where fg_no = '{$res['fg_no']}'");
$get_fg_no = $fg_no;
}
else // 등록
{
if (!$fg_no) $fg_no = 0;
if (!strlen(trim($fo_name)))
alert('이름을 입력해주세요');
if (!strlen(trim($fo_content)))
alert('이모티콘을 입력해주세요');
$res = sql_fetch("select * from {$g5['sms5_form_table']} where fo_content='$fo_content'");
if ($res)
alert('같은 이모티콘이 존재합니다.');
$group = sql_fetch("select * from {$g5['sms5_form_group_table']} where fg_no = '$fg_no'");
sql_query("insert into {$g5['sms5_form_table']} set fg_no='$fg_no', fg_member='{$group['fg_member']}', fo_name='$fo_name', fo_content='$fo_content', fo_datetime='".G5_TIME_YMDHIS."'");
sql_query("update {$g5['sms5_form_group_table']} set fg_count = fg_count + 1 where fg_no = '$fg_no'");
$get_fg_no = $fg_no;
}
$go_url = './form_list.php?page='.$page.'&amp;fg_no='.$get_fg_no;
goto_url($go_url);
?>

View File

@ -0,0 +1,233 @@
<?php
$sub_menu = "900600";
include_once("./_common.php");
auth_check($auth[$sub_menu], "w");
$g5['title'] = "이모티콘 ";
if ($w == 'u' && is_numeric($fo_no)) {
$write = sql_fetch("select * from {$g5['sms5_form_table']} where fo_no='$fo_no'");
$g5['title'] .= '수정';
}
else {
$write['fg_no'] = $fg_no;
$g5['title'] .= '추가';
}
include_once(G5_ADMIN_PATH.'/admin.head.php');
?>
<form name="book_form" method="post" action="form_update.php">
<input type="hidden" name="w" value="<?php echo $w?>">
<input type="hidden" name="page" value="<?php echo $page?>">
<input type="hidden" name="fo_no" value="<?php echo $write['fo_no']?>">
<input type="hidden" name="get_fg_no" value="<?php echo $fg_no?>">
<div class="tbl_frm01 tbl_wrap">
<table>
<caption><?php echo $g5['title'];?> 목록</caption>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="fg_no">그룹</label></th>
<td>
<select name="fg_no" id="fg_no" required>
<option value="0">미분류</option>
<?php
$qry = sql_query("select * from {$g5['sms5_form_group_table']} order by fg_name");
while($res = sql_fetch_array($qry)) {
?>
<option value="<?php echo $res['fg_no']?>" <?php echo $res['fg_no']==$write['fg_no']?'selected':''?>><?php echo $res['fg_name']?></option>
<?php } ?>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="fo_name">제목</label></th>
<td><input type="text" name="fo_name" id="fo_name" required value="<?php echo $write['fo_name']?>" class="frm_input required" size="70"></td>
</tr>
<tr>
<th scope="row">메세지</th>
<td id="sms5_emo_add">
<div class="sms5_box write_wrap">
<span class="box_ico"></span>
<label for="sms_contents" id="wr_message_lbl">내용</label>
<textarea name="fo_content" id="sms_contents" class="box_txt box_square" onkeyup="byte_check('sms_contents', 'sms_bytes');" accesskey="m"><?php echo $write['fo_content']?></textarea>
<div id="sms_byte"><span id="sms_bytes">0</span> / 80 byte</div>
<button type="button" id="write_sc_btn" class="write_scemo_btn">특수<br>기호</button>
<div id="write_sc" class="write_scemo">
<span class="scemo_ico"></span>
<div class="scemo_list">
<button type="button" class="scemo_add" onclick="javascript:add('■')">■</button>
<button type="button" class="scemo_add" onclick="javascript:add('□')">□</button>
<button type="button" class="scemo_add" onclick="javascript:add('▣')">▣</button>
<button type="button" class="scemo_add" onclick="javascript:add('◈')">◈</button>
<button type="button" class="scemo_add" onclick="javascript:add('◆')">◆</button>
<button type="button" class="scemo_add" onclick="javascript:add('◇')">◇</button>
<button type="button" class="scemo_add" onclick="javascript:add('♥')">♥</button>
<button type="button" class="scemo_add" onclick="javascript:add('♡')">♡</button>
<button type="button" class="scemo_add" onclick="javascript:add('●')">●</button>
<button type="button" class="scemo_add" onclick="javascript:add('○')">○</button>
<button type="button" class="scemo_add" onclick="javascript:add('▲')">▲</button>
<button type="button" class="scemo_add" onclick="javascript:add('▼')">▼</button>
<button type="button" class="scemo_add" onclick="javascript:add('▶')">▶</button>
<button type="button" class="scemo_add" onclick="javascript:add('▷')">▷</button>
<button type="button" class="scemo_add" onclick="javascript:add('◀')">◀</button>
<button type="button" class="scemo_add" onclick="javascript:add('◁')">◁</button>
<button type="button" class="scemo_add" onclick="javascript:add('☎')">☎</button>
<button type="button" class="scemo_add" onclick="javascript:add('☏')">☏</button>
<button type="button" class="scemo_add" onclick="javascript:add('♠')">♠</button>
<button type="button" class="scemo_add" onclick="javascript:add('♤')">♤</button>
<button type="button" class="scemo_add" onclick="javascript:add('♣')">♣</button>
<button type="button" class="scemo_add" onclick="javascript:add('♧')">♧</button>
<button type="button" class="scemo_add" onclick="javascript:add('★')">★</button>
<button type="button" class="scemo_add" onclick="javascript:add('☆')">☆</button>
<button type="button" class="scemo_add" onclick="javascript:add('☞')">☞</button>
<button type="button" class="scemo_add" onclick="javascript:add('☜')">☜</button>
<button type="button" class="scemo_add" onclick="javascript:add('▒')">▒</button>
<button type="button" class="scemo_add" onclick="javascript:add('⊙')">⊙</button>
<button type="button" class="scemo_add" onclick="javascript:add('㈜')">㈜</button>
<button type="button" class="scemo_add" onclick="javascript:add('№')">№</button>
<button type="button" class="scemo_add" onclick="javascript:add('㉿')">㉿</button>
<button type="button" class="scemo_add" onclick="javascript:add('♨')">♨</button>
<button type="button" class="scemo_add" onclick="javascript:add('™')">™</button>
<button type="button" class="scemo_add" onclick="javascript:add('℡')">℡</button>
<button type="button" class="scemo_add" onclick="javascript:add('∑')">∑</button>
<button type="button" class="scemo_add" onclick="javascript:add('∏')">∏</button>
<button type="button" class="scemo_add" onclick="javascript:add('♬')">♬</button>
<button type="button" class="scemo_add" onclick="javascript:add('♪')">♪</button>
<button type="button" class="scemo_add" onclick="javascript:add('♩')">♩</button>
<button type="button" class="scemo_add" onclick="javascript:add('♭')">♭</button>
</div>
<div class="scemo_cls"><button type="button" class="scemo_cls_btn">닫기</button></div>
</div>
<button type="button" id="write_emo_btn" class="write_scemo_btn">이모<br>티콘</button>
<div id="write_emo" class="write_scemo">
<span class="scemo_ico"></span>
<div class="scemo_list">
<button type="button" class="scemo_add" onclick="javascript:add('*^^*')">*^^*</button>
<button type="button" class="scemo_add" onclick="javascript:add('♡.♡')">♡.♡</button>
<button type="button" class="scemo_add" onclick="javascript:add('@_@')">@_@</button>
<button type="button" class="scemo_add" onclick="javascript:add('☞_☜')">☞_☜</button>
<button type="button" class="scemo_add" onclick="javascript:add('ㅠ ㅠ')">ㅠ ㅠ</button>
<button type="button" class="scemo_add" onclick="javascript:add('Θ.Θ')">Θ.Θ</button>
<button type="button" class="scemo_add" onclick="javascript:add('^_~♥')">^_~♥</button>
<button type="button" class="scemo_add" onclick="javascript:add('~o~')">~o~</button>
<button type="button" class="scemo_add" onclick="javascript:add('★.★')">★.★</button>
<button type="button" class="scemo_add" onclick="javascript:add('(!.!)')">(!.!)</button>
<button type="button" class="scemo_add" onclick="javascript:add('⊙.⊙')">⊙.⊙</button>
<button type="button" class="scemo_add" onclick="javascript:add('q.p')">q.p</button>
<button type="button" class="scemo_add emo_long" onclick="javascript:add('┏( \'\')┛')">┏( \'\')┛</button>
<button type="button" class="scemo_add emo_long" onclick="javascript:add('@)-)--')">@)-)--')</button>
<button type="button" class="scemo_add emo_long" onclick="javascript:add('↖(^-^)↗')">↖(^-^)↗</button>
<button type="button" class="scemo_add emo_long" onclick="javascript:add('(*^-^*)')">(*^-^*)</button>
</div>
<div class="scemo_cls"><button type="button" class="scemo_cls_btn">닫기</button></div>
</div>
</div>
</td>
</tr>
<?php if ($w == 'u') {?>
<tr>
<th scope="row">업데이트</th>
<td> <?php echo $write['fo_datetime']?> </td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="btn_confirm01 btn_confirm">
<input type="submit" value="확인" class="btn_submit" accesskey="s">
<a href="./form_list.php?<?php echo $_SERVER['QUERY_STRING']?>">목록</a>
</div>
</form>
<script>
function add(str) {
var conts = document.getElementById('sms_contents');
var bytes = document.getElementById('sms_bytes');
conts.focus();
conts.value+=str;
byte_check('sms_contents', 'sms_bytes');
return;
}
function byte_check(sms_contents, sms_bytes)
{
var conts = document.getElementById(sms_contents);
var bytes = document.getElementById(sms_bytes);
var i = 0;
var cnt = 0;
var exceed = 0;
var ch = '';
for (i=0; i<conts.value.length; i++)
{
ch = conts.value.charAt(i);
if (escape(ch).length > 4) {
cnt += 2;
} else {
cnt += 1;
}
}
bytes.innerHTML = cnt;
if (cnt > 80)
{
exceed = cnt - 80;
alert('메시지 내용은 80바이트를 넘을수 없습니다.\n\n작성하신 메세지 내용은 '+ exceed +'byte가 초과되었습니다.\n\n초과된 부분은 자동으로 삭제됩니다.');
var tcnt = 0;
var xcnt = 0;
var tmp = conts.value;
for (i=0; i<tmp.length; i++)
{
ch = tmp.charAt(i);
if (escape(ch).length > 4) {
tcnt += 2;
} else {
tcnt += 1;
}
if (tcnt > 80) {
tmp = tmp.substring(0,i);
break;
} else {
xcnt = tcnt;
}
}
conts.value = tmp;
bytes.innerHTML = xcnt;
return;
}
}
byte_check('sms_contents', 'sms_bytes');
document.getElementById('sms_contents').focus();
</script>
<script>
$(function(){
$(".box_txt").bind("focus keydown", function(){
$("#wr_message_lbl").hide();
});
$(".write_scemo_btn").click(function(){
$(".write_scemo").hide();
$(this).next(".write_scemo").show();
});
$(".scemo_cls_btn").click(function(){
$(".write_scemo").hide();
});
});
</script>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,100 @@
<?php
$sub_menu = "900400";
include_once("./_common.php");
$page_size = 20;
$colspan = 11;
auth_check($auth[$sub_menu], "r");
$g5['title'] = "문자전송 내역";
if (!$page) $page = 1;
if ($st && trim($sv))
$sql_search = " and wr_message like '%$sv%' ";
else
$sql_search = "";
$total_res = sql_fetch("select count(*) as cnt from {$g5['sms5_write_table']} where wr_renum=0 $sql_search");
$total_count = $total_res[cnt];
$total_page = (int)($total_count/$page_size) + ($total_count%$page_size==0 ? 0 : 1);
$page_start = $page_size * ( $page - 1 );
$vnum = $total_count - (($page-1) * $page_size);
include_once(G5_ADMIN_PATH.'/admin.head.php');
?>
<form name="search_form" id="search_form" action=<?php echo $_SERVER['PHP_SELF'];?> class="local_sch01 local_sch" method="get">
<label for="st" class="sound_only">검색대상</label>
<select name="st" id="st">
<option value="wr_message" <?php echo $st=="wr_message"?"selected":""?>>메세지</option>
</select>
<label for="sv" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="sv" value="<?php echo $sv ?>" id="sv" required class="required frm_input">
<input type="submit" value="검색" class="btn_submit">
</form>
<div class="tbl_head01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?> 목록</caption>
<thead>
<tr>
<th scope="col">번호</th>
<th scope="col">메세지</th>
<th scope="col">회신번호</th>
<th scope="col">전송일시</th>
<th scope="col">예약</th>
<th scope="col">총건수</th>
<th scope="col">성공</th>
<th scope="col">실패</th>
<th scope="col">중복</th>
<th scope="col">재전송</th>
<th scope="col">관리</th>
</tr>
</thead>
<tbody>
<?php if (!$total_count) { ?>
<tr>
<td colspan="<?php echo $colspan?>" class="empty_table" >
데이터가 없습니다.
</td>
</tr>
<?php
}
$qry = sql_query("select * from {$g5['sms5_write_table']} where wr_renum=0 $sql_search order by wr_no desc limit $page_start, $page_size");
while($res = sql_fetch_array($qry)) {
$bg = 'bg'.($line++%2);
$tmp_wr_memo = @unserialize($res['wr_memo']);
$dupli_count = $tmp_wr_memo['total'] ? $tmp_wr_memo['total'] : 0;
?>
<tr class="<?php echo $bg; ?>">
<td class="td_numsmall"><?php echo $vnum--?></td>
<td><span title="<?php echo $res['wr_message']?>"><?php echo $res['wr_message']?></span></td>
<td class="td_numbig"><?php echo $res['wr_reply']?></td>
<td class="td_datetime"><?php echo date('Y-m-d H:i', strtotime($res['wr_datetime']))?></td>
<td class="td_boolean"><?php echo $res['wr_booking']!='0000-00-00 00:00:00'?"<span title='{$res['wr_booking']}'>예약</span>":'';?></td>
<td class="td_num"><?php echo number_format($res['wr_total'])?></td>
<td class="td_num"><?php echo number_format($res['wr_success'])?></td>
<td class="td_num"><?php echo number_format($res['wr_failure'])?></td>
<td class="td_num"><?php echo $dupli_count;?></td>
<td class="td_num"><?php echo number_format($res['wr_re_total'])?></td>
<td class="td_mngsmall">
<a href="./history_view.php?page=<?php echo $page;?>&amp;st=<?php echo $st;?>&amp;sv=<?php echo $sv;?>&amp;wr_no=<?php echo $res['wr_no'];?>">수정</a>
<!-- <a href="./history_del.php?page=<?php echo $page;?>&amp;st=<?php echo $st;?>&amp;sv=<?php echo $sv;?>&amp;wr_no=<?php echo $res['wr_no'];?>">삭제</a> -->
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, $_SERVER['PHP_SELF']."?st=$st&amp;sv=$sv&amp;page="); ?>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,90 @@
<?php
$sub_menu = "900450";
include_once("./_common.php");
$page_size = 20;
$colspan = 7;
auth_check($auth[$sub_menu], "r");
$g5['title'] = "문자전송 내역 (회원)";
if (!$page) $page = 1;
if ($st && trim($sv))
$sql_search = " and $st like '%$sv%' ";
else
$sql_search = "";
$total_res = sql_fetch("select count(*) as cnt from {$g5['sms5_member_history_table']} where 1 $sql_search");
$total_count = $total_res['cnt'];
$total_page = (int)($total_count/$page_size) + ($total_count%$page_size==0 ? 0 : 1);
$page_start = $page_size * ( $page - 1 );
$vnum = $total_count - (($page-1) * $page_size);
include_once(G5_ADMIN_PATH.'/admin.head.php');
?>
<form name="search_form" method="get" action="<?php echo $_SEVER['PHP_SELF']?>" class="local_sch01 local_sch">
<label for="st" class="sound_only">검색대상</label>
<select name="st" id="st">
<option value="mb_id" <?php echo $st=='mh_name'?'selected':''?>>아이디</option>
<option value="mh_hp" <?php echo $st=='mh_hp'?'selected':''?>>받는번호</option>
<option value="mh_reply" <?php echo $st=='mh_reply'?'selected':''?>>보내는번호</option>
</select>
<label for="sv" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="sv" value="<?php echo $sv ?>" id="sv" required class="required frm_input">
<input type="submit" value="검색" class="btn_submit">
</form>
<div class="tbl_head01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?> 목록</caption>
<thead>
<tr>
<th scope="col">번호</th>
<th scope="col">회원</th>
<th scope="col">보내는번호</th>
<th scope="col">받는번호</th>
<th scope="col">전송일시</th>
<th scope="col">예약</th>
<th scope="col">Log</th>
</tr>
</thead>
<tbody>
<?php if (!$total_count) { ?>
<tr>
<td colspan="<?php echo $colspan?>" class="empty_table" >
데이터가 없습니다.
</td>
</tr>
<?php
}
$qry = sql_query("select * from {$g5['sms5_member_history_table']} where 1 $sql_search order by mh_no desc limit $page_start, $page_size");
while($row = sql_fetch_array($qry)) {
$bg = 'bg'.($line++%2);
$mb = get_member($row['mb_id']);
$mb_id = get_sideview($row['mb_id'], $mb['mb_nick']);
?>
<tr class="<?php echo $bg; ?>">
<td class="td_num"><?php echo $vnum--?></td>
<td class="td_mbid"><?php echo $mb_id?></td>
<td class="td_numbig"><?php echo $row['mh_reply']?></td>
<td class="td_numbig"><?php echo $row['mh_hp']?></td>
<td class="td_datetime"><?php echo $row['mh_datetime']?></td>
<td class="td_boolean"><?php echo $row['mh_booking']!='0000-00-00 00:00:00'?"<span title='{$row['mh_booking']}'>예약</span>":'';?></td>
<td><?php echo $row['mh_log']?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, $_SERVER['PHP_SELF']."?st=$st&amp;sv=$sv&amp;page="); ?>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,108 @@
<?php
$sub_menu = "900400";
include_once("./_common.php");
$page_size = 20;
$colspan = 10;
auth_check($auth[$sub_menu], "r");
$g5['title'] = "문자전송 내역 (번호별)";
if (!$page) $page = 1;
if ($st && trim($sv))
$sql_search = " and $st like '%$sv%' ";
else
$sql_search = "";
$total_res = sql_fetch("select count(*) as cnt from {$g5['sms5_history_table']} where 1 $sql_search");
$total_count = $total_res['cnt'];
$total_page = (int)($total_count/$page_size) + ($total_count%$page_size==0 ? 0 : 1);
$page_start = $page_size * ( $page - 1 );
$vnum = $total_count - (($page-1) * $page_size);
include_once(G5_ADMIN_PATH.'/admin.head.php');
?>
<form name="search_form" method="get" action="<?echo $_SERVER['PHP_SELF']?>" class="local_sch01 local_sch" >
<label for="st" class="sound_only">검색대상</label>
<select name="st" id="st">
<option value="hs_name" <?php echo $st=='hs_name'?'selected':''?>>이름</option>
<option value="hs_hp" <?php echo $st=='hs_hp'?'selected':''?>>휴대폰번호</option>
<option value="bk_no" <?php echo $st=='bk_no'?'selected':''?>>고유번호</option>
</select>
<label for="sv" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="sv" value="<?php echo $sv ?>" id="sv" required class="required frm_input">
<input type="submit" value="검색" class="btn_submit">
</form>
<div class="tbl_head01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?> 목록</caption>
<thead>
<tr>
<th scope="col">번호</th>
<th scope="col">그룹</th>
<th scope="col">이름</th>
<th scope="col">회원ID</th>
<th scope="col">전화번호</th>
<th scope="col">전송일시</th>
<th scope="col">예약</th>
<th scope="col">전송</th>
<th scope="col">메세지</th>
<th scope="col">관리</th>
</tr>
</thead>
<tbody>
<?php if (!$total_count) { ?>
<tr>
<td colspan="<?php echo $colspan?>" class="empty_table" >
데이터가 없습니다.
</td>
</tr>
<?php
}
$qry = sql_query("select * from {$g5['sms5_history_table']} where 1 $sql_search order by hs_no desc limit $page_start, $page_size");
while($res = sql_fetch_array($qry)) {
$bg = 'bg'.($line++%2);
$write = sql_fetch("select * from {$g5['sms5_write_table']} where wr_no='{$res['wr_no']}' and wr_renum=0");
$group = sql_fetch("select * from {$g5['sms5_book_group_table']} where bg_no='{$res['bg_no']}'");
if ($group)
$bg_name = $group['bg_name'];
else
$bg_name = '없음';
if ($res['mb_id'])
$mb_id = "<a href=\"".G5_ADMIN_PATH."/member_form.php?&w=u&mb_id={$res['mb_id']}\">{$res['mb_id']}</a>";
else
$mb_id = '비회원';
?>
<tr class="<?php echo $bg; ?>">
<td class="td_num"><?php echo $vnum--?></td>
<td class="td_mbname"><?php echo $bg_name?></td>
<td class="td_mbname"><a href="./num_book_write.php?w=u&bk_no=<?php echo $res['bk_no']?>"><?php echo $res['hs_name']?></a></td>
<td class="td_mbid"><?php echo $mb_id?></td>
<td class="td_numbig"><?php echo $res['hs_hp']?></td>
<td class="td_datetime"><?php echo date('Y-m-d H:i', strtotime($write['wr_datetime']))?></td>
<td class="td_boolean"><?php echo $write['wr_booking']!='0000-00-00 00:00:00'?"<span title='{$write['wr_booking']}'>예약</span>":'';?></td>
<td class="td_boolean"><?php echo $res['hs_flag']?'성공':'실패'?></td>
<td><span title="<?php echo $write['wr_message']?>"><?php echo $write['wr_message']?></span></td>
<td class="td_mngsmall">
<a href="./history_view.php?page=<?php echo $page?>&st=<?php echo $st?>&sv=<?php echo $sv?>&wr_no=<?php echo $res['wr_no']?>">수정</a>
<!-- <a href="./history_del.php?page=<?php echo $page?>&st=<?php echo $st?>&sv=<?php echo $sv?>&wr_no=<?php echo $res['wr_no']?>"><img src="./img/icon_delete.gif" alt="삭제" ></a> -->
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, $_SERVER['PHP_SELF']."?st=$st&amp;sv=$sv&amp;page="); ?>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,138 @@
<?php
$sub_menu = "900400";
include_once("./_common.php");
auth_check($auth[$sub_menu], "w");
$g5['title'] = "문자전송중";
$list = array();
$write = sql_fetch("select * from {$g5['sms5_write_table']} where wr_no='$wr_no' and wr_renum=0");
$res = sql_fetch("select max(wr_renum) as wr_renum from {$g5['sms5_write_table']} where wr_no='$wr_no'");
$new_wr_renum = $res['wr_renum'] + 1;
if ($w == 'f')
$sql_flag = " and hs_flag=0 ";
else
$sql_flag = "";
if ($wr_renum)
$sql_renum = " and wr_renum='$wr_renum' ";
else
$sql_renum = " and wr_renum=0 ";
$res = sql_fetch("select count(*) as cnt from {$g5['sms5_history_table']} where wr_no='$wr_no' $sql_renum $sql_flag");
if (!$res['cnt']) {
?>
<script>
act = window.open('sms_ing.php', 'act', 'width=300, height=200');
act.close();
alert('재전송할 내역이 없습니다.');
history.back();
</script>
<?php
exit;
}
$sql = sql_query("select * from {$g5['sms5_history_table']} where wr_no='$wr_no' $sql_renum $sql_flag");
while ($res = sql_fetch_array($sql))
{
$res'[bk_hp'] = get_hp($res['bk_hp'], 0);
if ($g5['sms5_demo'])
$res['bk_hp'] = '0100000000';
array_push($list, $res);
}
$wr_total = count($list);
if ($config['cf_sms_use'] != 'icode') {
alert('기본환경설정에서 icode sms 사용이 비활성화 되어 있습니다.');
}
include_once(G5_ADMIN_PATH.'/admin.head.php');
$SMS = new SMS5;
$SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']);
$reply = str_replace('-', '', trim($write['wr_reply']));
$result = $SMS->Add($list, $reply, '', '', $write['wr_message'], '', $wr_total);
if ($result)
{
$result = $SMS->Send();
if ($result) //SMS 서버에 접속했습니다.
{
sql_query("insert into {$g5['sms5_write_table']} set wr_no='$wr_no', wr_renum='$new_wr_renum', wr_reply='{$write['wr_reply']}', wr_message='{$write['wr_message']}', wr_total='$wr_total', wr_datetime='".G5_TIME_YMDHIS."'");
$wr_success = 0;
$wr_failure = 0;
$count = 0;
foreach ($SMS->Result as $result)
{
list($phone, $code) = explode(":", $result);
if (substr($code,0,5) == "Error")
{
$hs_code = substr($code,6,2);
switch ($hs_code) {
case '02': // "02:형식오류"
$hs_memo = "형식이 잘못되어 전송이 실패하였습니다.";
break;
case '23': // "23:인증실패,데이터오류,전송날짜오류"
$hs_memo = "데이터를 다시 확인해 주시기바랍니다.";
break;
case '97': // "97:잔여코인부족"
$hs_memo = "잔여코인이 부족합니다.";
break;
case '98': // "98:사용기간만료"
$hs_memo = "사용기간이 만료되었습니다.";
break;
case '99': // "99:인증실패"
$hs_memo = "인증 받지 못하였습니다. 계정을 다시 확인해 주세요.";
break;
default: // "미 확인 오류"
$hs_memo = "알 수 없는 오류로 전송이 실패하었습니다.";
break;
}
$wr_failure++;
$hs_flag = 0;
}
else
{
$hs_code = $code;
$hs_memo = get_hp($phone, 1)."로 전송했습니다.";
$wr_success++;
$hs_flag = 1;
}
$row = array_shift($list);
$row['bk_hp'] = get_hp($row['bk_hp'], 1);
$log = array_shift($SMS->Log);
sql_query("insert into {$g5['sms5_history_table']} set wr_no='$wr_no', wr_renum='$new_wr_renum', bg_no='{$row['bg_no']}', mb_id='{$row['mb_id']}', bk_no='{$row['bk_no']}', hs_name='{$row['hs_name']}', hs_hp='{$row['hs_hp']}', hs_datetime='".G5_TIME_YMDHIS."', hs_flag='$hs_flag', hs_code='$hs_code', hs_memo='$hs_memo', hs_log='$log'");
}
$SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
sql_query("update {$g5['sms5_write_table']} set wr_success='$wr_success', wr_failure='$wr_failure' where wr_no='$wr_no' and wr_renum='$new_wr_renum'");
sql_query("update {$g5['sms5_write_table']} set wr_re_total=wr_re_total+1 where wr_no='$wr_no' and wr_renum=0");
}
else alert("에러: SMS 서버와 통신이 불안정합니다.");
}
else alert("에러: SMS 데이터 입력도중 에러가 발생하였습니다.");
?>
<script>
act = window.open('sms_ing.php', 'act', 'width=300, height=200');
act.close();
location.href = 'history_view.php?wr_no=<?php echo $wr_no?>&wr_renum=<?php echo $new_wr_renum?>';
</script>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,246 @@
<?php
$sub_menu = "900400";
include_once("./_common.php");
$spage_size = 20;
$colspan = 10;
auth_check($auth[$sub_menu], "r");
$g5['title'] = "문자전송 상세내역";
if (!is_numeric($wr_no))
alert('전송 고유 번호가 없습니다.');
if (!$spage) $spage = 1;
if ($sst && trim($ssv))
$sql_search = " and $sst like '%$ssv%' ";
else
$sql_search = "";
if ($wr_renum) {
$sql_renum = " and wr_renum='$wr_renum' ";
$re_text = " <span style='font-weight:normal; color:red;'>(재전송)</span>";
} else
$sql_renum = " and wr_renum='0'";
$total_res = sql_fetch("select count(*) as cnt from {$g5['sms5_history_table']} where wr_no='$wr_no' $sql_search $sql_renum");
$total_count = $total_res['cnt'];
$total_spage = (int)($total_count/$spage_size) + ($total_count%$spage_size==0 ? 0 : 1);
$spage_start = $spage_size * ( $spage - 1 );
$vnum = $total_count - (($spage-1) * $spage_size);
$write = sql_fetch("select * from {$g5['sms5_write_table']} where wr_no='$wr_no' $sql_renum");
if ($write['wr_booking'] == '0000-00-00 00:00:00')
$write['wr_booking'] = '즉시전송';
include_once(G5_ADMIN_PATH.'/admin.head.php');
?>
<script>
function re_send()
{
<?php if (!$write['wr_failure']) { ?>
alert('실패한 전송이 없습니다.');
<?php } else { ?>
if (!confirm('전송에 실패한 SMS 를 재전송 하시겠습니까?'))
return;
act = window.open('sms_ing.php', 'act', 'width=300, height=200');
act.focus();
location.href = './history_send.php?w=f&amp;page=<?php echo $page?>&amp;st=<?php echo $st?>&amp;sv=<?php echo $sv?>&amp;wr_no=<?php echo $wr_no?>&amp;wr_renum=<?php echo $wr_renum?>';
<?php } ?>
}
function all_send()
{
if (!confirm('전체 SMS 를 재전송 하시겠습니까?\n\n예약전송일 경우 예약일시는 다시 설정하셔야 합니다.'))
return;
location.href = './sms_write.php?wr_no=<?php echo $wr_no?>';
}
</script>
<form name="search_form" method="get" action="<?php echo $_SERVER['PHP_SELF']?>" class="local_sch01 local_sch">
<input type="hidden" name="wr_no" value="<?php echo $wr_no?>">
<input type="hidden" name="wr_renum" value="<?php echo $wr_renum?>">
<input type="hidden" name="page" value="<?php echo $page?>">
<input type="hidden" name="st" value="<?php echo $st?>">
<input type="hidden" name="sv" value="<?php echo $sv?>">
<label for="sst" class="sound_only">검색대상</label>
<select name="sst">
<option value="hs_name" <?php echo $sst=='hs_name'?'selected':''?>>이름</option>
<option value="hs_hp" <?php echo $sst=='hs_hp'?'selected':''?>>휴대폰번호</option>
</select>
<label for="ssv" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="ssv" value="<?php echo $ssv?>" id="ssv" class="frm_input">
<input type="submit" value="검색" class="btn_submit">
</form>
<div id="sms5_sent">
<div class="local_ov01 local_ov">
<span class="ov_listall">전송건수 <?php echo number_format($write['wr_total'])?> 건</span>
<span class="ov_listall">성공건수 <span class="txt_succeed"><?php echo number_format($write['wr_success'])?> 건</span></span>
<span class="ov_listall">실패건수 <span class="txt_fail"><?php echo number_format($write['wr_failure'])?> 건</span></span>
<span class="ov_listall">전송일시 <?php echo $write['wr_datetime']?></span>
<span class="ov_listall">예약일시 <?php echo $write['wr_booking']?></span>
<span class="ov_listall">회신번호 <?php echo $write['wr_reply']?></span>
</div>
<h2>전송내용</h2>
<div id="con_sms" class="sms5_box">
<span class="box_ico"></span>
<textarea class="box_txt" readonly><?php echo $write['wr_message'];?></textarea>
</div>
<?php if ($write['wr_re_total'] && !$wr_renum) { ?>
<h2>전송실패 문자 재전송 내역</h2>
<table>
<thead>
<tr>
<th scope="col">번호</th>
<!-- <th scope="col"><input type=checkbox></th> -->
<!-- <th scope="col">메세지</th> -->
<!-- <th scope="col">회신번호</th> -->
<th scope="col">전송일시</th>
<th scope="col">총건수</th>
<th scope="col">성공</th>
<th scope="col">실패</th>
<th scope="col">관리</th>
</tr>
</thead>
<tbody>
<?php
$res = sql_fetch("select count(*) as cnt from {$g5['sms5_write_table']} where wr_no='$wr_no' and wr_renum>0");
$re_vnum = $res['cnt'];
$qry = sql_query("select * from {$g5['sms5_write_table']} where wr_no='$wr_no' and wr_renum>0 order by wr_renum desc");
while($res = sql_fetch_array($qry)) {
?>
<tr>
<td><?php echo $re_vnum--?></td>
<!-- <td><input type=checkbox></td> -->
<!-- <td><?php echo $res[wr_message]; ?></span></td>-->
<!-- <td><?php echo $res[wr_reply]; ?></td>-->
<td><?php echo $res['wr_datetime']?></td>
<td><?php echo number_format($res['wr_total'])?></td>
<td><?php echo number_format($res['wr_success'])?></td>
<td><?php echo number_format($res['wr_failure'])?></td>
<td>
<a href="./history_view.php?page=<?php echo $page?>&amp;st=<?php echo $st?>&amp;sv=<?php echo $sv?>&amp;wr_no=<?php echo $res['wr_no']?>&amp;wr_renum=<?php echo $res['wr_renum']?>">수정</a>
<!-- <a href="./history_del.php?page=<?php echo $page?>&amp;st=<?php echo $st?>&amp;sv=<?php echo $sv?>&amp;wr_no=<?php echo $res[wr_no]?>&amp;wr_renum=<?php echo $res[wr_renum]?>">삭제</a> -->
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<?php
if( $write['wr_memo'] ){
$tmp_wr_memo = @unserialize($write['wr_memo']);
if( count($tmp_wr_memo) && is_array($tmp_wr_memo) ){
$arr_wr_memo = array_count_values( $tmp_wr_memo['hp'] );
?>
<h2>중복번호 <?php echo $tmp_wr_memo['total'];?>건</h2>
<ul id="sent_overlap">
<?php
foreach( $arr_wr_memo as $key=>$v){
if( empty($v) ) continue;
?>
<li><b><?php echo $key;?></b> 중복 <?php echo $v;?>건</li>
<?php } ?>
</ul>
<?php
}
}
?>
<h2>문자전송 목록 <?php echo $re_text?></h2>
<div class="btn_add01 btn_add">
<a href="javascript:all_send()">전체 재전송</a>
<a href="javascript:re_send()">실패내역 재전송</a>
<?php if (!$wr_renum) {?>
<a href="./history_list.php?page=<?php echo $page?>&amp;st=<?php echo $st?>&amp;sv=<?php echo $sv?>">목록</a>
<?php } else { ?>
<a href="./history_view.php?page=<?php echo $page?>&amp;st=<?php echo $st?>&amp;sv=<?php echo $sv?>&amp;wr_no=<?php echo $wr_no?>">뒤로가기</a>
<?php } ?>
</div>
<div class="tbl_head01 tbl_wrap">
<table>
<thead>
<tr>
<th scope="col">번호</th>
<th scope="col">그룹</th>
<th scope="col">이름</th>
<th scope="col">회원ID</th>
<th scope="col">휴대폰번호</th>
<th scope="col">전송일시</th>
<th scope="col">결과</th>
<th scope="col">비고</th>
<th scope="col">내역</th>
</tr>
</thead>
<tbody>
<?php if (!$total_count) { ?>
<tr>
<td colspan="<?php echo $colspan?>" class="empty_table">
데이터가 없습니다.
</td>
</tr>
<?php
}
$qry = sql_query("select * from {$g5['sms5_history_table']} where wr_no='$wr_no' $sql_search $sql_renum order by hs_no desc limit $spage_start, $spage_size");
while($res = sql_fetch_array($qry)) {
$bg = 'bg'.($line++%2);
$group = sql_fetch("select * from {$g5['sms5_book_group_table']} where bg_no='{$res['bg_no']}'");
if ($group)
$bg_name = $group['bg_name'];
else
$bg_name = '없음';
if ($res['mb_id'])
$mb_id = get_sideview($res['mb_id'], $res['mb_id']);
else
$mb_id = '비회원';
$res['hs_log'] = str_replace($config['cf_icode_pw'], '**********', $res['hs_log']);
?>
<tr class="<?php echo $bg; ?>">
<td class="td_numsmall"><?php echo number_format($vnum--)?></td>
<td class="td_name"><?php echo $bg_name?></td>
<td class="td_mbname"><?php echo $res['hs_name']?></a></td>
<td class="td_mbid"><?php echo $mb_id?></td>
<td class="td_numbig"><?php echo $res['hs_hp']?></td>
<td class="td_datetime"><?php echo $res['hs_datetime']?></td>
<td class="td_boolean"><?php echo $res['hs_flag']?'성공':'실패'?></td>
<td>
<u>결과코드</u> : <?php echo $res['hs_code']?><br>
<u>로그</u> : <?php echo $res['hs_log']?><br>
<u>메모</u> : <?php echo $res['hs_memo']?>
</td>
<td class="td_mngsmall">
<?php if ($res['bk_no']) { ?>
<a href="./history_num.php?wr_id=<?php echo $res['wr_no']?>&amp;st=bk_no&amp;sv=<?php echo $res['bk_no']?>">내역</a>
<?php } else { ?>
<a href="./history_num.php?wr_id=<?php echo $res['wr_no']?>&amp;st=hs_hp&amp;sv=<?php echo $res['hs_hp']?>">내역</a>
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $spage, $total_spage, $_SERVER['PHP_SELF']."?wr_no=$wr_no&amp;wr_renum=$wr_renum&amp;page=$page&amp;st=$st&amp;sv=$sv&amp;sst=$sst&amp;ssv=$ssv&amp;spage="); ?>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 B

87
adm/sms_admin/install.php Normal file
View File

@ -0,0 +1,87 @@
<?php
include_once("./_common.php");
auth_check($auth[$sub_menu], 'r');
$g5['title'] = "SMS5 솔루션 설치";
$setup = $_POST['setup'];
include_once(G5_ADMIN_PATH.'/admin.head.php');
?>
<form name="hidden_form" method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
<input type="hidden" name="setup">
</form>
<?php
//SMS 설정 정보 테이블이 있는지 검사한다.
if( isset($g5['sms5_config_table']) && sql_query(" DESCRIBE {$g5['sms5_config_table']} ", false)) {
if(!$setup){
echo '<script>
var answer = confirm("이미 sms5가 설치되어 있습니다.새로 설치 할 경우 db 자료가 망실됩니다. 새로 설치하시겠습니까?");
if (answer){
document.hidden_form.setup.value = "1";
document.hidden_form.submit();
} else {
history.back();
}
</script>
';
exit;
}
}
?>
<div class="ins_inner">
<h2>SMS5 설치가 시작되었습니다.</h2>
<ol>
<li id="sms5_job_01">전체 테이블 생성중</li>
<li id="sms5_job_02">DB설정 중</li>
<li id="sms5_job_03"></li>
</ol>
<p><input type="button" id="sms5_btn_next" disabled value="SMS 기본설정 바로가기" onclick="location.href='config.php';"></p>
</div>
<?php
flush(); usleep(50000);
// 테이블 생성 ------------------------------------
$file = implode("", file("./sms5.sql"));
eval("\$file = \"$file\";");
$f = explode(";", $file);
for ($i=0; $i<count($f); $i++) {
if (trim($f[$i]) == "") continue;
mysql_query($f[$i]) or die(mysql_error());
}
// 테이블 생성 ------------------------------------
echo "<script>document.getElementById('sms5_job_01').innerHTML='전체 테이블 생성 완료';</script>";
flush(); usleep(50000);
$read_point = -1;
$write_point = 5;
$comment_point = 1;
$download_point = -20;
//-------------------------------------------------------------------------------------------------
// config 테이블 설정
$sql = " insert into {$g5['sms5_book_group_table']} set bg_name='미분류'";
mysql_query($sql) or die(mysql_error() . "<p>" . $sql);
echo "<script>document.getElementById('sms5_job_02').innerHTML='DB설정 완료';</script>";
flush(); usleep(50000);
//-------------------------------------------------------------------------------------------------
echo "<script>document.getElementById('sms5_job_03').innerHTML='* SMS 기본 설정을 변경해 주십시오.';</script>";
flush(); usleep(50000);
?>
<script>document.getElementById('sms5_btn_next').disabled = false;</script>
<script>document.getElementById('sms5_btn_next').focus();</script>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,63 @@
<?php
$sub_menu = "900200";
include_once("./_common.php");
auth_check($auth[$sub_menu], "r");
$g5['title'] = "회원정보 업데이트";
include_once(G5_ADMIN_PATH.'/admin.head.php');
?>
<div id="sms5_mbup">
<form name="mb_update_form" id="mb_update_form" action="./member_update_run.php" >
<div class="local_desc02 local_desc">
<p>
새로운 회원정보로 업데이트 합니다.<br>
실행 후 '완료' 메세지가 나오기 전에 프로그램의 실행을 중지하지 마십시오.
</p>
</div>
<div class="local_desc01 local_desc">
<p>
마지막 업데이트 일시 : <span id="datetime"><?php echo $sms5['cf_datetime']?></span> <br>
</p>
</div>
<div id="res_msg" class="local_desc01 local_desc">
</div>
<div class="btn_confirm01 btn_confirm">
<input type="submit" value="실행" class="btn_submit">
</div>
</form>
</div>
<script>
(function($){
$( "#mb_update_form" ).submit(function( e ) {
e.preventDefault();
$("#res_msg").html('업데이트 중입니다. 잠시만 기다려 주십시오...');
var params = { mtype : 'json' };
$.ajax({
url: $(this).attr("action"),
cache:false,
timeout : 30000,
dataType:"json",
data:params,
success: function(data) {
$("#datetime").html( data.datetime );
$("#res_msg").html( data.res_msg );
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
return false;
});
})(jQuery);
</script>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,118 @@
<?php
$sub_menu = "900200";
include_once("./_common.php");
@include_once(G5_PLUGIN_PATH."/sms5/JSON.php");
if( !function_exists('json_encode') ) {
function json_encode($data) {
$json = new Services_JSON();
return( $json->encode($data) );
}
}
auth_check($auth[$sub_menu], "w");
$count = 0;
$hp_yes = 0;
$hp_no = 0;
$hp_empty = 0;
$leave = 0;
$receipt = 0;
// 회원 데이터 마이그레이션
$qry = sql_query("select mb_id, mb_name, mb_hp, mb_sms, mb_leave_date from ".$g5['member_table']." order by mb_datetime");
while ($res = sql_fetch_array($qry))
{
if ($res['mb_leave_date'] != '')
$leave++;
else if ($res['mb_hp'] == '')
$hp_empty++;
else if (is_hp($res['mb_hp']))
$hp_yes++ ;
else
$hp_no++;
$hp = get_hp($res['mb_hp']);
if ($hp == '') $bk_receipt = 0; else $bk_receipt = $res['mb_sms'];
$field = "mb_id='{$res['mb_id']}', bk_name='{$res['mb_name']}', bk_hp='{$hp}', bk_receipt='{$bk_receipt}', bk_datetime='".G5_TIME_YMDHIS."'";
$res2 = sql_fetch("select * from {$g5['sms5_book_table']} where mb_id='{$res['mb_id']}'");
if ($res2) // 기존에 등록되어 있을 경우 업데이트
{
$res3 = sql_fetch("select count(*) as cnt from {$g5['sms5_book_table']} where mb_id='{$res2['mb_id']}'");
$mb_count = $res3['cnt'];
// 회원이 삭제되었다면 휴대폰번호 DB 에서도 삭제한다.
if ($res['mb_leave_date'])
{
sql_query("delete from {$g5['sms5_book_table']} where mb_id='{$res2['mb_id']}'");
$sql = "update {$g5['sms5_book_group_table']} set bg_count = bg_count - $mb_count, bg_member = bg_member - $mb_count";
if ($res2['bk_receipt'] == 1)
$sql .= ", bg_receipt = bg_receipt - $mb_count";
else
$sql .= ", bg_reject = bg_reject - $mb_count";
$sql .= " where bg_no='{$res2['bg_no']}'";
sql_query($sql);
}
else
{
if ($bk_receipt != $res2['bk_receipt']) {
if ($bk_receipt == 1)
$sql_sms = "bg_receipt = bg_receipt + $mb_count, bg_reject = bg_reject - $mb_count";
else
$sql_sms = "bg_receipt = bg_receipt - $mb_count, bg_reject = bg_reject + $mb_count";
sql_query("update {$g5['sms5_book_group_table']} set $sql_sms where bg_no='{$res2['bg_no']}'");
}
if ($bk_receipt) $receipt++;
sql_query("update {$g5['sms5_book_table']} set $field where mb_id='$res[mb_id]'");
}
}
else if ($res['mb_leave_date'] == '') // 기존에 등록되어 있지 않을 경우 추가 (삭제된 회원이 아닐 경우)
{
if ($bk_receipt == 1) {
$sql_sms = "bg_receipt = bg_receipt + 1";
$receipt++;
} else {
$sql_sms = "bg_reject = bg_reject + 1";
}
sql_query("insert into {$g5['sms5_book_table']} set $field, bg_no=1");
sql_query("update {$g5['sms5_book_group_table']} set bg_count = bg_count + 1, bg_member = bg_member + 1, $sql_sms where bg_no=1");
}
$count++;
}
sql_query("update {$g5['sms5_config_table']} set cf_datetime='".G5_TIME_YMDHIS."'");
$msg = '';
$msg .= '<p>회원정보를 휴대폰번호 DB로 업데이트 하였습니다.</p>';
$msg .= '<dl id="sms_mbup">';
$msg .= '<dt>총 회원 수</dt><dd>'.number_format($count).'명</dd>';
$msg .= '<dt>삭제된 회원</dt><dd>'.number_format($leave).'명</dd>';
$msg .= '<dt><span style="gray">휴대폰번호 없음</span></dt><dd>'.number_format($hp_empty).' 명</dd>';
$msg .= '<dt><span style="color:blue;">휴대폰번호 정상</span></dt><dd>'.number_format($hp_yes).' 명</span>&nbsp;';
$msg .= '(<span style="color:blue;">수신</span>'.number_format($receipt).' 명';
$msg .= ' / ';
$msg .= '<span style="color:red;">거부</span>'.number_format($hp_yes-$receipt).' 명)</dd>';
$msg .= '<dt><span style="color:red;">휴대폰번호 오류</span></dt><dd>'.number_format($hp_no).' 명</span></dd>';
$msg .= '</dl>';
$msg .= '<p>프로그램의 실행을 끝마치셔도 좋습니다.</p>';
if( $mtype == "json" ){
$json_msg = array();
$json_msg['datetime'] = G5_TIME_YMDHIS;
$json_msg['res_msg'] = $msg;
die( json_encode($json_msg) );
} else {
die( $msg );
}
?>

263
adm/sms_admin/num_book.php Normal file
View File

@ -0,0 +1,263 @@
<?php
$sub_menu = "900800";
include_once("./_common.php");
$page_size = 20;
$colspan = 9;
auth_check($auth[$sub_menu], "r");
$token = get_token();
$g5['title'] = "휴대폰번호 관리";
if (!$page) $page = 1;
if (is_numeric($bg_no))
$sql_group = " and bg_no='$bg_no' ";
else
$sql_group = "";
if ($st == 'all') {
$sql_search = "and (bk_name like '%{$sv}%' or bk_hp like '%{$sv}%')";
} else if ($st == 'name') {
$sql_search = "and bk_name like '%{$sv}%'";
} else if ($st == 'hp') {
$sql_search = "and bk_hp like '%{$sv}%'";
} else {
$sql_search = '';
}
if ($ap > 0)
$sql_korean = korean_index('bk_name', $ap-1);
else {
$sql_korean = '';
$ap = 0;
}
if ($no_hp == 'yes') {
set_cookie('cookie_no_hp', 'yes', 60*60*24*365);
$no_hp_checked = 'checked';
} else if ($no_hp == 'no') {
set_cookie('cookie_no_hp', '', 0);
$no_hp_checked = '';
} else {
if (get_cookie('cookie_no_hp') == 'yes')
$no_hp_checked = 'checked';
else
$no_hp_checked = '';
}
if ($no_hp_checked == 'checked')
$sql_no_hp = "and bk_hp <> ''";
$total_res = sql_fetch("select count(*) as cnt from {$g5['sms5_book_table']} where 1 $sql_group $sql_search $sql_korean $sql_no_hp");
$total_count = $total_res[cnt];
$total_page = (int)($total_count/$page_size) + ($total_count%$page_size==0 ? 0 : 1);
$page_start = $page_size * ( $page - 1 );
$vnum = $total_count - (($page-1) * $page_size);
$res = sql_fetch("select count(*) as cnt from {$g5['sms5_book_table']} where bk_receipt=1 $sql_group $sql_search $sql_korean $sql_no_hp");
$receipt_count = $res['cnt'];
$reject_count = $total_count - $receipt_count;
$res = sql_fetch("select count(*) as cnt from {$g5['sms5_book_table']} where mb_id='' $sql_group $sql_search $sql_korean $sql_no_hp");
$no_member_count = $res['cnt'];
$member_count = $total_count - $no_member_count;
$no_group = sql_fetch("select * from {$g5['sms5_book_group_table']} where bg_no = 1");
$group = array();
$qry = sql_query("select * from {$g5['sms5_book_group_table']} where bg_no>1 order by bg_name");
while ($res = sql_fetch_array($qry)) array_push($group, $res);
include_once(G5_ADMIN_PATH.'/admin.head.php');
?>
<script>
function book_all_checked(chk)
{
if (chk) {
jQuery('[name="bk_no[]"]').attr('checked', true);
} else {
jQuery('[name="bk_no[]"]').attr('checked', false);
}
}
function no_hp_click(val)
{
var url = './num_book.php?bg_no=<?php echo $bg_no?>&st=<?php echo $st?>&sv=<?php echo $sv?>';
if (val == true)
location.href = url + '&no_hp=yes';
else
location.href = url + '&no_hp=no';
}
</script>
<div class="local_ov01 local_ov">
<span class="ov_listall">회원정보 최근 업데이트 <?php echo $sms5['cf_datetime']?></span>
<span class="ov_listall">총 건수 <?php echo number_format($total_count)?>명</span>
<span class="ov_listall">회원 <?php echo number_format($member_count)?>명</span>
<span class="ov_listall">비회원 <?php echo number_format($no_member_count)?>명</span>
<span class="ov_listall">수신 <?php echo number_format($receipt_count)?>명</span>
<span class="ov_listall">거부 <?php echo number_format($reject_count)?>명</span>
</div>
<form name="search_form" method="get" action="<?php echo $_SERVER['PHP_SELF']?>" class="local_sch01 local_sch">
<input type="hidden" name="bg_no" value="<?php echo $bg_no?>" >
<label for="st" class="sound_only">검색대상</label>
<select name="st" id="st">
<option value="all" <?php echo $st=='all'?'selected':''?>>이름 + 휴대폰번호</option>
<option value="name" <?php echo $st=='name'?'selected':''?>>이름</option>
<option value="hp" <?php echo $st=='hp'?'selected':''?>>휴대폰번호</option>
</select>
<label for="sv" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="sv" value="<?php echo $sv?>" id="sv" required class="frm_input required">
<input type="submit" value="검색" class="btn_submit">
</form>
<form name="search_form" class="local_sch01 local_sch">
<label for="bg_no" class="sound_only">그룹명</label>
<select name="bg_no" id="bg_no" onchange="location.href='<?php echo $_SERVER['PHP_SELF']?>?bg_no='+this.value;">
<option value="" <?php echo $bg_no?'':'selected'?>> 전체 </option>
<option value="<?php echo $no_group['bg_no']?>" <?php echo $bg_no==$no_group['bg_no']?'selected':''?>> <?php echo $no_group['bg_name']?> (<?php echo number_format($no_group['bg_count'])?> 명) </option>
<?php for($i=0; $i<count($group); $i++) {?>
<option value="<?php echo $group[$i]['bg_no']?>" <?php echo ($bg_no==$group[$i]['bg_no'])?'selected':''?>> <?php echo $group[$i]['bg_name']?> (<?php echo number_format($group[$i]['bg_count'])?> 명) </option>
<?php } ?>
</select>
<input type="checkbox" name="no_hp" id="no_hp" <?php echo $no_hp_checked?> onclick="no_hp_click(this.checked)">
<label for="no_hp"> 휴대폰 소유자만 보기</label>
</form>
<div class="btn_add01 btn_add">
<a href="./num_book_write.php?page=<?php echo $page?>&amp;bg_no=<?php echo $bg_no?>">번호추가</a>
</div>
<form name="hp_manage_list" id="hp_manage_list" method="post" action="./num_book_multi_update.php" onsubmit="return hplist_submit(this);" >
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="hidden" name="sw" value="">
<input type="hidden" name="atype" value="del">
<input type="hidden" name="str_query" value="<?php echo $_SERVER['QUERY_STRING']?>" >
<div class="tbl_head01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?> 목록</caption>
<thead>
<tr>
<th scope="col">
<label for="chk_all" class="sound_only">현재 페이지 전체선택</label>
<input type="checkbox" id="chk_all" onclick="book_all_checked(this.checked)">
</th>
<th scope="col">번호</th>
<th scope="col">그룹</th>
<th scope="col">이름</th>
<th scope="col">휴대폰</th>
<th scope="col">수신</th>
<th scope="col">아이디</th>
<th scope="col">업데이트</th>
<th scope="col">관리</th>
</tr>
</thead>
<tbody>
<?php if (!$total_count) { ?>
<tr>
<td colspan="<?php echo $colspan?>" class="empty_table">데이터가 없습니다.</td>
</tr>
<?php
}
$line = 0;
$qry = sql_query("select * from {$g5['sms5_book_table']} where 1 $sql_group $sql_search $sql_korean $sql_no_hp order by bk_no desc limit $page_start, $page_size");
while($res = sql_fetch_array($qry))
{
$bg = 'bg'.($line++%2);
$tmp = sql_fetch("select bg_name from {$g5['sms5_book_group_table']} where bg_no='{$res['bg_no']}'");
$group_name = $tmp['bg_name'];
?>
<tr class="<?php echo $bg; ?>">
<td class="td_chk">
<label for="bk_no_<?php echo $i; ?>" class="sound_only"><?php echo $group_name?>의 <?php echo $res['bk_name']?></label>
<input type="checkbox" name="bk_no[]" value="<?php echo $res['bk_no']?>" id="bk_no_<?php echo $i; ?>">
</td>
<td class="td_num"><?php echo number_format($vnum--)?></td>
<td><?php echo $group_name?></td>
<td class="td_mbname"><?php echo $res['bk_name']?></td>
<td class="td_numbig"><?php echo $res['bk_hp']?></td>
<td class="td_boolean"><?php echo $res['bk_receipt'] ? '<font color=blue>수신</font>' : '<font color=red>거부</font>'?></td>
<td class="td_mbid"><?php echo $res['mb_id'] ? $res['mb_id'] : '비회원'?></td>
<td class="td_datetime"><?php echo $res['bk_datetime']?></td>
<td class="td_mng">
<a href="./num_book_write.php?w=u&amp;bk_no=<?php echo $res['bk_no']?>&amp;page=<?php echo $page?>&amp;bg_no=<?php echo $bg_no?>&amp;st=<?php echo $st?>&amp;sv=<?php echo $sv?>&amp;ap=<?php echo $ap?>">수정</a>
<a href="./sms_write.php?bk_no=<?php echo $res['bk_no']?>">보내기</a>
<a href="./history_num.php?st=hs_hp&amp;sv=<?php echo $res['bk_hp']?>">내역</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="btn_list01 btn_list">
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value">
<input type="submit" name="act_button" value="수신허용" onclick="document.pressed=this.value">
<input type="submit" name="act_button" value="수신거부" onclick="document.pressed=this.value">
<input type="submit" name="act_button" value="선택이동" onclick="document.pressed=this.value">
<input type="submit" name="act_button" value="선택복사" onclick="document.pressed=this.value">
</div>
</form>
<script>
function hplist_submit(f){
if (!is_checked("bk_no[]")) {
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
return false;
}
if(document.pressed == "선택이동") {
select_copy("move", f);
return;
}
if(document.pressed == "선택복사") {
select_copy("copy", f);
return;
}
if(document.pressed == "선택삭제") {
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
return false;
}
}
if(document.pressed == "수신허용") {
f.atype.value="receipt";
}
if(document.pressed == "수신거부") {
f.atype.value="reject";
}
return true;
}
// 선택한 이모티콘 그룹 이동
function select_copy(sw, f) {
if( !f ){
var f = document.emoticonlist;
}
if (sw == "copy")
str = "복사";
else
str = "이동";
var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1");
f.sw.value = sw;
f.target = "move";
f.action = "./num_book_move.php";
f.submit();
}
</script>
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, $_SERVER['PHP_SELF']."?bg_no=$bg_no&amp;st=$st&amp;sv=$sv&amp;ap=$ap&amp;page="); ?>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,158 @@
<?php
$sub_menu = "900900";
include_once("./_common.php");
auth_check($auth[$sub_menu], "r");
$g5['title'] = "휴대폰번호 파일";
$no_group = sql_fetch("select * from {$g5['sms5_book_group_table']} where bg_no = 1");
$group = array();
$qry = sql_query("select * from {$g5['sms5_book_group_table']} where bg_no > 1 order by bg_name");
while ($res = sql_fetch_array($qry)) array_push($group, $res);
include_once(G5_ADMIN_PATH.'/admin.head.php');
?>
<h2>파일 업로드</h2>
<div class="local_desc01 local_desc">
<p>
엑셀에 저장된 휴대폰번호 목록을 데이터베이스에 저장할 수 있습니다.
</p>
<p>
엑셀에는 이름과 휴대폰번호 두개만 저장해주세요. 첫번째 라인부터 저장됩니다.<br>
※ 휴대폰번호에 하이픈(-)은 포함되어도 되고 포함되지 않아도 됩니다.
</p>
<p>
엑셀파일은 XLS( Excel 97 - 2003 통합 문서 ) 또는 CSV형식만 업로드 할수 있습니다. (xlsx 불가)<br>
<strong>CSV 저장방법 : 파일 > 다른 이름으로 저장 > 파일형식 : CSV (쉼표로 분리) (*.CSV)</strong>
</p>
<p>
이 작업을 실행하기 전에 <a href="<?php echo G5_SMS5_ADMIN_URL; ?>/member_update.php" target="_blank">회원정보업데이트</a>를 먼저 실행해주세요.
</p>
</div>
<form name="upload_form" method="post" enctype="multipart/form-data" id="sms5_fileup_frm">
<div>
<label for="upload_bg_no">그룹선택</label>
<select name="upload_bg_no" id="upload_bg_no" >
<option value=""></option>
<option value="1"> <?php echo $no_group['bg_name']?> (<?php echo number_format($no_group['bg_count'])?>) </option>
<?php for ($i=0; $i<count($group); $i++) { ?>
<option value="<?php echo $group[$i]['bg_no']?>"> <?php echo $group[$i]['bg_name']?> (<?php echo number_format($group[$i]['bg_count'])?>) </option>
<?php } ?>
</select>
</div>
<div id="sms5_fileup">
<label for="csv">파일선택</label>
<input type="file" name="csv" id="csv" onchange="document.getElementById('upload_info').style.display='none';">
<span id="upload_button">
<input type="button" value="파일전송" onclick="upload();" class="btn_submit">
</span>
<span id="uploading" class="sms_fileup_hide">
파일을 업로드 중입니다. 잠시만 기다려주세요.
</span>
<div id="upload_info" class="sms_fileup_hide"></div>
<div id="register" class="sch_last sms_fileup_hide">
휴대폰번호를 DB에 저장중 입니다. 잠시만 기다려주세요.
</div>
</div>
</form>
<h2>파일 다운로드</h2>
<div class="local_desc01 local_desc">
<p>
저장된 휴대폰번호 목록을 엑셀(xls) 파일로 다운로드 할 수 있습니다.<br>
다운로드 할 휴대폰번호 그룹을 선택해주세요.
</p>
</div>
<div class="local_sch01 local_sch">
<p>
<input type="checkbox" value="1" id="no_hp">
<label for="no_hp">휴대폰 번호 없는 회원 포함</label><br>
<input type="checkbox" value="1" id="hyphen">
<label for="hyphen">하이픈 '―' 포함</label>
</p>
<label for="download_bg_no">그룹선택</label>
<select name="download_bg_no" id="download_bg_no" >
<option value=""> </option>
<option value="all"> 전체 </option>
<option value="1"> <?php echo $no_group['bg_name']?> (<?php echo number_format($no_group['bg_count'])?>) </option>
<?php for ($i=0; $i<count($group); $i++) { ?>
<option value="<?php echo $group[$i]['bg_no']?>"> <?php echo $group[$i]['bg_name']?> (<?php echo number_format($group[$i]['bg_count'])?>) </option>
<?php } ?>
</select>
<button type="button" onclick="download()" class="btn_submit">다운로드</button>
</div>
<script>
function upload(w)
{
var f = document.upload_form;
if (typeof w == 'undefined') {
document.getElementById('upload_button').style.display = 'none';
document.getElementById('uploading').style.display = 'inline';
document.getElementById('upload_info').style.display = 'none';
f.action = 'num_book_file_upload.php?confirm=1';
} else {
document.getElementById('upload_button').style.display = 'none';
document.getElementById('upload_info').style.display = 'none';
document.getElementById('register').style.display = 'block';
f.action = 'num_book_file_upload.php';
}
(function($){
if(!document.getElementById("fileupload_fr")){
var i = document.createElement('iframe');
i.setAttribute('id', 'fileupload_fr');
i.setAttribute('name', 'fileupload_fr');
i.style.display = 'none';
document.body.appendChild(i);
}
f.target = 'fileupload_fr';
f.submit();
})(jQuery);
}
function download()
{
var bg_no = document.getElementById('download_bg_no');
var no_hp = document.getElementById('no_hp');
var hyphen = document.getElementById('hyphen');
var par = '';
if (!bg_no.value.length) {
alert('다운로드 할 휴대폰번호 그룹을 선택해주세요.');
return;
}
if (no_hp.checked) no_hp = 1; else no_hp = 0;
if (hyphen.checked) hyphen = 1; else hyphen = 0;
par += '?bg_no=' + bg_no.value;
par += '&amp;no_hp=' + no_hp;
par += '&amp;hyphen=' + hyphen;
(function($){
if(!document.getElementById("fileupload_fr")){
var i = document.createElement('iframe');
i.setAttribute('id', 'fileupload_fr');
i.setAttribute('name', 'fileupload_fr');
i.style.display = 'none';
document.body.appendChild(i);
}
fileupload_fr.location.href = './num_book_file_download.php' + par;
})(jQuery);
}
</script>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,67 @@
<?php
$sub_menu = "900900";
include_once("./_common.php");
auth_check($auth[$sub_menu], "r");
if ($bg_no != 'all' && $bg_no < 1)
alert_just('다운로드 할 휴대폰번호 그룹을 선택해주세요.');
if ($bg_no == 'all') $sql_bg = ""; else $sql_bg = "and bg_no='$bg_no'";
if ($no_hp) $sql_hp = ""; else $sql_hp = "and bk_hp<>''";
$sql = "select count(*) as cnt from {$g5['sms5_book_table']} where 1 $sql_bg $sql_hp order by bk_name";
$total = sql_fetch($sql);
if (!$total['cnt']) alert_just('데이터가 없습니다.');
$qry = sql_query("select * from {$g5['sms5_book_table']} where 1 $sql_bg $sql_hp order by bk_name");
/*================================================================================
php_writeexcel http://www.bettina-attack.de/jonny/view.php/projects/php_writeexcel/
=================================================================================*/
include_once(G5_LIB_PATH.'/Excel/php_writeexcel/class.writeexcel_workbook.inc.php');
include_once(G5_LIB_PATH.'/Excel/php_writeexcel/class.writeexcel_worksheet.inc.php');
$fname = tempnam(G5_DATA_PATH, "tmp.xls");
$workbook = new writeexcel_workbook($fname);
$worksheet = $workbook->addworksheet();
$num2_format =& $workbook->addformat(array(num_format => '\0#'));
// Put Excel data
$data = array('이름', '전화번호');
$data = array_map('iconv_euckr', $data);
$col = 0;
foreach($data as $cell) {
$worksheet->write(0, $col++, $cell);
}
for($i=1; $res=sql_fetch_array($qry); $i++)
{
$res = array_map('iconv_euckr', $res);
$hp = get_hp($res['bk_hp'], $hyphen);
if ($no_hp && $res['bk_hp'] != '' && !$hp) continue;
$worksheet->write($i, 0, $res['bk_name']);
$worksheet->write($i, 1, $hp, $num2_format);
}
$workbook->close();
$filename = "휴대폰번호목록-".date("ymd", time()).".xls";
if( is_ie() ) $filename = utf2euc($filename);
header("Content-Type: application/x-msexcel; name=".$filename);
header("Content-Disposition: inline; filename=".$filename);
$fh=fopen($fname, "rb");
fpassthru($fh);
unlink($fname);
exit;
?>

View File

@ -0,0 +1,166 @@
<?php
$sub_menu = "900900";
include_once("./_common.php");
auth_check($auth[$sub_menu], "w");
if (!$upload_bg_no)
alert_after('그룹을 선택해주세요.');
$bg_no = $upload_bg_no;
if (!$_FILES['csv']['size'])
alert_after('파일을 선택해주세요.');
$file = $_FILES['csv']['tmp_name'];
$filename = $_FILES['csv']['name'];
$pos = strrpos($filename, '.');
$ext = strtolower(substr($filename, $pos, strlen($filename)));
switch ($ext) {
case '.csv' :
$data = file($file);
$num_rows = count($data) + 1;
$csv = array();
foreach ($data as $item)
{
$item = explode(',', $item);
$item[1] = get_hp($item[1]);
array_push($csv, $item);
if (count($item) < 2)
alert_after('올바른 파일이 아닙니다.');
}
break;
case '.xls' :
include_once(G5_LIB_PATH.'/Excel/reader.php');
$data = new Spreadsheet_Excel_Reader();
// Set output Encoding.
$data->setOutputEncoding('UTF-8');
$data->read($file);
$num_rows = $data->sheets[0]['numRows'];
break;
default :
alert_after('xls파일과 csv파일만 허용합니다.');
}
$counter = 0;
$success = 0;
$failure = 0;
$inner_overlap = 0;
$overlap = 0;
$arr_hp = array();
$encode = array('ASCII','UTF-8','EUC-KR');
for ($i = 1; $i <= $num_rows; $i++) {
$counter++;
$j = 1;
switch ($ext) {
case '.csv' :
$name = $csv[$i][0];
$str_encode = @mb_detect_encoding($name, $encode);
if( $str_encode == "EUC-KR" ){
$name = iconv_utf8( $name );
}
$name = addslashes($name);
$hp = addslashes($csv[$i][1]);
break;
case '.xls' :
$name = addslashes($data->sheets[0]['cells'][$i][$j++]);
$str_encode = @mb_detect_encoding($name, $encode);
if( $str_encode == "EUC-KR" ){
$name = iconv_utf8( $name );
}
$hp = addslashes(get_hp($data->sheets[0]['cells'][$i][$j++]));
break;
}
if (!(strlen($name)&&$hp))
{
$failure++;
} else {
if (in_array($hp, $arr_hp))
{
$inner_overlap++;
} else {
array_push($arr_hp, $hp);
$res = sql_fetch("select * from {$g5['sms5_book_table']} where bk_hp='$hp'");
if ($res)
{
$overlap++;
}
else if (!$confirm && $hp)
{
sql_query("insert into {$g5['sms5_book_table']} set bg_no='$bg_no', bk_name='$name', bk_hp='$hp', bk_receipt=1, bk_datetime='".G5_TIME_YMDHIS."'");
sql_query("update {$g5['sms5_book_group_table']} set bg_count = bg_count + 1, bg_nomember = bg_nomember + 1, bg_receipt = bg_receipt + 1 where bg_no='$bg_no'");
$success++;
}
}
}
if ($inner_overlap > 0) $overlap += $inner_overlap;
}
unlink($_FILES['csv']['tmp_name']);
if ($success){
$sql = "select count(*) as cnt from {$g5['sms5_book_table']} where bg_no='$bg_no'";
$total = sql_fetch($sql);
sql_query("update {$g5['sms5_book_group_table']} set bg_count = ".$total['cnt']." where bg_no='$bg_no'");
}
$result = $counter - $failure - $overlap;
echo "<script>
var info = parent.document.getElementById('upload_info');
var html = '';
html += \"<ul id=\\\"upload_result\\\"><li>총 건수 : ".number_format($counter)." 건</li>\";
html += \"<li class=\\\"sms5_txt_fail\\\">등록불가 ".number_format($failure)." 건</li>\";
html += \"<li>중복번호 ".number_format($overlap)." 건<div id=\\\"overlap\\\" class=\\\"local_desc01 local_desc\\\"></div></li>\";";
if ($result)
{
if ($confirm) {
echo "html += \"<li class=\\\"sms5_txt_success\\\">등록가능 ".number_format($result)."\";";
echo "html += \"<br><button type=\\\"button\\\" id=\\\"btn_fileup\\\" class=\\\"btn_submit\\\" onclick=\\\"upload(1)\\\">등록하기</button>\";";
}
else
echo "html += \"<br><span class=\\\"sms5_txt_success\\\">총 ".number_format($success)." 건의 휴대폰번호 등록을 완료하였습니다.</span>\";";
}
else
echo "html += \"<br><span class=\\\"sms5_txt_fail\\\">등록할 수 없습니다.</font>\";";
echo "html += \"</li></ul>\";";
echo "
parent.document.getElementById('upload_button').style.display = 'inline';
parent.document.getElementById('uploading').style.display = 'none';
parent.document.getElementById('register').style.display = 'none';
info.style.display = 'block';
info.innerHTML = html;
parent.document.getElementById('overlap').innerHTML = '<p><b>중복번호 목록</b><br>';";
for ($i=0; $i<count($arr_hp); $i++){
echo "parent.document.getElementById('overlap').innerHTML += '".$arr_hp[$i]."<br>';\n";
}
echo "parent.document.getElementById('overlap').innerHTML += '</p>';\n";
echo "</script>";
function alert_after($str) {
echo "<script>
parent.document.getElementById('upload_button').style.display = 'inline';
parent.document.getElementById('uploading').style.display = 'none';
parent.document.getElementById('register').style.display = 'none';
parent.document.getElementById('upload_info').style.display = 'none';
</script>";
alert_just($str);
}
?>

View File

@ -0,0 +1,128 @@
<?php
$sub_menu = "900600";
include_once('./_common.php');
$inputbox_type="checkbox";
if ($sw == 'move'){
$act = '이동';
} else if ($sw == 'copy') {
$act = '복사';
} else {
alert('sw 값이 제대로 넘어오지 않았습니다.');
}
auth_check($auth[$sub_menu], "r");
$g5['title'] = '번호그룹 ' . $act;
include_once(G5_PATH.'/head.sub.php');
$bk_no_list = implode(',', $_POST['bk_no']);
$sql = " select * from {$g5['sms5_book_group_table']} order by bg_no ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$list[$i] = $row;
}
?>
<div id="copymove" class="new_win">
<h1 id="win_title"><?php echo $g5['title'] ?></h1>
<form name="fboardmoveall" method="post" action="./number_move_update.php" onsubmit="return fboardmoveall_submit(this);">
<input type="hidden" name="sw" value="<?php echo $sw ?>">
<input type="hidden" name="bk_no_list" value="<?php echo $bk_no_list ?>">
<input type="hidden" name="act" value="<?php echo $act ?>">
<input type="hidden" name="url" value="<?php echo $_SERVER['HTTP_REFERER'] ?>">
<div class="tbl_head01 tbl_wrap">
<table>
<caption><?php echo $act ?>할 그룹을 한개 이상 선택하여 주십시오.</caption>
<thead>
<tr>
<th scope="col">
<?php if ( $inputbox_type == "checkbox" ){ //복사일때만 ?>
<label for="chkall" class="sound_only">그룹 전체</label>
<input type="checkbox" id="chkall" onclick="if (this.checked) all_checked(true); else all_checked(false);">
<?php } ?>
</th>
<th scope="col">그룹</th>
</tr>
</thead>
<tbody>
<?php for ($i=0; $i<count($list); $i++) { ?>
<tr>
<td class="td_chk">
<label for="chk<?php echo $i ?>" class="sound_only"><?php echo $list[$i]['bg_name'] ?></label>
<input type="<?php echo $inputbox_type; ?>" value="<?php echo $list[$i]['bg_no'] ?>" id="chk<?php echo $i ?>" name="chk_bg_no[]">
</td>
<td>
<label for="chk<?php echo $i ?>">
<?php echo $list[$i]['bg_name'] ?>
</label>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="win_btn">
<input type="submit" value="<?php echo $act ?>" id="btn_submit" class="btn_submit">
<button type="button" class="btn_cancel">창닫기</button>
</div>
</form>
</div>
<script>
(function($) {
$(".win_btn button").click(function(e) {
window.close();
return false;
});
})(jQuery);
function all_checked(sw) {
var f = document.fboardmoveall;
for (var i=0; i<f.length; i++) {
if (f.elements[i].name == "chk_bg_no[]")
f.elements[i].checked = sw;
}
}
function fboardmoveall_submit(f)
{
var check = false;
if (typeof(f.elements['chk_bg_no[]']) == 'undefined')
;
else {
if (typeof(f.elements['chk_bg_no[]'].length) == 'undefined') {
if (f.elements['chk_bg_no[]'].checked)
check = true;
} else {
for (i=0; i<f.elements['chk_bg_no[]'].length; i++) {
if (f.elements['chk_bg_no[]'][i].checked) {
check = true;
break;
}
}
}
}
if (!check) {
alert('이모티콘을 '+f.act.value+'할 그룹을 한개 이상 선택해 주십시오.');
return false;
}
document.getElementById('btn_submit').disabled = true;
return true;
}
</script>
<?php
include_once(G5_PATH.'/tail.sub.php');
?>

View File

@ -0,0 +1,63 @@
<?php
$sub_menu = "900800";
include_once("./_common.php");
auth_check($auth[$sub_menu], "w");
$g5['title'] = "전화번호부";
for ($i=0; $i<count($_POST['bk_no']); $i++)
{
$bk_no = $_POST['bk_no'][$i];
if (!trim($bk_no)) continue;
$res = sql_fetch("select * from {$g5['sms5_book_table']} where bk_no='$bk_no'");
if (!$res) continue;
if ($atype == 'reject') // 수신거부
{
sql_query("update {$g5['sms5_book_table']} set bk_receipt=0 where bk_no='$bk_no'");
if ($res['mb_id'])
sql_query("update {$g5['member_table']} set mb_sms=0 where mb_id='{$res['mb_id']}'");
if ($res['bk_receipt'] == 1)
sql_query("update {$g5['sms5_book_group_table']} set bg_receipt= case bg_receipt when 0 then 0 else bg_reject - 1 end, bg_reject=bg_reject+1 where bg_no='{$res['bg_no']}'");
}
else if ($atype == 'receipt') // 수신허용
{
sql_query("update {$g5['sms5_book_table']} set bk_receipt=1 where bk_no='$bk_no'");
if ($res['mb_id'])
sql_query("update {$g5['member_table']} set mb_sms=1 where mb_id='{$res['mb_id']}'");
if ($res['bk_receipt'] == 0)
sql_query("update {$g5['sms5_book_group_table']} set bg_receipt=bg_receipt+1, bg_reject= case bg_reject when 0 then 0 else bg_reject - 1 end where bg_no='{$res['bg_no']}'");
}
else if ($atype == 'del') // 삭제
{
sql_query("delete from {$g5['sms5_book_table']} where bk_no='$bk_no'");
if ($res['bk_receipt'] == 1) $bg_sms = 'bg_receipt'; else $bg_sms = 'bg_reject';
if ($res['mb_id']) $bg_mb = 'bg_member'; else $bg_mb = 'bg_nomember';
sql_query("update {$g5['sms5_book_group_table']} set $bg_sms = case $bg_sms when 0 then 0 else $bg_sms - 1 end , $bg_mb = case $bg_mb when 0 then 0 else $bg_mb - 1 end, bg_count = case bg_count when 0 then 0 else bg_count - 1 end where bg_no='{$res['bg_no']}'");
/*
if (!$res['mb_id']) {
sql_query("delete from {$g5['sms5_book_table']} where bk_no='$bk_no'");
sql_query("update {$g5['sms5_book_group_table']} set bg_count = bg_count - 1 where bg_no='{$res['bg_no']}'");
if ($res['bk_receipt'] == 1)
sql_query("update {$g5['sms5_book_group_table']} set bg_receipt = bg_receipt - 1, bg_count = bg_count - 1 where bg_no='{$res['bg_no']'}");
else
sql_query("update {$g5['sms5_book_group_table']} set bg_reject = bg_reject - 1, bg_count = bg_count - 1 where bg_no='{$res['bg_no']}'");
}
*/
}
}
if( $str_query ){
$str_query = '?'.$str_query;
}
goto_url('./num_book.php'.$str_query);
?>

View File

@ -0,0 +1,137 @@
<?php
$sub_menu = "900800";
include_once("./_common.php");
auth_check($auth[$sub_menu], "w");
$g5['title'] = "휴대폰번호 업데이트";
$g5['sms5_demo'] = 0;
$is_hp_exist = false;
$bk_hp = get_hp($bk_hp);
if ($w=='u') // 업데이트
{
if (!$bg_no) $bg_no = 0;
if (!$bk_receipt) $bk_receipt = 0; else $bk_receipt = 1;
if (!strlen(trim($bk_name)))
alert('이름을 입력해주세요');
if ($bk_hp == '')
alert('휴대폰번호만 입력 가능합니다.');
/*
$res = sql_fetch("select * from {$g5['sms5_book_table']} where bk_no<>'$bk_no' and bk_hp='$bk_hp'");
if ($res)
alert('같은 번호가 존재합니다.');
*/
$res = sql_fetch("select * from {$g5['sms5_book_table']} where bk_no='$bk_no'");
if (!$res)
alert('존재하지 않는 데이터 입니다.');
if ($bg_no != $res['bg_no']) {
if ($res['mb_id']) $mem = "bg_member"; else $mem = "bg_nomember";
if ($res['bk_receipt'] == 1) $sms = "bg_receipt"; else $sms = "bg_reject";
sql_query("update {$g5['sms5_book_group_table']} set bg_count = bg_count - 1, $mem = $mem - 1, $sms = $sms - 1 where bg_no='{$res['bg_no']}'");
sql_query("update {$g5['sms5_book_group_table']} set bg_count = bg_count + 1, $mem = $mem + 1, $sms = $sms + 1 where bg_no='$bg_no'");
}
if ($bk_receipt != $res['bk_receipt']) {
if ($bk_receipt == 1)
sql_query("update {$g5['sms5_book_group_table']} set bg_receipt = bg_receipt + 1, bg_reject = bg_reject - 1 where bg_no='$bg_no'");
else
sql_query("update {$g5['sms5_book_group_table']} set bg_receipt = bg_receipt - 1, bg_reject = bg_reject + 1 where bg_no='$bg_no'");
}
sql_query("update {$g5['sms5_book_table']} set bg_no='$bg_no', bk_name='$bk_name', bk_hp='$bk_hp', bk_receipt='$bk_receipt', bk_datetime='".G5_TIME_YMDHIS."', bk_memo='$bk_memo' where bk_no='$bk_no'");
if ($res['mb_id']){ //만약에 mb_id가 있다면...
// 휴대폰번호 중복체크
$sql = " select mb_id from {$g5['member_table']} where mb_id <> '{$res['mb_id']}' and mb_hp = '{$bk_hp}' ";
$mb_hp_exist = sql_fetch($sql);
if ($mb_hp_exist['mb_id']) { //중복된 회원 휴대폰번호가 있다면
$is_hp_exist = true;
} else {
sql_query("update {$g5['member_table']} set mb_name='$bk_name', mb_hp='$bk_hp', mb_sms='$bk_receipt' where mb_id='{$res['mb_id']}'", false);
}
}
$get_bg_no = $bg_no;
$go_url = './num_book_write.php?bk_no='.$bk_no.'&w='.$w.'&page='.$page;
if( $is_hp_exist ){ //중복된 회원 휴대폰번호가 있다면
//alert( "중복된 회원 휴대폰번호가 있어서 회원정보에는 반영되지 않았습니다.", $go_url );
goto_url($go_url);
} else {
goto_url($go_url);
}
exit;
}
else if ($w=='d') // 삭제
{
if (!is_numeric($bk_no))
alert('고유번호가 없습니다.');
$res = sql_fetch("select * from {$g5['sms5_book_table']} where bk_no='$bk_no'");
if (!$res)
alert('존재하지 않는 데이터 입니다.');
if ($res['bk_receipt'] == 1) $bg_sms = 'bg_receipt'; else $bg_sms = 'bg_reject';
if ($res['mb_id']) $bg_mb = 'bg_member'; else $bg_mb = 'bg_nomember';
sql_query("delete from {$g5['sms5_book_table']} where bk_no='$bk_no'");
sql_query("update {$g5['sms5_book_group_table']} set bg_count = bg_count - 1, $bg_mb = $bg_mb - 1, $bg_sms = $bg_sms - 1 where bg_no = '{$res['bg_no']}'");
/*
if (!is_numeric($bk_no))
alert('고유번호가 없습니다.');
$res = sql_fetch("select * from $g5[sms5_book_table] where bk_no='$bk_no'");
if (!$res)
alert('존재하지 않는 데이터 입니다.');
if (!$res[mb_id])
{
if ($res[receipt] == 1)
$sql_sms = "bg_receipt = bg_receipt - 1";
else
$sql_sms = "bg_reject = bg_reject - 1";
sql_query("delete from $g5[sms5_book_table] where bk_no='$bk_no'");
sql_query("update $g5[sms5_book_group_table] set bg_count = bg_count - 1, bg_nomember = bg_nomember - 1, $sql_sms where bg_no = '$res[bg_no]'");
}
else
alert("회원은 삭제할 수 없습니다.\\n\\n회원관리 메뉴에서 삭제한 후\\n\\n회원정보업데이트 메뉴를 실행 해주세요.");
*/
}
else // 등록
{
if (!$bg_no) $bg_no = 1;
if (!$bk_receipt) $bk_receipt = 0; else $bk_receipt = 1;
if (!strlen(trim($bk_name)))
alert('이름을 입력해주세요');
if ($bk_hp == '')
alert('휴대폰번호만 입력 가능합니다.');
$res = sql_fetch("select * from {$g5['sms5_book_table']} where bk_hp='$bk_hp'");
if ($res)
alert('같은 번호가 존재합니다.');
if ($bk_receipt == 1)
$sql_sms = "bg_receipt = bg_receipt + 1";
else
$sql_sms = "bg_reject = bg_reject + 1";
sql_query("insert into {$g5['sms5_book_table']} set bg_no='$bg_no', bk_name='$bk_name', bk_hp='$bk_hp', bk_receipt='$bk_receipt', bk_datetime='".G5_TIME_YMDHIS."', bk_memo='$bk_memo'");
sql_query("update {$g5['sms5_book_group_table']} set bg_count = bg_count + 1, bg_nomember = bg_nomember + 1, $sql_sms where bg_no = '$bg_no'");
$get_bg_no = $bg_no;
}
$go_url = './num_book.php?page='.$page.'&amp;bg_no='.$get_bg_no.'&amp;ap='.$ap;
goto_url($go_url);
?>

View File

@ -0,0 +1,216 @@
<?php
$sub_menu = "900800";
include_once("./_common.php");
$colspan = 4;
auth_check($auth[$sub_menu], "r");
$g5['title'] = "휴대폰번호 ";
$exist_hplist = array();
if ($w == 'u' && is_numeric($bk_no)) {
$write = sql_fetch("select * from {$g5['sms5_book_table']} where bk_no='$bk_no'");
if (!$write)
alert('데이터가 없습니다.');
if ($write['mb_id']) {
$res = sql_fetch("select mb_id from {$g5['member_table']} where mb_id='{$write['mb_id']}'");
$write['mb_id'] = $res['mb_id'];
$sql = "select mb_id from {$g5['member_table']} where mb_hp = '{$write['bk_hp']}' and mb_id <> '{$write['mb_id']}' and mb_hp <> '' ";
$result = sql_query($sql);
while($tmp = sql_fetch_array($result)){
$exist_hplist[] = $tmp;
}
$exist_msg_1 = '(수정시 회원정보에 반영되지 않습니다.)';
$exist_msg_2 = '(수정시 회원정보에 반영됩니다.)';
$exist_msg = count($exist_hplist) ? $exist_msg_1 : $exist_msg_2;
}
$g5['title'] .= '수정';
}
else {
$write['bg_no'] = $bg_no;
$g5['title'] .= '추가';
}
if (!is_numeric($write['bk_receipt']))
$write['bk_receipt'] = 1;
$no_group = sql_fetch("select * from {$g5['sms5_book_group_table']} where bg_no = 1");
include_once(G5_ADMIN_PATH."/admin.head.php");
?>
<form name="book_form" id="book_form" method="post" action="./num_book_update.php">
<input type="hidden" name="w" value="<?php echo $w?>">
<input type="hidden" name="page" value="<?php echo $page?>">
<input type="hidden" name="ap" value="<?php echo $ap?>">
<input type="hidden" name="bk_no" value="<?php echo $write['bk_no']?>">
<input type="hidden" name="mb_id" id="mb_id" value="<?php echo $write['mb_id']?>">
<input type="hidden" name="get_bg_no" value="<?php echo $bg_no?>">
<div class="tbl_frm01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?></caption>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="bg_no">그룹</label></th>
<td>
<select name="bg_no" id="bg_no" required>
<option value="1"><?php echo $no_group['bg_name']?> (<?php echo number_format($no_group['bg_count'])?> 명)</option>
<?php
$qry = sql_query("select * from {$g5['sms5_book_group_table']} where bg_no> 1 order by bg_name");
while($res = sql_fetch_array($qry)) {
?>
<option value="<?php echo $res['bg_no']?>" <?php echo $res['bg_no']==$write['bg_no']?'selected':''?>> <?php echo $res['bg_name']?> (<?php echo number_format($res['bg_count'])?> 명) </option>
<?php } ?>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="bk_name">이름</label></th>
<td><input type="text" name="bk_name" id="bk_name" maxlength="50" value="<?php echo $write['bk_name']?>" required class="frm_input required"></td>
</tr>
<tr>
<th scope="row"><label for="bk_hp">휴대폰번호</label></th>
<td>
<input type="text" name="bk_hp" id="bk_hp" value="<?php echo $write['bk_hp']?>" required class="frm_input required">
<?php if( count($exist_hplist) ) { // 중복되는 목록이 있다면 ?>
<div id="hp_check_el">
<ul>
<?php
foreach( $exist_hplist as $v ) {
if( empty($v) ) continue;
$href = G5_ADMIN_URL."/member_form.php?w=u&amp;mb_id={$v['mb_id']}";
?>
<li><strong>중복됨 </strong><a href="<?php echo $href; ?>" target="_blank"><?php echo $v['mb_id']; ?></a></li>
<?php
}
?>
</ul>
</div>
<?php } ?>
</td>
</tr>
<tr>
<th scope="row">수신여부</th>
<td>
<input type="radio" name="bk_receipt" id="bk_receipt_1" value="1" <?php echo $write['bk_receipt']?'checked':''?>>
<label for="bk_receipt_1">수신허용</label>
<input type="radio" name="bk_receipt" id="bk_receipt_2" value="0" <?php echo !$write['bk_receipt']?'checked':''?>>
<label for="bk_receipt_2">수신거부</label>
</td>
</tr>
<?php if ($w == 'u') { ?>
<tr>
<th scope="row">회원아이디</th>
<td> <?php echo $write['mb_id'] ? '<a href="'.G5_ADMIN_URL.'/member_form.php?w=u&amp;mb_id='.$write['mb_id'].'">'.$write['mb_id'].'</a>' : '비회원'?> </td>
</tr>
<tr>
<th scope="row">업데이트</th>
<td> <?php echo $write['bk_datetime']?> </td>
</tr>
<?php } ?>
<tr>
<th scope="row"><label for="bk_memo">메모</label></th>
<td>
<textarea name="bk_memo" id="bk_memo"><?php echo $write['bk_memo']?></textarea>
</td>
</tr>
</tbody>
</table>
</div>
<div class="btn_confirm01 btn_confirm">
<input type="submit" value="확인" class="btn_submit" accesskey="s" onclick="return book_submit();">
<a href="./num_book.php?<?php echo $_SERVER['QUERY_STRING']?>">목록</a>
</div>
</form>
<script>
function book_submit(){
var f = document.book_form;
var regExp_hp = /^(01[016789]{1}|02|0[3-9]{1}[0-9]{1})-?[0-9]{3,4}-?[0-9]{4}$/;
if(!f.bk_hp.value){
f.bk_hp.focus();
alert("휴대폰번호를 입력하세요.");
return false;
} else if ( !regExp_hp.test(f.bk_hp.value) )
{
f.bk_hp.focus();
alert("휴대폰번호 입력이 올바르지 않습니다.");
return false;
}
var w = "<?php echo $w; ?>";
var bk_no = "<?php echo $bk_no; ?>";
var mb_id = f.mb_id.value;
var bk_hp = f.bk_hp.value;
var params = { w: w, bk_no: bk_no, mb_id : mb_id, bk_hp : bk_hp };
var is_submit;
$.ajax({
url: "./ajax.hp_chk.php",
type: "POST",
cache:false,
timeout : 30000,
dataType:"json",
data:params,
success: function(data) {
if(data.error) {
is_submit = false;
alert( data.error );
} else {
var list_text = "";
var list_data;
$.each( data.exist , function(num) {
list_data = data.exist[num];
if(list_data) {
var href = "<?php echo G5_ADMIN_URL ?>/member_form.php?w=u&mb_id="+list_data;
list_text += "<li><a href=\""+href+"\" target=\"_blank\">"+list_data+"</a></li>";
}
});
var $check_msg = $("#hp_check_el");
if( !list_text ){ // 중복 휴대폰 번호가 없다면 submit
if($check_msg.size()> 0)
$check_msg.remove();
// $("#exist_msg").text("<?php echo $exist_msg_2; ?>");
is_submit = true;
} else {
if($check_msg.size() < 1)
$("input#bk_hp").after("<div id=\"hp_check_el\"><h3>이 번호를 쓰는 회원 정보</h3><ul></ul></div>");
$("#hp_check_el").find("ul").html( list_text );
// $("#exist_msg").html("<?php echo $exist_msg_1 ?>");
if(confirm("회원 정보에 중복 휴대폰 번호가 있습니다.수정하실 경우 회원정보에 반영되지 않습니다.\n수정하시겠습니까?"))
is_submit = true;
else
is_submit = false;
}
}
if(is_submit)
f.submit();
}
});
return false;
}
</script>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>

186
adm/sms_admin/num_group.php Normal file
View File

@ -0,0 +1,186 @@
<?php
$sub_menu = "900700";
include_once("./_common.php");
auth_check($auth[$sub_menu], "r");
$g5['title'] = "휴대폰번호 그룹";
$res = sql_fetch("select count(*) as cnt from {$g5['sms5_book_group_table']}");
$total_count = $res['cnt'];
$no_group = sql_fetch("select * from {$g5['sms5_book_group_table']} where bg_no = 1");
$group = array();
$qry = sql_query("select * from {$g5['sms5_book_group_table']} where bg_no > 1 order by bg_name");
while ($res = sql_fetch_array($qry)) array_push($group, $res);
include_once(G5_ADMIN_PATH.'/admin.head.php');
?>
<script>
function del(bg_no) {
if (confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n삭제되는 그룹에 속한 자료는 '<?php echo $no_group['bg_name']?>'로 이동됩니다.\n\n그래도 삭제하시겠습니까?"))
location.href = 'num_group_update.php?mw=d&bg_no=' + bg_no;
}
function move(bg_no, bg_name, sel) {
var msg = '';
if (sel.value)
{
msg = "'" + bg_name + "' 그룹에 속한 모든 데이터를\n\n'";
msg += sel.options[sel.selectedIndex].text + "' 그룹으로 이동하시겠습니까?";
if (confirm(msg))
location.href = 'num_group_move.php?bg_no=' + bg_no + '&move_no=' + sel.value;
else
sel.selectedIndex = 0;
}
}
function empty(bg_no) {
if (confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n그룹에 속한 데이터를 정말로 비우시겠습니까?"))
location.href = 'num_group_update.php?mw=empty&bg_no=' + bg_no;
}
function num_group_submit(f)
{
if (!is_checked("chk[]")) {
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
return false;
}
if(document.pressed == "선택삭제") {
if(confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n삭제되는 그룹에 속한 자료는 '<?php echo $no_group['bg_name']?>'로 이동됩니다.\n\n그래도 삭제하시겠습니까?")) {
f.w.value = "de";
} else {
return false;
}
}
if(document.pressed == "선택비우기") {
if(confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n그룹에 속한 데이터를 정말로 비우시겠습니까?")) {
f.w.value = "em";
} else {
return false;
}
}
return true;
}
</script>
<form name="group<?php echo $res['bg_no']?>" method="get" action="./num_group_update.php" class="local_sch02 local_sch">
<input type="hidden" name="bg_no" value="<?php echo $res['bg_no']?>">
<div>
<label for="bg_name" class="sound_only">그룹추가</label>
<input type="text" id="bg_name" name="bg_name" required class="required frm_input">
<input type="submit" value="그룹추가" class="btn_submit">
</div>
<div class="sch_last">
<span>건수 : <?php echo $total_count; ?></span>
</div>
</form>
<div class="local_desc01 local_desc">
<p>그룹명순으로 정렬됩니다.</p>
</div>
<form name="group_hp_form" id="group_hp_form" method="post" action="./num_group_update.php" onsubmit="return num_group_submit(this);">
<input type="hidden" name="w" value="u">
<div class="tbl_head01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?> 목록</caption>
<thead>
<tr>
<th scope="col">
<label for="chkall" class="sound_only">그룹 전체</label>
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
</th>
<th scope="col">그룹명</th>
<th scope="col">총</th>
<th scope="col">회원</th>
<th scope="col">비회원</th>
<th scope="col">수신</th>
<th scope="col">거부</th>
<th scope="col">이동</th>
<th scope="col">보기</th>
</tr>
</thead>
<tbody>
<!-- 미분류 시작 -->
<tr>
<td></td>
<td><?php echo $no_group['bg_name']?></td>
<td class="td_num"><?php echo number_format($no_group['bg_count'])?></td>
<td class="td_num"><?php echo number_format($no_group['bg_member'])?></td>
<td class="td_num"><?php echo number_format($no_group['bg_nomember'])?></td>
<td class="td_num"><?php echo number_format($no_group['bg_receipt'])?></td>
<td class="td_num"><?php echo number_format($no_group['bg_reject'])?></td>
<td class="td_mng">
<label for="select_bg_no_999" class="sound_only">이동할 그룹</label>
<select name="select_bg_no_999" id="select_bg_no_999" onchange="move(<?php echo $no_group['bg_no']?>, '<?php echo $no_group['bg_name']?>', this);" >
<option value=""></option>
<?php for ($i=0; $i<count($group); $i++) { ?>
<option value="<?php echo $group[$i]['bg_no']?>"> <?php echo $group[$i]['bg_name']?> </option>
<?php } ?>
</select>
</td>
<td class="td_mng">
<a href="./num_book.php?bg_no=1">보기</a>
</td>
</tr>
<!-- 미분류 끝 -->
<?php
for ($i=0; $i<count($group); $i++) {
$bg = 'bg'.(($i + 1)%2);
?>
<tr class="<?php echo $bg; ?>">
<td class="td_mng">
<input type="hidden" name="bg_no[<?php echo $i ?>]" value="<?php echo $group[$i]['bg_no']?>" id="bg_no_<?php echo $i ?>">
<label for="chk_<?php echo $i ?>" class="sound_only">그룹명</label>
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i ?>">
</td>
<td>
<label for="bg_name_<?php echo $i; ?>" class="sound_only">그룹명</label>
<input type="text" name="bg_name[<?php echo $i; ?>]" value="<?php echo $group[$i]['bg_name']?>" id="bg_name_<?php echo $i; ?>" class="frm_input">
</td>
<td class="td_num"><?php echo number_format($group[$i]['bg_count'])?></td>
<td class="td_num"><?php echo number_format($group[$i]['bg_member'])?></td>
<td class="td_num"><?php echo number_format($group[$i]['bg_nomember'])?></td>
<td class="td_num"><?php echo number_format($group[$i]['bg_receipt'])?></td>
<td class="td_num"><?php echo number_format($group[$i]['bg_reject'])?></td>
<td class="td_mbstat">
<label for="select_bg_no_<?php echo $i; ?>" class="sound_only">이동할 그룹</label>
<select name="select_bg_no[<?php echo $i ?>]" onchange="move(<?php echo $group[$i]['bg_no']?>, '<?php echo $group[$i]['bg_name']?>', this);" >
<option value=""></option>
<option value="<?php echo $no_group['bg_no']?>"><?php echo $no_group['bg_name']?></option>
<?php for ($j=0; $j<count($group); $j++) { ?>
<?php if ($group[$i]['bg_no']==$group[$j]['bg_no']) continue; ?>
<option value="<?php echo $group[$j]['bg_no']?>"> <?php echo $group[$j]['bg_name']?> </option>
<?php } ?>
</select>
</td>
<td class="td_mng">
<a href="./num_book.php?bg_no=<?php echo $group[$i]['bg_no']?>">보기</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="btn_list01 btn_list">
<input type="submit" name="act_button" value="선택수정" onclick="document.pressed=this.value">
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value">
<input type="submit" name="act_button" value="선택비우기" onclick="document.pressed=this.value">
</div>
</form>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,14 @@
<?php
// 휴대폰 그룹 이동
$sub_menu = "900700";
include_once("./_common.php");
auth_check($auth[$sub_menu], "w");
$res = sql_fetch("select * from {$g5['sms5_book_group_table']} where bg_no='$bg_no'");
sql_query("update {$g5['sms5_book_group_table']} set bg_count = bg_count + {$res['bg_count']}, bg_member = bg_member + {$res['bg_member']}, bg_nomember = bg_nomember + {$res['bg_nomember']}, bg_receipt = bg_receipt + {$res['bg_receipt']}, bg_reject = bg_reject + {$res['bg_reject']} where bg_no='$move_no'");
sql_query("update {$g5['sms5_book_group_table']} set bg_count = 0, bg_member = 0, bg_nomember = 0, bg_receipt = 0, bg_reject = 0 where bg_no='$bg_no'");
sql_query("update {$g5['sms5_book_table']} set bg_no='$move_no' where bg_no='$bg_no'");
goto_url('./num_group.php');
?>

View File

@ -0,0 +1,77 @@
<?php
$sub_menu = "900700";
include_once("./_common.php");
auth_check($auth[$sub_menu], "w");
if ($w == 'u') // 업데이트
{
for ($i=0; $i<count($_POST['chk']); $i++)
{
// 실제 번호를 넘김
$k = $_POST['chk'][$i];
$bg_no = $_POST['bg_no'][$k];
$bg_name = $_POST['bg_name'][$k];
if (!is_numeric($bg_no))
alert('그룹 고유번호가 없습니다.');
$res = sql_fetch("select * from {$g5['sms5_book_group_table']} where bg_no='$bg_no'");
if (!$res)
alert('존재하지 않는 그룹입니다.');
if (!strlen(trim($bg_name)))
alert('그룹명을 입력해주세요');
$res = sql_fetch("select bg_name from {$g5['sms5_book_group_table']} where bg_no<>'$bg_no' and bg_name='$bg_name'");
if ($res)
alert('같은 그룹명이 존재합니다.');
sql_query("update {$g5['sms5_book_group_table']} set bg_name='$bg_name' where bg_no='$bg_no'");
}
}
else if ($w == 'de') // 그룹삭제
{
for ($i=0; $i<count($_POST['chk']); $i++)
{
// 실제 번호를 넘김
$k = $_POST['chk'][$i];
$bg_no = $_POST['bg_no'][$k];
if (!is_numeric($bg_no))
alert('그룹 고유번호가 없습니다.');
$res = sql_fetch("select * from {$g5['sms5_book_group_table']} where bg_no='$bg_no'");
if (!$res)
alert('존재하지 않는 그룹입니다.');
sql_query("delete from {$g5['sms5_book_group_table']} where bg_no='$bg_no'");
sql_query("update {$g5['sms5_book_table']} set bg_no=1 where bg_no='$bg_no'");
}
}
else if ($w == 'em') // 비우기
{
for ($i=0; $i<count($_POST['chk']); $i++)
{
// 실제 번호를 넘김
$k = $_POST['chk'][$i];
$bg_no = $_POST['bg_no'][$k];
sql_query("update {$g5['sms5_book_group_table']} set bg_count = 0, bg_member = 0, bg_nomember = 0, bg_receipt = 0, bg_reject = 0 where bg_no='$bg_no'");
sql_query("delete from {$g5['sms5_book_table']} where bg_no='$bg_no'");
}
}
else // 등록
{
if (!strlen(trim($bg_name)))
alert('그룹명을 입력해주세요');
$res = sql_fetch("select bg_name from {$g5['sms5_book_group_table']} where bg_name='$bg_name'");
if ($res)
alert('같은 그룹명이 존재합니다.');
sql_query("insert into {$g5['sms5_book_group_table']} set bg_name='$bg_name'");
}
goto_url('./num_group.php');
?>

View File

@ -0,0 +1,84 @@
<?php
include_once('./_common.php');
auth_check($auth[$sub_menu], "r");
if(!count($_POST['chk_bg_no']))
alert('번호를 '.$act.'할 그룹을 한개 이상 선택해 주십시오.', $url);
$sql = "select * from {$g5['sms5_book_table']} where bk_no in ($bk_no_list) order by bk_no desc ";
$result = sql_query($sql);
$save = array();
$save_group = array();
for ($kk=0;$row = sql_fetch_array($result);$kk++)
{
$bk_no = $row['bk_no'];
for ($i=0; $i<count($_POST['chk_bg_no']); $i++)
{
$bg_no = $_POST['chk_bg_no'][$i];
if( !$bg_no ) continue;
$sql = " insert into {$g5['sms5_book_table']}
set bg_no='$bg_no',
mb_id='{$row['mb_id']}',
bk_name='".addslashes($row['bk_name'])."',
bk_hp='{$row['bk_hp']}',
bk_receipt='{$row['bk_receipt']}',
bk_datetime='".G5_TIME_YMDHIS."' ";
sql_query($sql);
if( !in_array($bg_no, $save_group) ){
array_push( $save_group, $bg_no );
}
}
$save[$kk]['bg_no'] = $row['bg_no'];
$save[$kk]['bk_no'] = $row['bk_no'];
$save[$kk]['mb_id'] = $row['mb_id'];
$save[$kk]['bk_receipt'] = $row['bk_receipt'];
}
if ($sw == 'move')
{
foreach ($save as $v)
{
if( empty($v['bk_no']) ) continue;
sql_query(" delete from {$g5['sms5_book_table']} where bk_no = '{$v['bk_no']}' ");
if( !in_array($v['bg_no'], $save_group) ){
array_push( $save_group, $v['bg_no'] );
}
}
}
if( count($save_group) ){ //그룹테이블 업데이트
$save_group = array_unique( $save_group );
foreach( $save_group as $v )
{
if( empty($v) ) continue;
$bg_count = sql_fetch("select count(*) as cnt from {$g5['sms5_book_table']} where bg_no='$v' ");
$bg_receipt = sql_fetch("select count(*) as cnt from {$g5['sms5_book_table']} where bg_no='$v' and bk_receipt >= 1 ");
$bg_reject = (int)$bg_count['cnt'] - (int)$bg_receipt['cnt'];
$bg_member = sql_fetch("select count(*) as cnt from {$g5['sms5_book_table']} where bg_no='$v' and mb_id <> '' ");
$bg_nomember = (int)$bg_count['cnt'] - (int)$bg_member['cnt'];
$sql = "update {$g5['sms5_book_group_table']} set bg_count = {$bg_count['cnt']}, bg_receipt = {$bg_receipt['cnt']}, bg_reject = {$bg_reject}, bg_member = {$bg_member['cnt']}, bg_nomember = {$bg_nomember} where bg_no='$v' ";
sql_query($sql);
}
}
$msg = '해당 번호를 선택한 그룹으로 '.$act.' 하였습니다.';
$opener_href = './num_book.php?page='.$page;
echo <<<HEREDOC
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script>
alert("$msg");
opener.document.location.href = "$opener_href";
window.close();
</script>
<noscript>
<p>
"$msg"
</p>
<a href="$opener_href">돌아가기</a>
</noscript>
HEREDOC;
?>

189
adm/sms_admin/sms5.sql Normal file
View File

@ -0,0 +1,189 @@
## 마이에스큐엘 dump 10.11
##
##
## ######################################################
## Server version 5.0.92-log
##
## Table structure for table `{$g5['sms5_book_table']}`
##
DROP TABLE IF EXISTS `{$g5['sms5_book_table']}`;
CREATE TABLE `{$g5['sms5_book_table']}` (
`bk_no` int(11) NOT NULL auto_increment,
`bg_no` int(11) NOT NULL default '0',
`mb_no` int(11) NOT NULL default '0',
`mb_id` varchar(20) NOT NULL default '',
`bk_name` varchar(255) NOT NULL default '',
`bk_hp` varchar(255) NOT NULL default '',
`bk_receipt` tinyint(4) NOT NULL default '0',
`bk_datetime` datetime NOT NULL default '0000-00-00 00:00:00',
`bk_memo` text NOT NULL,
PRIMARY KEY (`bk_no`),
KEY `bk_name` (`bk_name`),
KEY `bk_hp` (`bk_hp`),
KEY `mb_no` (`mb_no`),
KEY `bg_no` (`bg_no`,`bk_no`),
KEY `mb_id` (`mb_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
##
## Table structure for table `{$g5['sms5_book_table']}_group`
##
DROP TABLE IF EXISTS `{$g5['sms5_book_table']}_group`;
CREATE TABLE `{$g5['sms5_book_table']}_group` (
`bg_no` int(11) NOT NULL auto_increment,
`bg_name` varchar(255) NOT NULL default '',
`bg_count` int(11) NOT NULL default '0',
`bg_member` int(11) NOT NULL default '0',
`bg_nomember` int(11) NOT NULL default '0',
`bg_receipt` int(11) NOT NULL default '0',
`bg_reject` int(11) NOT NULL default '0',
PRIMARY KEY (`bg_no`),
KEY `bg_name` (`bg_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
##
## Table structure for table `{$g5['sms5_config_table']}`
##
DROP TABLE IF EXISTS `{$g5['sms5_config_table']}`;
CREATE TABLE `{$g5['sms5_config_table']}` (
`cf_phone` varchar(255) NOT NULL default '',
`cf_register` varchar(255) NOT NULL default '',
`cf_datetime` datetime NOT NULL default '0000-00-00 00:00:00',
`cf_member` tinyint(4) NOT NULL default '1',
`cf_level` tinyint(4) NOT NULL default '2',
`cf_point` int(11) NOT NULL default '0',
`cf_day_count` int(11) NOT NULL default '0',
`cf_skin` varchar(100) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
##
## Table structure for table `{$g5['sms5_form_table']}`
##
DROP TABLE IF EXISTS `{$g5['sms5_form_table']}`;
CREATE TABLE `{$g5['sms5_form_table']}` (
`fo_no` int(11) NOT NULL auto_increment,
`fg_no` tinyint(4) NOT NULL default '0',
`fg_member` char(1) NOT NULL default '0',
`fo_name` varchar(255) NOT NULL default '',
`fo_content` text NOT NULL,
`fo_datetime` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`fo_no`),
KEY `fg_no` (`fg_no`,`fo_no`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
##
## Table structure for table `{$g5['sms5_form_table']}_group`
##
DROP TABLE IF EXISTS `{$g5['sms5_form_table']}_group`;
CREATE TABLE `{$g5['sms5_form_table']}_group` (
`fg_no` int(11) NOT NULL auto_increment,
`fg_name` varchar(255) NOT NULL default '',
`fg_count` int(11) NOT NULL default '0',
`fg_member` tinyint(4) NOT NULL,
PRIMARY KEY (`fg_no`),
KEY `fg_name` (`fg_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
##
## Table structure for table `{$g5['sms5_history_table']}`
##
DROP TABLE IF EXISTS `{$g5['sms5_history_table']}`;
CREATE TABLE `{$g5['sms5_history_table']}` (
`hs_no` int(11) NOT NULL auto_increment,
`wr_no` int(11) NOT NULL default '0',
`wr_renum` int(11) NOT NULL default '0',
`bg_no` int(11) NOT NULL default '0',
`mb_no` int(11) NOT NULL default '0',
`mb_id` varchar(20) NOT NULL default '',
`bk_no` int(11) NOT NULL default '0',
`hs_name` varchar(30) NOT NULL default '',
`hs_hp` varchar(255) NOT NULL default '',
`hs_datetime` datetime NOT NULL default '0000-00-00 00:00:00',
`hs_flag` tinyint(4) NOT NULL default '0',
`hs_code` varchar(255) NOT NULL default '',
`hs_memo` varchar(255) NOT NULL default '',
`hs_log` varchar(255) NOT NULL default '',
PRIMARY KEY (`hs_no`),
KEY `wr_no` (`wr_no`),
KEY `mb_no` (`mb_no`),
KEY `bk_no` (`bk_no`),
KEY `hs_hp` (`hs_hp`),
KEY `hs_code` (`hs_code`),
KEY `bg_no` (`bg_no`),
KEY `mb_id` (`mb_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
##
## Table structure for table `{$g5['sms5_write_table']}`
##
DROP TABLE IF EXISTS `{$g5['sms5_write_table']}`;
CREATE TABLE `{$g5['sms5_write_table']}` (
`wr_no` int(11) NOT NULL default '1',
`wr_renum` int(11) NOT NULL default '0',
`wr_reply` varchar(255) NOT NULL default '',
`wr_message` varchar(255) NOT NULL default '',
`wr_booking` datetime NOT NULL default '0000-00-00 00:00:00',
`wr_total` int(11) NOT NULL default '0',
`wr_re_total` int(11) NOT NULL default '0',
`wr_success` int(11) NOT NULL default '0',
`wr_failure` int(11) NOT NULL default '0',
`wr_datetime` datetime NOT NULL default '0000-00-00 00:00:00',
`wr_memo` text NOT NULL,
KEY `wr_no` (`wr_no`,`wr_renum`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
##
## Table structure for table `{$g5['sms5_member_history_table']}`
##
DROP TABLE IF EXISTS `{$g5['sms5_member_history_table']}`;
CREATE TABLE `{$g5['sms5_member_history_table']}` (
`mh_no` int(11) NOT NULL auto_increment,
`mb_id` varchar(30) NOT NULL,
`mh_reply` varchar(30) NOT NULL,
`mh_hp` varchar(30) NOT NULL,
`mh_datetime` datetime NOT NULL,
`mh_booking` datetime NOT NULL,
`mh_log` varchar(255) NOT NULL,
`mh_ip` varchar(15) NOT NULL,
PRIMARY KEY (`mh_no`),
KEY `mb_id` (`mb_id`,`mh_datetime`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

22
adm/sms_admin/sms_ing.php Normal file
View File

@ -0,0 +1,22 @@
<?php
include_once("./_common.php");
$g5['title'] = "SMS 전송 중";
?>
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<title>SMS 전송 중</title>
<style>
body {margin:0;padding:0;background:#000;color:#fff;font-size:0.75em;line-height:2em}
div {padding:50px 0;text-align:center}
</style>
</head>
<body>
<div><img src="img/ajax-loader2.gif"><br>SMS를 전송 중입니다.<br>잠시만 기다려주십시오.</div>
</body>
</html>

779
adm/sms_admin/sms_write.php Normal file
View File

@ -0,0 +1,779 @@
<?php
$sub_menu = "900300";
include_once("./_common.php");
auth_check($auth[$sub_menu], "r");
$g5['title'] = "문자 보내기";
include_once(G5_ADMIN_PATH.'/admin.head.php');
?>
<div class="local_ov01 local_ov">
회원정보 최근 업데이트 : <?php echo $sms5['cf_datetime']?>
</div>
<?php
if ($config['cf_sms_use'] == 'icode') { // 아이코드 사용
?>
<div id="sms5_send">
<div id="send_emo">
<h2>이모티콘 목록</h2>
<?php include_once('./sms_write_form.php'); ?>
</div>
<div id="send_write">
<form name="form_sms" id="form_sms" method="post" action="sms_write_send.php" onsubmit="return send(this);" >
<input type="hidden" name="send_list" value="">
<h2>보낼내용</h2>
<div class="sms5_box write_wrap">
<span class="box_ico"></span>
<label for="wr_message" id="wr_message_lbl">내용</label>
<textarea name="wr_message" id="wr_message" class="box_txt box_square" onkeyup="byte_check('wr_message', 'sms_bytes');" accesskey="m"></textarea>
<div id="sms_byte"><span id="sms_bytes">0</span> / 80 byte</div>
<button type="button" id="write_sc_btn" class="write_scemo_btn">특수<br>기호</button>
<div id="write_sc" class="write_scemo">
<span class="scemo_ico"></span>
<div class="scemo_list">
<button type="button" class="scemo_add" onclick="javascript:add('■')">■</button>
<button type="button" class="scemo_add" onclick="javascript:add('□')">□</button>
<button type="button" class="scemo_add" onclick="javascript:add('▣')">▣</button>
<button type="button" class="scemo_add" onclick="javascript:add('◈')">◈</button>
<button type="button" class="scemo_add" onclick="javascript:add('◆')">◆</button>
<button type="button" class="scemo_add" onclick="javascript:add('◇')">◇</button>
<button type="button" class="scemo_add" onclick="javascript:add('♥')">♥</button>
<button type="button" class="scemo_add" onclick="javascript:add('♡')">♡</button>
<button type="button" class="scemo_add" onclick="javascript:add('●')">●</button>
<button type="button" class="scemo_add" onclick="javascript:add('○')">○</button>
<button type="button" class="scemo_add" onclick="javascript:add('▲')">▲</button>
<button type="button" class="scemo_add" onclick="javascript:add('▼')">▼</button>
<button type="button" class="scemo_add" onclick="javascript:add('▶')">▶</button>
<button type="button" class="scemo_add" onclick="javascript:add('▷')">▷</button>
<button type="button" class="scemo_add" onclick="javascript:add('◀')">◀</button>
<button type="button" class="scemo_add" onclick="javascript:add('◁')">◁</button>
<button type="button" class="scemo_add" onclick="javascript:add('☎')">☎</button>
<button type="button" class="scemo_add" onclick="javascript:add('☏')">☏</button>
<button type="button" class="scemo_add" onclick="javascript:add('♠')">♠</button>
<button type="button" class="scemo_add" onclick="javascript:add('♤')">♤</button>
<button type="button" class="scemo_add" onclick="javascript:add('♣')">♣</button>
<button type="button" class="scemo_add" onclick="javascript:add('♧')">♧</button>
<button type="button" class="scemo_add" onclick="javascript:add('★')">★</button>
<button type="button" class="scemo_add" onclick="javascript:add('☆')">☆</button>
<button type="button" class="scemo_add" onclick="javascript:add('☞')">☞</button>
<button type="button" class="scemo_add" onclick="javascript:add('☜')">☜</button>
<button type="button" class="scemo_add" onclick="javascript:add('▒')">▒</button>
<button type="button" class="scemo_add" onclick="javascript:add('⊙')">⊙</button>
<button type="button" class="scemo_add" onclick="javascript:add('㈜')">㈜</button>
<button type="button" class="scemo_add" onclick="javascript:add('№')">№</button>
<button type="button" class="scemo_add" onclick="javascript:add('㉿')">㉿</button>
<button type="button" class="scemo_add" onclick="javascript:add('♨')">♨</button>
<button type="button" class="scemo_add" onclick="javascript:add('™')">™</button>
<button type="button" class="scemo_add" onclick="javascript:add('℡')">℡</button>
<button type="button" class="scemo_add" onclick="javascript:add('∑')">∑</button>
<button type="button" class="scemo_add" onclick="javascript:add('∏')">∏</button>
<button type="button" class="scemo_add" onclick="javascript:add('♬')">♬</button>
<button type="button" class="scemo_add" onclick="javascript:add('♪')">♪</button>
<button type="button" class="scemo_add" onclick="javascript:add('♩')">♩</button>
<button type="button" class="scemo_add" onclick="javascript:add('♭')">♭</button>
</div>
<div class="scemo_cls"><button type="button" class="scemo_cls_btn">닫기</button></div>
</div>
<button type="button" id="write_emo_btn" class="write_scemo_btn">이모<br>티콘</button>
<div id="write_emo" class="write_scemo">
<span class="scemo_ico"></span>
<div class="scemo_list">
<button type="button" class="scemo_add" onclick="javascript:add('*^^*')">*^^*</button>
<button type="button" class="scemo_add" onclick="javascript:add('♡.♡')">♡.♡</button>
<button type="button" class="scemo_add" onclick="javascript:add('@_@')">@_@</button>
<button type="button" class="scemo_add" onclick="javascript:add('☞_☜')">☞_☜</button>
<button type="button" class="scemo_add" onclick="javascript:add('ㅠ ㅠ')">ㅠ ㅠ</button>
<button type="button" class="scemo_add" onclick="javascript:add('Θ.Θ')">Θ.Θ</button>
<button type="button" class="scemo_add" onclick="javascript:add('^_~♥')">^_~♥</button>
<button type="button" class="scemo_add" onclick="javascript:add('~o~')">~o~</button>
<button type="button" class="scemo_add" onclick="javascript:add('★.★')">★.★</button>
<button type="button" class="scemo_add" onclick="javascript:add('(!.!)')">(!.!)</button>
<button type="button" class="scemo_add" onclick="javascript:add('⊙.⊙')">⊙.⊙</button>
<button type="button" class="scemo_add" onclick="javascript:add('q.p')">q.p</button>
<button type="button" class="scemo_add emo_long" onclick="javascript:add('┏( \'\')┛')">┏( \'\')┛</button>
<button type="button" class="scemo_add emo_long" onclick="javascript:add('@)-)--')">@)-)--')</button>
<button type="button" class="scemo_add emo_long" onclick="javascript:add('↖(^-^)↗')">↖(^-^)↗</button>
<button type="button" class="scemo_add emo_long" onclick="javascript:add('(*^-^*)')">(*^-^*)</button>
</div>
<div class="scemo_cls"><button type="button" class="scemo_cls_btn">닫기</button></div>
</div>
</div>
<div id="write_preset">
{이름} : 받는사람 이름
</div>
<div id="write_reply">
<label for="wr_reply">회신</label>
<input type="text" name="wr_reply" value="<?php echo $sms5['cf_phone']?>" id="wr_reply" required class="frm_input" size="17" maxlength="20">
</div>
<div id="write_recv" class="write_inner">
<h2>받는사람</h2>
<button type="button" class="write_floater write_floater_btn" onclick="hp_list_del()">선택삭제</button>
<label for="hp_list" class="sound_only">받는사람들</label>
<select name="hp_list" id="hp_list" size="5"></select>
<div id="recv_add">
<label for="hp_name">이름</label>
<input type="text" name="hp_name" id="hp_name" class="frm_input" size="11" maxlength="20" onkeypress="if(event.keyCode==13) document.getElementById('hp_number').focus();"><br>
<label for="hp_number">번호</label>
<input type="text" name="hp_number" id="hp_number" class="frm_input" size="11" maxlength="20" onkeypress="if(event.keyCode==13) hp_add()">
<button type="button" onclick="hp_add()">추가</button><br>
</div>
</div>
<div id="write_rsv" class="write_inner">
<h2>예약전송</h2>
<div class="write_floater">
<label for="wr_booking"><span class="sound_only">예약전송 </span>사용</label>
<input type="checkbox" name="wr_booking" id="wr_booking" onclick="booking(this.checked)">
</div>
<select name="wr_by" id="wr_by" disabled>
<option value="<?php echo date('Y')?>"><?php echo date('Y')?></option>
<option value="<?php echo date('Y')+1?>"><?php echo date('Y')+1?></option>
</select>
<label for="wr_by">년</label><br>
<select name="wr_bm" id="wr_bm" disabled>
<?php for ($i=1; $i<=12; $i++) { ?>
<option value="<?php echo sprintf("%02d",$i)?>" <?php echo date('m')==$i?'selected':''?>><?php echo sprintf("%02d",$i)?></option>
<?php } ?>
</select>
<label for="wr_bm">월</label>
<select name="wr_bd" id="wr_bd" disabled>
<?php for ($i=1; $i<=31; $i++) { ?>
<option value="<?php echo sprintf("%02d",$i)?>" <?php echo date('d')==$i?'selected':''?>><?php echo sprintf("%02d",$i)?></option>
<?php } ?>
</select>
<label for="wr_bd">일</label><br>
<select name="wr_bh" id="wr_bh" disabled>
<?php for ($i=0; $i<24; $i++) { ?>
<option value="<?php echo sprintf("%02d",$i)?>" <?php echo date('H')+1==$i?'selected':''?>><?php echo sprintf("%02d",$i)?></option>
<?php } ?>
</select>
<label for="wr_bh">시</label>
<select name="wr_bi" id="wr_bi" disabled>
<?php for ($i=0; $i<=59; $i+=5) { ?>
<option value="<?php echo sprintf("%02d",$i)?>"><?php echo sprintf("%02d",$i)?></option>
<?php } ?>
</select>
<label for="wr_bi">분</label>
</div>
<div class="btn_confirm01 btn_confirm">
<input type="submit" value="전송" class="btn_submit">
<!-- <input type="submit" value="전송" onclick="send()"> -->
</div>
</form>
</div>
<div id="send_book">
<h2>휴대폰번호 목록</h2>
<div id="book_tab">
<a href="#book_group" id="book_group">그룹</a>
<a href="#book_person" id="book_person">개인</a>
<a href="#book_level" id="book_level">권한</a>
</div>
<div id="num_book"></div>
<div id="book_desc">SMS 수신을 허용한 회원님만 출력됩니다.</div>
</div>
</div>
<script>
function overlap_check()
{
var hp_list = document.getElementById('hp_list');
var hp_number = document.getElementById('hp_number');
var list = '';
if (hp_list.length < 1) {
alert('받는 사람을 입력해주세요.');
hp_number.focus();
return;
}
for (i=0; i<hp_list.length; i++)
list += hp_list.options[i].value + '/';
(function($){
var $form = $("#form_sms");
$form.find("input[name='send_list']").val( list );
var params = $form.serialize();
$.ajax({
url: './sms_write_overlap_check.php',
cache:false,
timeout : 30000,
dataType:"html",
data:params,
success: function(data) {
alert(data);
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
})(jQuery);
}
function send(f)
{
var hp_list = document.getElementById('hp_list');
var wr_message = document.getElementById('wr_message');
var hp_number = document.getElementById('hp_number');
var list = '';
if (!wr_message.value) {
alert('메세지를 입력해주세요.');
wr_message.focus();
return false;
}
if (hp_list.length < 1) {
alert('받는 사람을 입력해주세요.');
hp_number.focus();
return false;
}
for (i=0; i<hp_list.length; i++)
list += hp_list.options[i].value + '/';
w = document.body.clientWidth/2 - 200;
h = document.body.clientHeight/2 - 100;
act = window.open('sms_ing.php', 'act', 'width=300, height=200, left=' + w + ', top=' + h);
act.focus();
f.target = '';
f.action = 'sms_write_send.php';
f.send_list.value = list;
f.submit();
return true;
}
function hp_add()
{
var hp_number = document.getElementById('hp_number');
var hp_name = document.getElementById('hp_name');
var hp_list = document.getElementById('hp_list');
var pattern = /^01[016789][0-9]{3,4}[0-9]{4}$/;
var pattern2 = /^01[016789]-[0-9]{3,4}-[0-9]{4}$/;
if(!pattern.test(hp_number.value) && !pattern2.test(hp_number.value)) {
alert("휴대폰번호 형식이 올바르지 않습니다.");
hp_number.select();
return;
}
if (!pattern2.test(hp_number.value)) {
hp_number.value = hp_number.value.replace(new RegExp("(01[016789])([0-9]{3,4})([0-9]{4})"), "$1-$2-$3");
}
var item = '';
if (trim(hp_name.value))
item = hp_name.value + ' (' + hp_number.value + ')';
else
item = hp_number.value;
var value = 'h,' + hp_name.value + ':' + hp_number.value;
for (i=0; i<hp_list.length; i++) {
if (hp_list[i].value == value) {
alert('이미 같은 목록이 있습니다.');
return;
}
}
if( jQuery.inArray( hp_number.value , sms_obj.phone_number ) > -1 ){
alert('목록에 이미 같은 휴대폰 번호가 있습니다.');
return;
} else {
sms_obj.phone_number.push( hp_number.value );
}
hp_list.options[hp_list.length] = new Option(item, value);
hp_number.value = '';
hp_name.value = '';
hp_name.select();
}
function hp_list_del()
{
var hp_list = document.getElementById('hp_list');
if (hp_list.selectedIndex < 0) {
alert('삭제할 목록을 선택해주세요.');
return;
}
var regExp = /(01[016789]{1}|02|0[3-9]{1}[0-9]{1})-?[0-9]{3,4}-?[0-9]{4}/,
hp_number_option = hp_list.options[hp_list.selectedIndex],
result = (hp_number_option.outerHTML.match(regExp));
if( result !== null ){
sms_obj.phone_number = sms_obj.array_remove( sms_obj.phone_number, result[0] );
}
hp_list.options[hp_list.selectedIndex] = null;
}
function book_change(id)
{
var book_group = document.getElementById('book_group');
var book_person = document.getElementById('book_person');
var num_book = document.getElementById('num_book');
var menu_group = document.getElementById('menu_group');
if (id == 'book_group')
{
book_group.style.fontWeight = 'bold';
book_person.style.fontWeight = 'normal';
book_level.style.fontWeight = 'normal';
}
else if (id == 'book_person')
{
book_group.style.fontWeight = 'normal';
book_person.style.fontWeight = 'bold';
book_level.style.fontWeight = 'normal';
}
else if (id == 'book_level')
{
book_group.style.fontWeight = 'normal';
book_person.style.fontWeight = 'normal';
book_level.style.fontWeight = 'bold';
}
}
function booking(val)
{
if (val)
{
document.getElementById('wr_by').disabled = false;
document.getElementById('wr_bm').disabled = false;
document.getElementById('wr_bd').disabled = false;
document.getElementById('wr_bh').disabled = false;
document.getElementById('wr_bi').disabled = false;
}
else
{
document.getElementById('wr_by').disabled = true;
document.getElementById('wr_bm').disabled = true;
document.getElementById('wr_bd').disabled = true;
document.getElementById('wr_bh').disabled = true;
document.getElementById('wr_bi').disabled = true;
}
}
function add(str) {
var conts = document.getElementById('wr_message');
var bytes = document.getElementById('sms_bytes');
conts.focus();
conts.value+=str;
byte_check('wr_message', 'sms_bytes');
return;
}
function byte_check(wr_message, sms_bytes)
{
var conts = document.getElementById(wr_message);
var bytes = document.getElementById(sms_bytes);
var i = 0;
var cnt = 0;
var exceed = 0;
var ch = '';
for (i=0; i<conts.value.length; i++)
{
ch = conts.value.charAt(i);
if (escape(ch).length > 4) {
cnt += 2;
} else {
cnt += 1;
}
}
bytes.innerHTML = cnt;
if (cnt > 80)
{
exceed = cnt - 80;
alert('메시지 내용은 80바이트를 넘을수 없습니다.\n\n작성하신 메세지 내용은 '+ exceed +'byte가 초과되었습니다.\n\n초과된 부분은 자동으로 삭제됩니다.');
var tcnt = 0;
var xcnt = 0;
var tmp = conts.value;
for (i=0; i<tmp.length; i++)
{
ch = tmp.charAt(i);
if (escape(ch).length > 4) {
tcnt += 2;
} else {
tcnt += 1;
}
if (tcnt > 80) {
tmp = tmp.substring(0,i);
break;
} else {
xcnt = tcnt;
}
}
conts.value = tmp;
bytes.innerHTML = xcnt;
return;
}
}
<?php
if ($bk_no) {
$row = sql_fetch("select * from {$g5['sms5_book_table']} where bk_no='$bk_no'");
?>
var hp_list = document.getElementById('hp_list');
var item = "<?php echo $row['bk_name']?> (<?php echo $row['bk_hp']?>)";
var value = "p,<?php echo $row['bk_no']?>";
hp_list.options[hp_list.length] = new Option(item, value);
<?php } ?>
<?php
if ($fo_no) {
$row = sql_fetch("select * from {$g5['sms5_form_table']} where fo_no='$fo_no'");
$fo_content = str_replace("\r\n", "\\n", $row[fo_content]);
echo "add(\"$fo_content\");";
}
?>
byte_check('wr_message', 'sms_bytes');
document.getElementById('wr_message').focus();
</script>
<?php
if ($wr_no)
{
// 메세지와 회신번호
$row = sql_fetch(" select * from {$g5['sms5_write_table']} where wr_no = '$wr_no' ");
echo "<script>\n";
echo "var hp_list = document.getElementById('hp_list');\n";
//echo "add(\"$row[wr_message]\");\n";
$wr_message = str_replace('"', '\"', $row['wr_message']);
$wr_message = str_replace("\r\n", "\\n", $wr_message);
echo "add(\"$wr_message\");\n";
echo "document.getElementById('wr_reply').value = '{$row['wr_reply']}';\n";
// 회원목록
$sql = " select * from {$g5['sms5_history_table']} where wr_no = '$wr_no' and bk_no > 0 ";
$qry = sql_query($sql);
$tot = mysql_num_rows($qry);
if ($tot > 0) {
$str = '재전송그룹 ('.number_format($tot).'명)';
$val = 'p,';
while ($row = sql_fetch_array($qry))
{
$val .= $row['bk_no'].',';
}
echo "hp_list.options[hp_list.length] = new Option('$str', '$val');\n";
}
// 비회원 목록
$sql = " select * from {$g5['sms5_history_table']} where wr_no = '$wr_no' and bk_no = 0 ";
$qry = sql_query($sql);
$tot = mysql_num_rows($qry);
if ($tot > 0)
{
while ($row = sql_fetch_array($qry))
{
$str = "{$row['hs_name']} ({$row['hs_hp']})";
$val = "h,{$row['hs_name']}:{$row['hs_hp']}";
echo "hp_list.options[hp_list.length] = new Option('$str', '$val');\n";
}
}
echo "</script>\n";
}
?>
<script>
$(function(){
$(".box_txt").bind("focus keydown", function(){
$("#wr_message_lbl").hide();
});
$(".write_scemo_btn").click(function(){
$(".write_scemo").hide();
$(this).next(".write_scemo").show();
});
$(".scemo_cls_btn").click(function(){
$(".write_scemo").hide();
});
});
var sms_obj={
phone_number : [],
el_box : "#num_book",
person_is_search : false,
level_add : function(lev, cnt){
if (cnt == '0') {
alert(lev + ' 레벨은 아무도 없습니다.');
return;
}
var hp_list = document.getElementById('hp_list');
var item = "회원 권한 " + lev + " 레벨 (" + cnt + " 명)";
var value = 'l,' + lev;
for (i=0; i<hp_list.length; i++) {
if (hp_list[i].value == value) {
alert('이미 같은 목록이 있습니다.');
return;
}
}
hp_list.options[hp_list.length] = new Option(item, value);
},
array_remove : function(arr, item){
for(var i = arr.length; i--;) {
if(arr[i] === item) {
arr.splice(i, 1);
}
}
return arr;
},
book_all_checked : function(chk){
var bk_no = document.getElementsByName('bk_no');
if (chk) {
for (var i=0; i<bk_no.length; i++) {
bk_no[i].checked = true;
}
} else {
for (var i=0; i<bk_no.length; i++) {
bk_no[i].checked = false;
}
}
},
person_add : function(bk_no, bk_name, bk_hp){
var hp_list = document.getElementById('hp_list');
var item = bk_name + " (" + bk_hp + ")";
var value = 'p,' + bk_no;
for (i=0; i<hp_list.length; i++) {
if (hp_list[i].value == value) {
alert('이미 같은 목록이 있습니다.');
return;
}
}
if( jQuery.inArray( bk_hp , this.phone_number ) > -1 ){
alert('목록에 이미 같은 휴대폰 번호가 있습니다.');
return;
} else {
this.phone_number.push( bk_hp );
}
hp_list.options[hp_list.length] = new Option(item, value);
},
person_multi_add : function(){
var bk_no = document.getElementsByName('bk_no');
var ck_no = '';
var count = 0;
for (i=0; i<bk_no.length; i++) {
if (bk_no[i].checked==true) {
count++;
ck_no += bk_no[i].value + ',';
}
}
if (!count) {
alert('하나이상 선택해주세요.');
return;
}
var hp_list = document.getElementById('hp_list');
var item = "개인 (" + count + " 명)";
var value = 'p,' + ck_no;
for (i=0; i<hp_list.length; i++) {
if (hp_list[i].value == value) {
alert('이미 같은 목록이 있습니다.');
return;
}
}
hp_list.options[hp_list.length] = new Option(item, value);
},
person : function(bg_no){
var params = { bg_no : bg_no };
this.person_is_search = false;
this.person_select( params, "html" );
book_change('book_person');
},
group_add : function(bg_no, bg_name, bg_count){
if (bg_count == '0') {
alert('그룹이 비어있습니다.');
return;
}
var hp_list = document.getElementById('hp_list');
var item = bg_name + " 그룹 (" + bg_count + " 명)";
var value = 'g,' + bg_no;
for (i=0; i<hp_list.length; i++) {
if (hp_list[i].value == value) {
alert('이미 같은 목록이 있습니다.');
return;
}
}
hp_list.options[hp_list.length] = new Option(item, value);
}
};
(function($){
sms_obj.fn_paging = function( hash_val,total_page,$el,$search_form ){
$el.paging({
current:hash_val ? hash_val : 1,
max:total_page == 0 || total_page ? total_page : 45,
length : 5,
liitem : 'span',
format:'{0}',
next:'다음',
prev:'이전',
sideClass:'pg_page pg_next',
prevClass:'pg_page pg_prev',
first:'&lt;&lt;',last:'&gt;&gt;',
href:'#',
itemCurrent:'pg_current',
itemClass:'pg_page',
appendhtml:'<span class="sound_only">페이지</span>',
onclick:function(e,page){
e.preventDefault();
$search_form.find("input[name='page']").val( page );
var params = '';
if( sms_obj.person_is_search ){
params = $search_form.serialize();
} else {
params = { page: page };
}
sms_obj.person_select( params, "html" );
}
});
}
sms_obj.person_select = function( params, type ){
emoticon_list.loading(sms_obj.el_box, "./img/ajax-loader.gif" ); //로딩 이미지 보여줌
$.ajax({
url: "./ajax.sms_write_person.php",
cache:false,
timeout : 30000,
dataType:type,
data:params,
success: function(data) {
$(sms_obj.el_box).html(data);
var $sms_person_form = $("#sms_person_form", sms_obj.el_box),
total_page = $sms_person_form.find("input[name='total_pg']").val(),
current_page = $sms_person_form.find("input[name='page']").val()
sms_obj.fn_paging( current_page, total_page, $("#person_pg", sms_obj.el_box), $sms_person_form );
$sms_person_form.bind("submit", function(e){
e.preventDefault();
sms_obj.person_is_search = true;
$(this).find("input[name='total_pg']").val('');
$(this).find("input[name='page']").val('');
var params = $(this).serialize();
sms_obj.person_select( params, "html" );
emoticon_list.loadingEnd(sms_obj.el_box); //로딩 이미지 지움
});
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
}
sms_obj.triggerclick = function( sel ){
$(sel).trigger("click");
}
$("#book_level").bind("click", function(e){
e.preventDefault();
book_change( $(this).attr("id") );
emoticon_list.loading(sms_obj.el_box, "./img/ajax-loader.gif" ); //로딩 이미지 보여줌
$.ajax({
url: "./ajax.sms_write_level.php",
cache:false,
timeout : 30000,
dataType:'json',
success: function(HttpRequest) {
if (HttpRequest.error) {
alert(HttpRequest.error);
return false;
} else {
$(sms_obj.el_box).html(HttpRequest.html);
}
emoticon_list.loadingEnd(sms_obj.el_box); //로딩 이미지 지움
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
})
});
$("#book_person").bind("click", function(e){
e.preventDefault();
book_change( $(this).attr("id") );
sms_obj.person_is_search = false;
sms_obj.person_select( '','html' );
});
$("#book_group").bind("click", function(e){
e.preventDefault();
book_change( $(this).attr("id") );
emoticon_list.loading(sms_obj.el_box, "./img/ajax-loader.gif" ); //로딩 이미지 보여줌
$.ajax({
url: "./ajax.sms_write_group.php",
cache:false,
timeout : 30000,
dataType:'html',
success: function(data) {
$(sms_obj.el_box).html(data);
emoticon_list.loadingEnd(sms_obj.el_box); //로딩 이미지 지움
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
})
}).trigger("click");
})(jQuery);
</script>
<?php } else { //아이코드 사용설정이 안되어 있다면... ?>
<section>
<h2 class="h2_frm">SMS 문자전송 서비스를 사용할 수 없습니다.</h2>
<div class="local_desc01 local_desc">
<p>
SMS 를 사용하지 않고 있기 때문에, 문자 전송을 할 수 없습니다.<br>
SMS 사용 설정은 <a href="../config_form.php#anc_cf_sms" class="btn_frmline">환경설정 &gt; 기본환경설정 &gt; SMS설정</a> 에서 SMS 사용을 아이코드로 변경해 주셔야 사용하실수 있습니다.
</p>
</div>
</section>
<?php } ?>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,132 @@
<?php
if (!defined('_GNUBOARD_')) exit;
$group = array();
$qry = sql_query("select * from {$g5['sms5_form_group_table']} order by fg_name");
while ($res = sql_fetch_array($qry)) array_push($group, $res);
$res = sql_fetch("select count(*) as cnt from `{$g5['sms5_form_table']}` where fg_no=0");
$no_count = $res['cnt'];
?>
<form name="emo_frm">
<label for="emo_sel" class="sound_only">이모티콘 그룹</label>
<select name="fg_no" id="emo_sel">
<option value="" <?php echo $fg_no?'':'selected'?>> 전체 </option>
<option value="0" <?php echo $fg_no=='0'?'selected':''?>> 미분류 (<?php echo number_format($no_count)?>) </option>
<?php for($i=0; $i<count($group); $i++) {?>
<option value="<?php echo $group[$i]['fg_no']?>" <?php echo ($fg_no==$group[$i]['fg_no'])?'selected':''?>> <?php echo $group[$i]['fg_name']?> (<?php echo number_format($group[$i]['fg_count'])?>) </option>
<?php } ?>
</select>
</form>
<ul class="emo_list">
</ul>
<form name="emo_sch" id="emo_sch" method="get" action="<?php echo $_SERVER['PHP_SELF']?>">
<input type="hidden" name="fg_no" value="<?php echo $fg_no?>">
<input type="hidden" name="page" id="hidden_page" >
<input type="hidden" name="fg_no" id="hidden_fg_no" >
<label for="st" class="sound_only">검색대상</label>
<select name="st" id="st">
<option value="all" <?php echo $st=='all'?'selected':''?>>제목 + 이모티콘</option>
<option value="name" <?php echo $st=='name'?'selected':''?>>제목</option>
<option value="content" <?php echo $st=='content'?'selected':''?>>이모티콘</option>
</select>
<label for="sv" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="sv" value="<?php echo $sv?>" id="sv" required class="frm_input required" size="15">
<input type="submit" value="검색" class="btn_submit">
</form>
<nav class="pg_wrap">
<span class="pg" id="emo_pg"></span>
</nav>
<script src="<?php echo G5_JS_URL?>/jquery.sms_paging.js"></script>
<script>
var emoticon_list = {
go : function(fo_no){
var wr_message = document.getElementById('wr_message');
//wr_message.focus();
wr_message.value = document.getElementById('fo_contents_' + fo_no).value;
byte_check('wr_message', 'sms_bytes');
}
};
(function($){
var $search_form = $("form#emo_sch");
emoticon_list.fn_paging = function( hash_val,total_page ){
$('#emo_pg').paging({
current:hash_val ? hash_val : 1,
max:total_page == 0 || total_page ? total_page : 45,
length : 5,
liitem : 'span',
format:'{0}',
next:'다음',
prev:'이전',
sideClass:'pg_page pg_next',
prevClass:'pg_page pg_prev',
first:'&lt;&lt;',last:'&gt;&gt;',
href:'#',
itemCurrent:'pg_current',
itemClass:'pg_page',
appendhtml:'<span class="sound_only">페이지</span>',
onclick:function(e,page){
e.preventDefault();
$("#hidden_page").val( page );
var params = $($search_form).serialize();
emoticon_list.select_page( params, "json" );
}
});
}
emoticon_list.loading = function( el, src ){
if( !el || !src) return;
$(el).append("<span class='tmp_loading'><img src='"+src+"' title='loading...' ></span>");
}
emoticon_list.loadingEnd = function( el ){
$(".tmp_loading", $(el)).remove();
}
emoticon_list.select_page = function( params, type ){
if( !type ){
type = "json";
}
emoticon_list.loading(".emo_list", "./img/ajax-loader.gif" ); //로딩 이미지 보여줌
$.ajax({
url: "./ajax.sms_write_form.php",
cache:false,
timeout : 30000,
dataType:type,
data:params,
success: function(HttpRequest) {
if( type == "json" ){
if (HttpRequest.error) {
alert(HttpRequest.error);
return false;
} else {
var $emoticon_box = $(".emo_list");
$emoticon_box.html( HttpRequest.list_text );
emoticon_list.fn_paging( HttpRequest.page, HttpRequest.total_page );
$("#hidden_page").val( HttpRequest.page );
}
}
emoticon_list.loadingEnd(".emo_list"); //로딩 이미지 지움
}
});
}
$("#emo_sel").bind("change", function(e){
var params = { fg_no : $(this).val() };
$search_form[0].reset();
$("#hidden_fg_no").val( $(this).val() );
emoticon_list.select_page( params, "json" );
});
$search_form.submit(function(e){
e.preventDefault();
var $form = $(this),
params = $(this).serialize();
emoticon_list.select_page( params, "json" );
});
$("#emo_sel").trigger("change");
})(jQuery);
</script>

View File

@ -0,0 +1,69 @@
<?php
$sub_menu = "900300";
include_once("./_common.php");
auth_check($auth[$sub_menu], "w");
$list = $hps = array();
$overlap = 0;
if( !$send_list ){
die("넘어온 데이터 값이 없습니다.");
}
$send_list = explode('/', $send_list);
while ($row = array_shift($send_list))
{
$item = explode(',', $row);
for ($i=1, $max = count($item); $i<$max; $i++)
{
if (!trim($item[$i])) continue;
switch ($item[0])
{
case 'g': // 그룹전송
$qry = sql_query("select * from {$g5['sms5_book_table']} where bg_no='$item[1]' and bk_receipt=1");
while ($res = sql_fetch_array($qry)) {
$res['bk_hp'] = get_hp($res['bk_hp'], 0);
if (array_overlap($hps, $res['bk_hp'])) {
$overlap ++;
continue;
}
array_push($list, $res);
array_push($hps, $res['bk_hp']);
}
break;
case 'h': // 개별 휴대폰 번호 입력
$item[$i] = explode(':', $item[$i]);
$hp = get_hp($item[$i][0], 0);
$name = $item[$i][0];
if (array_overlap($hps, $hp)) {
$overlap ++;
continue;
}
array_push($list, array('bk_hp' => $hp, 'bk_name' => $name));
array_push($hps, $hp);
break;
case 'p': // 개인 선택
$res = sql_fetch("select * from {$g5['sms5_book_table']} where bk_no='$item[$i]'");
$res['bk_hp'] = get_hp($res['bk_hp'], 0);
if (array_overlap($hps, $res['bk_hp'])) {
$overlap ++;
continue;
}
array_push($list, $res);
array_push($hps, $res['bk_hp']);
break;
}
}
}
if ($overlap)
die("중복되는 휴대폰번호가 $overlap 건 있습니다. ");
else
die("중복되는 휴대폰번호가 없습니다. ");
?>

View File

@ -0,0 +1,231 @@
<?php
$sub_menu = "900300";
include_once("./_common.php");
auth_check($auth[$sub_menu], "w");
$g5['title'] = "문자전송중";
if (!trim($wr_reply))
win_close_alert('회신 번호를 입력해주세요.');
if (!trim($wr_message))
win_close_alert('메세지를 입력해주세요.');
if (!trim($send_list))
win_close_alert('문자 메세지를 받을 휴대폰번호를 입력해주세요.');
$list = array();
$hps = array();
$send_list = explode('/', $send_list);
$wr_overlap = 1; // 중복번호를 체크함
$overlap = 0;
$duplicate_data = array();
$duplicate_data['hp'] = array();
$str_serialize = "";
while ($row = array_shift($send_list))
{
$item = explode(',', $row);
for ($i=1, $max = count($item); $i<$max; $i++)
{
if (!trim($item[$i])) continue;
switch ($item[0])
{
case 'g': // 그룹전송
$qry = sql_query("select * from {$g5['sms5_book_table']} where bg_no='$item[1]' and bk_receipt=1");
while ($row = sql_fetch_array($qry))
{
$row['bk_hp'] = get_hp($row['bk_hp'], 0);
if ($wr_overlap && array_overlap($hps, $row['bk_hp'])) {
$overlap++;
array_push( $duplicate_data['hp'], $row['bk_hp'] );
continue;
}
array_push($list, $row);
array_push($hps, $row['bk_hp']);
}
break;
case 'l':
$mb_level = $item[$i];
$qry = sql_query("select mb_id, mb_name, mb_nick, mb_hp from {$g5['member_table']} where mb_level='$mb_level' and mb_sms=1 and not (mb_hp='')");
while ($row = sql_fetch_array($qry))
{
$name = $row['mb_nick'];
$hp = get_hp($row['mb_hp'], 0);
$mb_id = $row['mb_id'];
if ($wr_overlap && array_overlap($hps, $hp)) {
$overlap++;
array_push( $duplicate_data['hp'], $row['bk_hp'] );
continue;
}
$row = sql_fetch("select bg_no, bk_no from {$g5['sms5_book_table']} where mb_id='{$row['mb_id']}'");
$bg_no = $row['bg_no'];
$bk_no = $row['bk_no'];
array_push($list, array('bk_hp' => $hp, 'bk_name' => $name, 'mb_id' => $mb_id, 'bg_no' => $bg_no, 'bk_no' => $bk_no));
array_push($hps, $hp);
}
break;
case 'h': // 권한(mb_leve) 선택
$item[$i] = explode(':', $item[$i]);
$hp = get_hp($item[$i][1], 0);
$name = $item[$i][0];
if ($wr_overlap && array_overlap($hps, $hp)) {
$overlap++;
array_push( $duplicate_data['hp'], $row['bk_hp'] );
continue;
}
array_push($list, array('bk_hp' => $hp, 'bk_name' => $name));
array_push($hps, $hp);
break;
case 'p': // 개인 선택
$row = sql_fetch("select * from {$g5['sms5_book_table']} where bk_no='$item[$i]'");
$row['bk_hp'] = get_hp($row['bk_hp'], 0);
if ($wr_overlap && array_overlap($hps, $row['bk_hp'])) {
$overlap++;
array_push( $duplicate_data['hp'], $row['bk_hp'] );
continue;
}
array_push($list, $row);
array_push($hps, $row['bk_hp']);
break;
}
}
}
if( count($duplicate_data['hp']) ){ //중복된 번호가 있다면
$duplicate_data['total'] = $overlap;
$str_serialize = serialize($duplicate_data);
}
$wr_total = count($list);
// 예약전송
if ($wr_by && $wr_bm && $wr_bd && $wr_bh && $wr_bi) {
$wr_booking = "$wr_by-$wr_bm-$wr_bd $wr_bh:$wr_bi";
$booking = $wr_by.$wr_bm.$wr_bd.$wr_bh.$wr_bi;
} else {
$wr_booking = '';
$booking = '';
}
if ($config['cf_sms_use'] != 'icode') {
alert('기본환경설정에서 icode sms 사용이 비활성화 되어 있습니다.');
}
include_once(G5_ADMIN_PATH.'/admin.head.php');
$SMS = new SMS5;
$SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']);
$reply = str_replace('-', '', trim($wr_reply));
$result = $SMS->Add($list, $reply, '', '', $wr_message, $booking, $wr_total);
if ($result)
{
$result = $SMS->Send();
if ($result) //SMS 서버에 접속했습니다.
{
$row = sql_fetch("select max(wr_no) as wr_no from {$g5['sms5_write_table']}");
if ($row)
$wr_no = $row['wr_no'] + 1;
else
$wr_no = 1;
sql_query("insert into {$g5['sms5_write_table']} set wr_no='$wr_no', wr_renum=0, wr_reply='$wr_reply', wr_message='$wr_message', wr_booking='$wr_booking', wr_total='$wr_total', wr_datetime='".G5_TIME_YMDHIS."'");
$wr_success = 0;
$wr_failure = 0;
$count = 0;
foreach ($SMS->Result as $result)
{
list($phone, $code) = explode(":", $result);
if (substr($code,0,5) == "Error")
{
$hs_code = substr($code,6,2);
switch ($hs_code) {
case '02': // "02:형식오류"
$hs_memo = "형식이 잘못되어 전송이 실패하였습니다.";
break;
case '23': // "23:인증실패,데이터오류,전송날짜오류"
$hs_memo = "데이터를 다시 확인해 주시기바랍니다.";
break;
case '97': // "97:잔여코인부족"
$hs_memo = "잔여코인이 부족합니다.";
break;
case '98': // "98:사용기간만료"
$hs_memo = "사용기간이 만료되었습니다.";
break;
case '99': // "99:인증실패"
$hs_memo = "인증 받지 못하였습니다. 계정을 다시 확인해 주세요.";
break;
default: // "미 확인 오류"
$hs_memo = "알 수 없는 오류로 전송이 실패하었습니다.";
break;
}
$wr_failure++;
$hs_flag = 0;
}
else
{
$hs_code = $code;
$hs_memo = get_hp($phone, 1)."로 전송했습니다.";
$wr_success++;
$hs_flag = 1;
}
$row = array_shift($list);
$row['bk_hp'] = get_hp($row['bk_hp'], 1);
$log = array_shift($SMS->Log);
sql_query("insert into {$g5['sms5_history_table']} set wr_no='$wr_no', wr_renum=0, bg_no='{$row['bg_no']}', mb_id='{$row['mb_id']}', bk_no='{$row['bk_no']}', hs_name='{$row['bk_name']}', hs_hp='{$row['bk_hp']}', hs_datetime='".G5_TIME_YMDHIS."', hs_flag='$hs_flag', hs_code='$hs_code', hs_memo='$hs_memo', hs_log='".stripslashes($log)."'");
}
$SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
sql_query("update {$g5['sms5_write_table']} set wr_success='$wr_success', wr_failure='$wr_failure', wr_memo='$str_serialize' where wr_no='$wr_no' and wr_renum=0");
}
else win_close_alert("에러: SMS 서버와 통신이 불안정합니다.");
}
else win_close_alert("에러: SMS 데이터 입력도중 에러가 발생하였습니다.");
function win_close_alert($msg) {
$html = "<script>
act = window.open('sms_ing.php', 'act', 'width=300, height=200');
act.close();
alert('$msg');
history.back();</script>";
echo $html;
exit;
}
?>
<script>
act = window.open('sms_ing.php', 'act', 'width=300, height=200');
act.close();
location.href = 'history_view.php?wr_no=<?php echo $wr_no?>';
</script>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>

57
extend/sms5.extend.php Normal file
View File

@ -0,0 +1,57 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
//------------------------------------------------------------------------------
// SMS 상수 모음 시작
//------------------------------------------------------------------------------
define('G5_SMS5_DIR', 'sms5');
define('G5_SMS5_PATH', G5_PLUGIN_PATH.'/'.G5_SMS5_DIR);
define('G5_SMS5_URL', G5_PLUGIN_URL.'/'.G5_SMS5_DIR);
define('G5_SMS5_ADMIN_DIR', 'sms_admin');
define('G5_SMS5_ADMIN_PATH', G5_ADMIN_PATH.'/'.G5_SMS5_ADMIN_DIR);
define('G5_SMS5_ADMIN_URL', G5_ADMIN_URL.'/'.G5_SMS5_ADMIN_DIR);
// SMS 테이블명
$g5['sms5_prefix'] = 'sms5_';
$g5['sms5_config_table'] = $g5['sms5_prefix'] . 'config';
$g5['sms5_write_table'] = $g5['sms5_prefix'] . 'write';
$g5['sms5_history_table'] = $g5['sms5_prefix'] . 'history';
$g5['sms5_book_table'] = $g5['sms5_prefix'] . 'book';
$g5['sms5_book_group_table'] = $g5['sms5_prefix'] . 'book_group';
$g5['sms5_form_table'] = $g5['sms5_prefix'] . 'form';
$g5['sms5_form_group_table'] = $g5['sms5_prefix'] . 'form_group';
$g5['sms5_member_history_table'] = $g5['sms5_prefix'] . 'member_history';
if ($config['cf_sms_use'] == 'icode') {
$sms5 = sql_fetch("select * from {$g5['sms5_config_table']} ", false);
if( $sms5['cf_member'] && trim($member['mb_hp']) ) {
$g5['sms5_use_sideview'] = true; //회원 사이드뷰 레이어에 추가
} else {
$g5['sms5_use_sideview'] = false;
}
//==============================================================================
// 스킨경로
//------------------------------------------------------------------------------
$sms5_skin_path = G5_SMS5_PATH.'/skin/'.$sms5['cf_skin']; //sms5 스킨 path
$sms5_skin_url = G5_SMS5_URL .'/skin/'.$sms5['cf_skin']; //sms5 스킨 url
// Demo 설정
if (file_exists(G5_PATH.'/DEMO'))
{
// 받는 번호를 010-000-0000 으로 만듭니다.
$g5['sms5_demo'] = true;
// 아이코드에 실제로 보내지 않고 가상(Random)으로 전송결과를 저장합니다.
$g5['sms5_demo_send'] = true;
}
include_once(G5_LIB_PATH.'/icode.sms.lib.php');
include_once(G5_SMS5_PATH.'/sms5.lib.php');
}
?>

View File

@ -368,6 +368,14 @@ var win_zip = function(href) {
new_win.focus();
}
/**
* sms5 창
**/
var win_sms5 = function(href) {
var new_win = window.open(href, 'win_zip', 'width=474, height=560, scrollbars=1');
new_win.focus();
}
/**
* 새로운 비밀번호 분실 창 : 101123
**/
@ -452,6 +460,11 @@ $(function(){
return false;
});
$(".win_sms5").click(function() {
win_sms5(this.href);
return false;
});
/*
$(".win_poll").click(function() {
win_poll(this.href);

93
js/jquery.sms_paging.js Normal file
View File

@ -0,0 +1,93 @@
/**************************************************************************************
* jQuery Paging 0.1.7
* by composite (ukjinplant@msn.com)
* http://composite.tistory.com
* This project licensed under a MIT License.
**************************************************************************************/;
(function($){
//default properties.
var a=/a/i,defs={
liitem:'li', item:'a',next:'[&gt;{5}]',prev:'[{4}&lt;]',format:'[{0}]',
itemClass:'',appendhtml:'',sideClass:'paging-side',prevClass:'paging-side',
itemCurrent:'active',length:10,max:1,current:1,append:false
,href:'#{0}',event:true,first:'[1&lt;&lt;]',last:'[&gt;&gt;{6}]'
},InStr=function(strSearch, charSearchFor) {
return strSearch.indexOf(charSearchFor);
},format=function(str){
var arg=arguments;
return str.replace(/\{(\d+)\}/g,function(m,d){
if(+d<0) return m;
else return arg[+d+1]||"";
});
},item,make=function(op,page,cls,str){
var is_current = false;
if( InStr( cls , op.itemCurrent) > -1 ){
item=document.createElement("strong");
is_current = true;
} else {
item=document.createElement(op.item);
}
item.className=cls;
item.innerHTML=format(str,page,op.length,op.start,op.end,op.start-1,op.end+1,op.max);
if(a.test(op.item)) item.href=format(op.href,page);
if(op.event){
$(item).bind('click',function(e){
var fired=true;
if($.isFunction(op.onclick)) fired=op.onclick.call(item,e,page,op);
if(fired==undefined||fired)
op.origin.paging($.extend({},op,{current:page}));
return fired;
});
/*
$liitem= $(document.createElement(op.liitem));
$liitem.addClass(cls);
$liitem.append($(item));
*/
if(op.appendhtml){
$(item).append(op.appendhtml);
}
$(item).appendTo(op.origin);
if( is_current ){
$(item).prepend('<span class="sound_only">열린</span>');
} else {
(op.origin).append('\n');
}
//bind event for each elements.
var ev='on';
switch(str){
case op.prev:ev+='prev';break;
case op.next:ev+='next';break;
case op.first:ev+='first';break;
case op.last:ev+='last';break;
default:ev+='item';break;
}
if($.isFunction(op[ev])) op[ev].call(item,page,op);
}
return item;
};
$.fn.paging=function(op){
op=$.extend({origin:this},defs,op||{});this.html('');
if(op.max<1) op.max=1; if(op.current<1) op.current=1;
op.start=Math.floor((op.current-1)/op.length)*op.length+1;
op.end=op.start-1+op.length;
if(op.end>op.max) op.end=op.max;
if(!op.append) this.empty();
//prev button
if(op.current>op.length){
//if(op.first!==false) make(op,1,op.sideClass,op.first);
make(op,op.start-1,op.prevClass,op.prev);
}
//pages button
for(var i=op.start;i<=op.end;i++){
make(op,i,op.itemClass+(i==op.current?' '+op.itemCurrent:''),op.format);
}
//next button
if(op.current<=Math.floor(op.max/op.length)*op.length){
if(op.max > op.length && op.max > op.end ){ make(op,op.end+1,op.sideClass,op.next); }
//if(op.last!==false) make(op,op.max,op.sideClass,op.last);
}
//last button
};
})(jQuery);

View File

@ -1205,7 +1205,7 @@ function get_sideview($mb_id, $name='', $email='', $homepage='')
{
global $config;
global $g5;
global $bo_table, $sca, $is_admin;
global $bo_table, $sca, $is_admin, $member;
$email = base64_encode($email);
$homepage = set_http($homepage);
@ -1273,6 +1273,10 @@ function get_sideview($mb_id, $name='', $email='', $homepage='')
}
if($mb_id)
$str2 .= "<a href=\"".G5_BBS_URL."/new.php?mb_id=".$mb_id."\">전체게시물</a>\n";
if($g5['sms5_use_sideview']){
$mb = get_member($mb_id, " mb_open, mb_sms , mb_hp ");
if( $mb['mb_open'] && $mb['mb_sms'] && $mb['mb_hp'] ) $str2 .= "<a href=\"".G5_SMS5_URL."/?mb_id=".$mb_id."\" class=\"win_sms5\" target=\"_blank\">문자보내기</a>\n";
}
if($is_admin == "super" && $mb_id) {
$str2 .= "<a href=\"".G5_ADMIN_URL."/member_form.php?w=u&amp;mb_id=".$mb_id."\" target=\"_blank\">회원정보변경</a>\n";
$str2 .= "<a href=\"".G5_ADMIN_URL."/point_list.php?sfl=mb_id&amp;stx=".$mb_id."\" target=\"_blank\">포인트내역</a>\n";

933
plugin/sms5/JSON.php Normal file
View File

@ -0,0 +1,933 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* Converts to and from JSON format.
*
* JSON (JavaScript Object Notation) is a lightweight data-interchange
* format. It is easy for humans to read and write. It is easy for machines
* to parse and generate. It is based on a subset of the JavaScript
* Programming Language, Standard ECMA-262 3rd Edition - December 1999.
* This feature can also be found in Python. JSON is a text format that is
* completely language independent but uses conventions that are familiar
* to programmers of the C-family of languages, including C, C++, C#, Java,
* JavaScript, Perl, TCL, and many others. These properties make JSON an
* ideal data-interchange language.
*
* This package provides a simple encoder and decoder for JSON notation. It
* is intended for use with client-side Javascript applications that make
* use of HTTPRequest to perform server communication functions - data can
* be encoded into JSON notation for use in a client-side javascript, or
* decoded from incoming Javascript requests. JSON format is native to
* Javascript, and can be directly eval()'ed with no further parsing
* overhead
*
* All strings should be in ASCII or UTF-8 format!
*
* LICENSE: Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met: Redistributions of source code must retain the
* above copyright notice, this list of conditions and the following
* disclaimer. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* @category
* @package Services_JSON
* @author Michal Migurski <mike-json@teczno.com>
* @author Matt Knapp <mdknapp[at]gmail[dot]com>
* @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
* @copyright 2005 Michal Migurski
* @version CVS: $Id: JSON.php 305040 2010-11-02 23:19:03Z alan_k $
* @license http://www.opensource.org/licenses/bsd-license.php
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
*/
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_SLICE', 1);
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_IN_STR', 2);
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_IN_ARR', 3);
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_IN_OBJ', 4);
/**
* Marker constant for Services_JSON::decode(), used to flag stack state
*/
define('SERVICES_JSON_IN_CMT', 5);
/**
* Behavior switch for Services_JSON::decode()
*/
define('SERVICES_JSON_LOOSE_TYPE', 16);
/**
* Behavior switch for Services_JSON::decode()
*/
define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
/**
* Behavior switch for Services_JSON::decode()
*/
define('SERVICES_JSON_USE_TO_JSON', 64);
/**
* Converts to and from JSON format.
*
* Brief example of use:
*
* <code>
* // create a new instance of Services_JSON
* $json = new Services_JSON();
*
* // convert a complexe value to JSON notation, and send it to the browser
* $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
* $output = $json->encode($value);
*
* print($output);
* // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
*
* // accept incoming POST data, assumed to be in JSON notation
* $input = file_get_contents('php://input', 1000000);
* $value = $json->decode($input);
* </code>
*/
class Services_JSON
{
/**
* constructs a new JSON instance
*
* @param int $use object behavior flags; combine with boolean-OR
*
* possible values:
* - SERVICES_JSON_LOOSE_TYPE: loose typing.
* "{...}" syntax creates associative arrays
* instead of objects in decode().
* - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
* Values which can't be encoded (e.g. resources)
* appear as NULL instead of throwing errors.
* By default, a deeply-nested resource will
* bubble up with an error, so all return values
* from encode() should be checked with isError()
* - SERVICES_JSON_USE_TO_JSON: call toJSON when serializing objects
* It serializes the return value from the toJSON call rather
* than the object it'self, toJSON can return associative arrays,
* strings or numbers, if you return an object, make sure it does
* not have a toJSON method, otherwise an error will occur.
*/
function Services_JSON($use = 0)
{
$this->use = $use;
$this->_mb_strlen = function_exists('mb_strlen');
$this->_mb_convert_encoding = function_exists('mb_convert_encoding');
$this->_mb_substr = function_exists('mb_substr');
}
// private - cache the mbstring lookup results..
var $_mb_strlen = false;
var $_mb_substr = false;
var $_mb_convert_encoding = false;
/**
* convert a string from one UTF-16 char to one UTF-8 char
*
* Normally should be handled by mb_convert_encoding, but
* provides a slower PHP-only method for installations
* that lack the multibye string extension.
*
* @param string $utf16 UTF-16 character
* @return string UTF-8 character
* @access private
*/
function utf162utf8($utf16)
{
// oh please oh please oh please oh please oh please
if($this->_mb_convert_encoding) {
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
}
$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
switch(true) {
case ((0x7F & $bytes) == $bytes):
// this case should never be reached, because we are in ASCII range
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0x7F & $bytes);
case (0x07FF & $bytes) == $bytes:
// return a 2-byte UTF-8 character
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0xC0 | (($bytes >> 6) & 0x1F))
. chr(0x80 | ($bytes & 0x3F));
case (0xFFFF & $bytes) == $bytes:
// return a 3-byte UTF-8 character
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0xE0 | (($bytes >> 12) & 0x0F))
. chr(0x80 | (($bytes >> 6) & 0x3F))
. chr(0x80 | ($bytes & 0x3F));
}
// ignoring UTF-32 for now, sorry
return '';
}
/**
* convert a string from one UTF-8 char to one UTF-16 char
*
* Normally should be handled by mb_convert_encoding, but
* provides a slower PHP-only method for installations
* that lack the multibye string extension.
*
* @param string $utf8 UTF-8 character
* @return string UTF-16 character
* @access private
*/
function utf82utf16($utf8)
{
// oh please oh please oh please oh please oh please
if($this->_mb_convert_encoding) {
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
}
switch($this->strlen8($utf8)) {
case 1:
// this case should never be reached, because we are in ASCII range
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return $utf8;
case 2:
// return a UTF-16 character from a 2-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0x07 & (ord($utf8{0}) >> 2))
. chr((0xC0 & (ord($utf8{0}) << 6))
| (0x3F & ord($utf8{1})));
case 3:
// return a UTF-16 character from a 3-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr((0xF0 & (ord($utf8{0}) << 4))
| (0x0F & (ord($utf8{1}) >> 2)))
. chr((0xC0 & (ord($utf8{1}) << 6))
| (0x7F & ord($utf8{2})));
}
// ignoring UTF-32 for now, sorry
return '';
}
/**
* encodes an arbitrary variable into JSON format (and sends JSON Header)
*
* @param mixed $var any number, boolean, string, array, or object to be encoded.
* see argument 1 to Services_JSON() above for array-parsing behavior.
* if var is a strng, note that encode() always expects it
* to be in ASCII or UTF-8 format!
*
* @return mixed JSON string representation of input var or an error if a problem occurs
* @access public
*/
function encode($var)
{
header('Content-type: application/json');
return $this->encodeUnsafe($var);
}
/**
* encodes an arbitrary variable into JSON format without JSON Header - warning - may allow XSS!!!!)
*
* @param mixed $var any number, boolean, string, array, or object to be encoded.
* see argument 1 to Services_JSON() above for array-parsing behavior.
* if var is a strng, note that encode() always expects it
* to be in ASCII or UTF-8 format!
*
* @return mixed JSON string representation of input var or an error if a problem occurs
* @access public
*/
function encodeUnsafe($var)
{
// see bug #16908 - regarding numeric locale printing
$lc = setlocale(LC_NUMERIC, 0);
setlocale(LC_NUMERIC, 'C');
$ret = $this->_encode($var);
setlocale(LC_NUMERIC, $lc);
return $ret;
}
/**
* PRIVATE CODE that does the work of encodes an arbitrary variable into JSON format
*
* @param mixed $var any number, boolean, string, array, or object to be encoded.
* see argument 1 to Services_JSON() above for array-parsing behavior.
* if var is a strng, note that encode() always expects it
* to be in ASCII or UTF-8 format!
*
* @return mixed JSON string representation of input var or an error if a problem occurs
* @access public
*/
function _encode($var)
{
switch (gettype($var)) {
case 'boolean':
return $var ? 'true' : 'false';
case 'NULL':
return 'null';
case 'integer':
return (int) $var;
case 'double':
case 'float':
return (float) $var;
case 'string':
// STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
$ascii = '';
$strlen_var = $this->strlen8($var);
/*
* Iterate over every character in the string,
* escaping with a slash or encoding to UTF-8 where necessary
*/
for ($c = 0; $c < $strlen_var; ++$c) {
$ord_var_c = ord($var{$c});
switch (true) {
case $ord_var_c == 0x08:
$ascii .= '\b';
break;
case $ord_var_c == 0x09:
$ascii .= '\t';
break;
case $ord_var_c == 0x0A:
$ascii .= '\n';
break;
case $ord_var_c == 0x0C:
$ascii .= '\f';
break;
case $ord_var_c == 0x0D:
$ascii .= '\r';
break;
case $ord_var_c == 0x22:
case $ord_var_c == 0x2F:
case $ord_var_c == 0x5C:
// double quote, slash, slosh
$ascii .= '\\'.$var{$c};
break;
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
// characters U-00000000 - U-0000007F (same as ASCII)
$ascii .= $var{$c};
break;
case (($ord_var_c & 0xE0) == 0xC0):
// characters U-00000080 - U-000007FF, mask 110XXXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
if ($c+1 >= $strlen_var) {
$c += 1;
$ascii .= '?';
break;
}
$char = pack('C*', $ord_var_c, ord($var{$c + 1}));
$c += 1;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
case (($ord_var_c & 0xF0) == 0xE0):
if ($c+2 >= $strlen_var) {
$c += 2;
$ascii .= '?';
break;
}
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
@ord($var{$c + 1}),
@ord($var{$c + 2}));
$c += 2;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
case (($ord_var_c & 0xF8) == 0xF0):
if ($c+3 >= $strlen_var) {
$c += 3;
$ascii .= '?';
break;
}
// characters U-00010000 - U-001FFFFF, mask 11110XXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}),
ord($var{$c + 3}));
$c += 3;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
case (($ord_var_c & 0xFC) == 0xF8):
// characters U-00200000 - U-03FFFFFF, mask 111110XX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
if ($c+4 >= $strlen_var) {
$c += 4;
$ascii .= '?';
break;
}
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}),
ord($var{$c + 3}),
ord($var{$c + 4}));
$c += 4;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
case (($ord_var_c & 0xFE) == 0xFC):
if ($c+5 >= $strlen_var) {
$c += 5;
$ascii .= '?';
break;
}
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
ord($var{$c + 1}),
ord($var{$c + 2}),
ord($var{$c + 3}),
ord($var{$c + 4}),
ord($var{$c + 5}));
$c += 5;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
break;
}
}
return '"'.$ascii.'"';
case 'array':
/*
* As per JSON spec if any array key is not an integer
* we must treat the the whole array as an object. We
* also try to catch a sparsely populated associative
* array with numeric keys here because some JS engines
* will create an array with empty indexes up to
* max_index which can cause memory issues and because
* the keys, which may be relevant, will be remapped
* otherwise.
*
* As per the ECMA and JSON specification an object may
* have any string as a property. Unfortunately due to
* a hole in the ECMA specification if the key is a
* ECMA reserved word or starts with a digit the
* parameter is only accessible using ECMAScript's
* bracket notation.
*/
// treat as a JSON object
if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
$properties = array_map(array($this, 'name_value'),
array_keys($var),
array_values($var));
foreach($properties as $property) {
if(Services_JSON::isError($property)) {
return $property;
}
}
return '{' . join(',', $properties) . '}';
}
// treat it like a regular array
$elements = array_map(array($this, '_encode'), $var);
foreach($elements as $element) {
if(Services_JSON::isError($element)) {
return $element;
}
}
return '[' . join(',', $elements) . ']';
case 'object':
// support toJSON methods.
if (($this->use & SERVICES_JSON_USE_TO_JSON) && method_exists($var, 'toJSON')) {
// this may end up allowing unlimited recursion
// so we check the return value to make sure it's not got the same method.
$recode = $var->toJSON();
if (method_exists($recode, 'toJSON')) {
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
? 'null'
: new Services_JSON_Error(class_name($var).
" toJSON returned an object with a toJSON method.");
}
return $this->_encode( $recode );
}
$vars = get_object_vars($var);
$properties = array_map(array($this, 'name_value'),
array_keys($vars),
array_values($vars));
foreach($properties as $property) {
if(Services_JSON::isError($property)) {
return $property;
}
}
return '{' . join(',', $properties) . '}';
default:
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
? 'null'
: new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
}
}
/**
* array-walking function for use in generating JSON-formatted name-value pairs
*
* @param string $name name of key to use
* @param mixed $value reference to an array element to be encoded
*
* @return string JSON-formatted name-value pair, like '"name":value'
* @access private
*/
function name_value($name, $value)
{
$encoded_value = $this->_encode($value);
if(Services_JSON::isError($encoded_value)) {
return $encoded_value;
}
return $this->_encode(strval($name)) . ':' . $encoded_value;
}
/**
* reduce a string by removing leading and trailing comments and whitespace
*
* @param $str string string value to strip of comments and whitespace
*
* @return string string value stripped of comments and whitespace
* @access private
*/
function reduce_string($str)
{
$str = preg_replace(array(
// eliminate single line comments in '// ...' form
'#^\s*//(.+)$#m',
// eliminate multi-line comments in '/* ... */' form, at start of string
'#^\s*/\*(.+)\*/#Us',
// eliminate multi-line comments in '/* ... */' form, at end of string
'#/\*(.+)\*/\s*$#Us'
), '', $str);
// eliminate extraneous space
return trim($str);
}
/**
* decodes a JSON string into appropriate variable
*
* @param string $str JSON-formatted string
*
* @return mixed number, boolean, string, array, or object
* corresponding to given JSON input string.
* See argument 1 to Services_JSON() above for object-output behavior.
* Note that decode() always returns strings
* in ASCII or UTF-8 format!
* @access public
*/
function decode($str)
{
$str = $this->reduce_string($str);
switch (strtolower($str)) {
case 'true':
return true;
case 'false':
return false;
case 'null':
return null;
default:
$m = array();
if (is_numeric($str)) {
// Lookie-loo, it's a number
// This would work on its own, but I'm trying to be
// good about returning integers where appropriate:
// return (float)$str;
// Return float or int, as appropriate
return ((float)$str == (integer)$str)
? (integer)$str
: (float)$str;
} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
// STRINGS RETURNED IN UTF-8 FORMAT
$delim = $this->substr8($str, 0, 1);
$chrs = $this->substr8($str, 1, -1);
$utf8 = '';
$strlen_chrs = $this->strlen8($chrs);
for ($c = 0; $c < $strlen_chrs; ++$c) {
$substr_chrs_c_2 = $this->substr8($chrs, $c, 2);
$ord_chrs_c = ord($chrs{$c});
switch (true) {
case $substr_chrs_c_2 == '\b':
$utf8 .= chr(0x08);
++$c;
break;
case $substr_chrs_c_2 == '\t':
$utf8 .= chr(0x09);
++$c;
break;
case $substr_chrs_c_2 == '\n':
$utf8 .= chr(0x0A);
++$c;
break;
case $substr_chrs_c_2 == '\f':
$utf8 .= chr(0x0C);
++$c;
break;
case $substr_chrs_c_2 == '\r':
$utf8 .= chr(0x0D);
++$c;
break;
case $substr_chrs_c_2 == '\\"':
case $substr_chrs_c_2 == '\\\'':
case $substr_chrs_c_2 == '\\\\':
case $substr_chrs_c_2 == '\\/':
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
$utf8 .= $chrs{++$c};
}
break;
case preg_match('/\\\u[0-9A-F]{4}/i', $this->substr8($chrs, $c, 6)):
// single, escaped unicode character
$utf16 = chr(hexdec($this->substr8($chrs, ($c + 2), 2)))
. chr(hexdec($this->substr8($chrs, ($c + 4), 2)));
$utf8 .= $this->utf162utf8($utf16);
$c += 5;
break;
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
$utf8 .= $chrs{$c};
break;
case ($ord_chrs_c & 0xE0) == 0xC0:
// characters U-00000080 - U-000007FF, mask 110XXXXX
//see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$utf8 .= $this->substr8($chrs, $c, 2);
++$c;
break;
case ($ord_chrs_c & 0xF0) == 0xE0:
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$utf8 .= $this->substr8($chrs, $c, 3);
$c += 2;
break;
case ($ord_chrs_c & 0xF8) == 0xF0:
// characters U-00010000 - U-001FFFFF, mask 11110XXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$utf8 .= $this->substr8($chrs, $c, 4);
$c += 3;
break;
case ($ord_chrs_c & 0xFC) == 0xF8:
// characters U-00200000 - U-03FFFFFF, mask 111110XX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$utf8 .= $this->substr8($chrs, $c, 5);
$c += 4;
break;
case ($ord_chrs_c & 0xFE) == 0xFC:
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$utf8 .= $this->substr8($chrs, $c, 6);
$c += 5;
break;
}
}
return $utf8;
} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
// array, or object notation
if ($str{0} == '[') {
$stk = array(SERVICES_JSON_IN_ARR);
$arr = array();
} else {
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
$stk = array(SERVICES_JSON_IN_OBJ);
$obj = array();
} else {
$stk = array(SERVICES_JSON_IN_OBJ);
$obj = new stdClass();
}
}
array_push($stk, array('what' => SERVICES_JSON_SLICE,
'where' => 0,
'delim' => false));
$chrs = $this->substr8($str, 1, -1);
$chrs = $this->reduce_string($chrs);
if ($chrs == '') {
if (reset($stk) == SERVICES_JSON_IN_ARR) {
return $arr;
} else {
return $obj;
}
}
//print("\nparsing {$chrs}\n");
$strlen_chrs = $this->strlen8($chrs);
for ($c = 0; $c <= $strlen_chrs; ++$c) {
$top = end($stk);
$substr_chrs_c_2 = $this->substr8($chrs, $c, 2);
if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
// found a comma that is not inside a string, array, etc.,
// OR we've reached the end of the character list
$slice = $this->substr8($chrs, $top['where'], ($c - $top['where']));
array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
//print("Found split at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
if (reset($stk) == SERVICES_JSON_IN_ARR) {
// we are in an array, so just push an element onto the stack
array_push($arr, $this->decode($slice));
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
// we are in an object, so figure
// out the property name and set an
// element in an associative array,
// for now
$parts = array();
if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:/Uis', $slice, $parts)) {
// "name":value pair
$key = $this->decode($parts[1]);
$val = $this->decode(trim(substr($slice, strlen($parts[0])), ", \t\n\r\0\x0B"));
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
$obj[$key] = $val;
} else {
$obj->$key = $val;
}
} elseif (preg_match('/^\s*(\w+)\s*:/Uis', $slice, $parts)) {
// name:value pair, where name is unquoted
$key = $parts[1];
$val = $this->decode(trim(substr($slice, strlen($parts[0])), ", \t\n\r\0\x0B"));
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
$obj[$key] = $val;
} else {
$obj->$key = $val;
}
}
}
} elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
// found a quote, and we are not inside a string
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
//print("Found start of string at {$c}\n");
} elseif (($chrs{$c} == $top['delim']) &&
($top['what'] == SERVICES_JSON_IN_STR) &&
(($this->strlen8($this->substr8($chrs, 0, $c)) - $this->strlen8(rtrim($this->substr8($chrs, 0, $c), '\\'))) % 2 != 1)) {
// found a quote, we're in a string, and it's not escaped
// we know that it's not escaped becase there is _not_ an
// odd number of backslashes at the end of the string so far
array_pop($stk);
//print("Found end of string at {$c}: ".$this->substr8($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
} elseif (($chrs{$c} == '[') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
// found a left-bracket, and we are in an array, object, or slice
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
//print("Found start of array at {$c}\n");
} elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
// found a right-bracket, and we're in an array
array_pop($stk);
//print("Found end of array at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
} elseif (($chrs{$c} == '{') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
// found a left-brace, and we are in an array, object, or slice
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
//print("Found start of object at {$c}\n");
} elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
// found a right-brace, and we're in an object
array_pop($stk);
//print("Found end of object at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
} elseif (($substr_chrs_c_2 == '/*') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
// found a comment start, and we are in an array, object, or slice
array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
$c++;
//print("Found start of comment at {$c}\n");
} elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
// found a comment end, and we're in one now
array_pop($stk);
$c++;
for ($i = $top['where']; $i <= $c; ++$i)
$chrs = substr_replace($chrs, ' ', $i, 1);
//print("Found end of comment at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
}
}
if (reset($stk) == SERVICES_JSON_IN_ARR) {
return $arr;
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
return $obj;
}
}
}
}
/**
* @todo Ultimately, this should just call PEAR::isError()
*/
function isError($data, $code = null)
{
if (class_exists('pear')) {
return PEAR::isError($data, $code);
} elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
is_subclass_of($data, 'services_json_error'))) {
return true;
}
return false;
}
/**
* Calculates length of string in bytes
* @param string
* @return integer length
*/
function strlen8( $str )
{
if ( $this->_mb_strlen ) {
return mb_strlen( $str, "8bit" );
}
return strlen( $str );
}
/**
* Returns part of a string, interpreting $start and $length as number of bytes.
* @param string
* @param integer start
* @param integer length
* @return integer length
*/
function substr8( $string, $start, $length=false )
{
if ( $length === false ) {
$length = $this->strlen8( $string ) - $start;
}
if ( $this->_mb_substr ) {
return mb_substr( $string, $start, $length, "8bit" );
}
return substr( $string, $start, $length );
}
}
if (class_exists('PEAR_Error')) {
class Services_JSON_Error extends PEAR_Error
{
function Services_JSON_Error($message = 'unknown error', $code = null,
$mode = null, $options = null, $userinfo = null)
{
parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
}
}
} else {
/**
* @todo Ultimately, this class shall be descended from PEAR_Error
*/
class Services_JSON_Error
{
function Services_JSON_Error($message = 'unknown error', $code = null,
$mode = null, $options = null, $userinfo = null)
{
}
}
}

3
plugin/sms5/_common.php Normal file
View File

@ -0,0 +1,3 @@
<?php
include_once('../../common.php');
?>

View File

@ -0,0 +1,70 @@
<?php
include_once("./_common.php");
include_once("./JSON.php");
if( !function_exists('json_encode') ) {
function json_encode($data) {
$json = new Services_JSON();
return( $json->encode($data) );
}
}
$page_size = 9;
if (!$page) $page = 1;
if (is_numeric($fg_no))
$sql_group = " and fg_no='$fg_no' ";
else
$sql_group = "";
if ($st == 'all') {
$sql_search = "and (fo_name like '%{$sv}%' or fo_content like '%{$sv}%')";
} else if ($st == 'name') {
$sql_search = "and fo_name like '%{$sv}%'";
} else if ($st == 'content') {
$sql_search = "and fo_content like '%{$sv}%'";
} else {
$sql_search = '';
}
$total_res = sql_fetch("select count(*) as cnt from {$g5['sms5_form_table']} where fg_member = 1 $sql_group $sql_search");
$total_count = $total_res['cnt'];
$total_page = (int)($total_count/$page_size) + ($total_count%$page_size==0 ? 0 : 1);
$page_start = $page_size * ( $page - 1 );
$vnum = $total_count - (($page-1) * $page_size);
$group = array();
$qry = sql_query("select * from {$g5['sms5_form_group_table']} where fg_member = 1 order by fg_name");
while ($res = sql_fetch_array($qry)) array_push($group, $res);
$res = sql_fetch("select count(*) as cnt from {$g5['sms5_form_table']} where fg_no=0");
$no_count = $res['cnt'];
$count = 1;
$qry = sql_query("select * from {$g5['sms5_form_table']} where fg_member = 1 $sql_group $sql_search order by fo_no desc limit $page_start, $page_size");
$list_text = array();
for($k=0;$res = sql_fetch_array($qry);$k++)
{
$tmp = sql_fetch("select fg_name from {$g5['sms5_form_group_table']} where fg_no='{$res['fg_no']}'");
if (!$tmp)
$group_name = '미분류';
else
$group_name = $tmp['fg_name'];
$list_text[$k]['fo_no'] = $res['fo_no'];
$list_text[$k]['fo_content'] = $res['fo_content'];
$list_text[$k]['fo_content'] = $res['fo_content'];
$list_text[$k]['fo_name'] = cut_str($res['fo_name'],20);
}
$arr_ajax_msg['error'] = "";
$arr_ajax_msg['list_text'] = $list_text;
$arr_ajax_msg['page'] = $page;
$arr_ajax_msg['total_count'] = $total_count;
$arr_ajax_msg['total_page'] = $total_page;
die( json_encode($arr_ajax_msg) );
?>

11
plugin/sms5/index.php Normal file
View File

@ -0,0 +1,11 @@
<?php
//SMS5 메인
include_once('./_common.php');
$g5['title'] = "SMS5";
include_once(G5_PATH.'/head.sub.php');
include_once("./write.php");
include_once(G5_PATH.'/tail.sub.php');
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 B

View File

@ -0,0 +1,48 @@
#sms5_send {position:relative}
.sms5_box {position:relative;padding:10px;border-radius:5px;background:#fbec99}
.sms5_box .box_ico {position:absolute;top:20px;left:-7px;width:7px;height:13px;background:url('img/box_ico.gif') no-repeat}
.sms5_box .box_txt {border:0;background:transparent;word-break:break-all;resize:none;overflow:hidden}
.sms5_box .box_square {width:100px;height:90px}
#send_write {padding:0 20px !important}
#send_write h2 {padding:0 0 10px}
#send_write .sms5_box {margin:0 0 5px;text-align:center}
#send_write .box_txt {width:90%;height:80px}
#wr_message_lbl {position:absolute;top:45px;left:48%;color:#999;font-size:0.95em;letter-spacing:-0.1em}
.write_inner {position:relative;padding:10px 0;border-bottom:1px solid #efefef;zoom:1}
.write_inner:after {display:block;visibility:hidden;clear:both;content:''}
.write_inner h2 {margin:0;padding:0 0 20px !important}
.write_floater {position:absolute;top:10px;right:0;text-align:right}
.write_floater_btn {margin:0;padding:0;border:0;background:transparent;color:#999;font-size:0.95em;letter-spacing:-0.1em}
#write_rcv {margin:0 0 10px}
#write_rcv strong {display:inline-block;margin:0 10px 0 0}
#write_reply label {display:inline-block;margin:0 10px 0 0;font-weight:bold}
#write_reply #mh_reply {padding:0 5px;width:90px;height:20px;border:1px solid #e9e9e9;text-align:center;line-height:1.8em}
#write_rsv .rsv_line {display:block;height:10px}
.write_scemo strong {display:block;margin:0 0 10px}
.write_scemo .scemo_btn {margin:0 0 1px;padding:10px 0;width:100%;border:0;background:#686868;color:#fff;text-align:center}
.write_scemo .scemo_list {display:none;letter-spacing:-4px}
.write_scemo .list_closer {margin:5px 0;text-align:right}
.write_scemo .list_closer_btn {margin:0;padding:10px 0;width:100%;border:0;background:#383838;color:#fff;letter-spacing:0}
.write_scemo .scemo_add {margin:0;padding:0;width:25%;height:40px;border:1px solid #e9e9e9;background:transparent;letter-spacing:0}
#write_sc .scemo_list {margin:0 0 20px}
#sms_byte {position:absolute;top:-27px;right:0;color:#999}
#send_emo {position:relative;padding:20px;border-top:1px solid #e9e9e9;background:#f7f7f7}
#send_emo h2 {margin:0 0 20px}
#send_emo .tmp_loading {display:block;padding:180px 0 0;text-align:center}
#send_emo #emo_sel {position:absolute;top:20px;right:20px;margin:0}
#send_emo .emo_list {margin:0;padding:0;list-style:none}
#send_emo li {float:left;margin:0 2% 10px 0;width:49%}
#send_emo li:nth-of-type(even) {margin:0 0 10px}
#send_emo .sms5_box {background:#fbec99}
#send_emo .box_ico {display:none}
#send_emo .box_txt {cursor:pointer}
#send_emo .emo_tit {display:block;height:20px;line-height:2em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#send_emo .btn_submit {padding:0 5px;height:24px;border:1px solid #ccc;background:#fafafa;color:#000;font-size:0.95em;vertical-align:middle;cursor:pointer}

View File

@ -0,0 +1,50 @@
#sms5_send {position:relative}
.sms5_box {position:relative;padding:10px;border-radius:5px;background:#fbec99}
.sms5_box .box_ico {position:absolute;top:20px;left:-7px;width:7px;height:13px;background:url('img/box_ico.gif') no-repeat}
.sms5_box .box_txt {border:0;background:transparent;word-break:break-all;resize:none;overflow:hidden}
.sms5_box .box_square {width:100px;height:90px}
#send_write {padding:0 20px !important}
#send_write h2 {padding:0 0 10px}
#send_write .sms5_box {margin:0 0 5px;text-align:center}
#send_write .box_txt {width:390px;height:80px}
#wr_message_lbl {position:absolute;top:45px;left:200px;color:#999;font-size:0.95em;letter-spacing:-0.1em}
.write_inner {position:relative;padding:10px 0;border-bottom:1px solid #efefef;zoom:1}
.write_inner:after {display:block;visibility:hidden;clear:both;content:''}
.write_inner h2 {margin:0;padding:0 0 10px !important}
.write_floater {position:absolute;top:15px;right:0;text-align:right}
.write_floater_btn {margin:0;padding:0;border:0;background:transparent;color:#999;font-size:0.95em;letter-spacing:-0.1em}
#write_rcv {float:left;height:22px;line-height:1.8em}
#write_rcv strong {display:inline-block;margin:0 10px 0 0}
#write_reply {float:right}
#write_reply label {display:inline-block;margin:0 10px 0 0;font-weight:bold}
#write_reply #mh_reply {padding:0 5px;width:90px;height:20px;border:1px solid #e9e9e9;text-align:center;line-height:1.8em}
.write_scemo {width:48%}
.write_scemo strong {display:block;margin:0 0 10px}
.write_scemo .scemo_list {letter-spacing:-4px}
.write_scemo .scemo_add {margin:0;padding:0;height:25px;border:1px solid #e9e9e9;background:transparent;letter-spacing:0}
#write_sc {float:left}
#write_sc .scemo_add {width:25px}
#write_emo {float:right}
#write_emo .scemo_list {text-align:right}
#write_emo .scemo_add {width:66px}
#write_emo .emo_long {}
#sms_byte {position:absolute;top:-27px;right:0;color:#999}
#send_emo {position:relative;padding:20px;border-top:1px solid #e9e9e9;background:#f7f7f7}
#send_emo h2 {margin:0 0 20px}
#send_emo .tmp_loading {display:block;padding:180px 0 0;text-align:center}
#send_emo #emo_sel {position:absolute;top:20px;right:20px;margin:0}
#send_emo .emo_list {margin:0;padding:0;list-style:none}
#send_emo li {float:left;margin:0 10px 10px 0 !important;margin:0 5px 10px 0;width:113px !important;width:110px}
#send_emo li:nth-of-type(3n) {margin:0 0 10px !important}
#send_emo .sms5_box {background:#fbec99}
#send_emo .box_ico {display:none}
#send_emo .box_txt {cursor:pointer}
#send_emo .emo_tit {display:block;height:20px;line-height:2em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#send_emo .btn_submit {padding:0 5px;height:24px;border:1px solid #ccc;background:#fafafa;color:#000;font-size:0.95em;vertical-align:middle;cursor:pointer}

View File

@ -0,0 +1,378 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$sms5_skin_url.'/style.css">', 0);
?>
<div id="sms5_send" class="new_win">
<h1 id="win_title">SMS 보내기</h1>
<div id="send_write">
<form action="<?php echo $action_url?>" onsubmit="return smssend_submit(this);" name="smsform" method="post" autocomplete="off">
<input type="hidden" name="token" value="<?php echo $token?>">
<input type="hidden" name="mh_hp" value="">
<input type="hidden" name="mb_id" value="<?php echo $mb_id?>">
<h2>보낼내용</h2>
<div class="sms5_box">
<span class="box_ico"></span>
<label for="mh_message" id="wr_message_lbl">내용</label>
<textarea name="mh_message" id="mh_message" class="box_txt" onkeyup="byte_check('mh_message', 'sms_bytes');"></textarea>
<div id="sms_byte"><span id="sms_bytes">0</span> / 80 byte</div>
</div>
<div class="write_inner">
<?php if( $mb['mb_id'] ){ //회원 아이디가 있다면 ?>
<div id="write_rcv">
<strong>수신회원</strong> <?php echo $mb['mb_nick']?>
</div>
<?php } ?>
<div id="write_reply">
<label for="mh_reply">회신번호</label>
<input type="text" name="mh_reply" value="<?php echo $member['mb_hp']?>" id="mh_reply" <?php if ($is_admin != 'super') { ?> readonly<?php } ?>>
</div>
</div>
<div id="write_rsv" class="write_inner">
<h2>예약전송</h2>
<div class="write_floater">
<label for="booking_flag"><span class="sound_only">예약전송 </span>사용</label>
<input type="checkbox" name="booking_flag" id="booking_flag" value="true" onclick="booking_show()" >
</div>
<select name="mh_by" id="mh_by" disabled>
<option value="<?php echo date('Y')?>"><?php echo date('Y')?></option>
<option value="<?php echo date('Y')+1?>"><?php echo date('Y')+1?></option>
</select> 년
<select name="mh_bm" id="mh_bm" disabled>
<?php for ($i=1; $i<=12; $i++) { ?>
<option value="<?php echo sprintf("%02d",$i)?>" <?php echo date('m')==$i?'selected':''?>><?php echo sprintf("%02d",$i)?></option>
<?php } ?>
</select> 월
<select name="mh_bd" id="mh_bd" disabled>
<?php for ($i=1; $i<=31; $i++) { ?>
<option value="<?php echo sprintf("%02d",$i)?>" <?php echo date('d')==$i?'selected':''?>><?php echo sprintf("%02d",$i)?></option>
<?php } ?>
</select> 일
<select name="mh_bh" id="mh_bh" disabled>
<?php for ($i=0; $i<24; $i++) { ?>
<option value="<?php echo sprintf("%02d",$i)?>" <?php echo date('H')+1==$i?'selected':''?>><?php echo sprintf("%02d",$i)?></option>
<?php } ?>
</select> 시
<select name="mh_bi" id="mh_bi" disabled>
<?php for ($i=0; $i<=59; $i+=5) { ?>
<option value="<?php echo sprintf("%02d",$i)?>"><?php echo sprintf("%02d",$i)?></option>
<?php } ?>
</select> 분
</div>
<div class="write_inner">
<div id="write_sc" class="write_scemo">
<strong>특수기호</strong>
<div class="scemo_list">
<button type="button" class="scemo_add" onclick="javascript:add('■')">■</button>
<button type="button" class="scemo_add" onclick="javascript:add('□')">□</button>
<button type="button" class="scemo_add" onclick="javascript:add('▣')">▣</button>
<button type="button" class="scemo_add" onclick="javascript:add('◈')">◈</button>
<button type="button" class="scemo_add" onclick="javascript:add('◆')">◆</button>
<button type="button" class="scemo_add" onclick="javascript:add('◇')">◇</button>
<button type="button" class="scemo_add" onclick="javascript:add('♥')">♥</button>
<button type="button" class="scemo_add" onclick="javascript:add('♡')">♡</button>
<button type="button" class="scemo_add" onclick="javascript:add('●')">●</button>
<button type="button" class="scemo_add" onclick="javascript:add('○')">○</button>
<button type="button" class="scemo_add" onclick="javascript:add('▲')">▲</button>
<button type="button" class="scemo_add" onclick="javascript:add('▼')">▼</button>
<button type="button" class="scemo_add" onclick="javascript:add('▶')">▶</button>
<button type="button" class="scemo_add" onclick="javascript:add('▷')">▷</button>
<button type="button" class="scemo_add" onclick="javascript:add('◀')">◀</button>
<button type="button" class="scemo_add" onclick="javascript:add('◁')">◁</button>
<button type="button" class="scemo_add" onclick="javascript:add('☎')">☎</button>
<button type="button" class="scemo_add" onclick="javascript:add('☏')">☏</button>
<button type="button" class="scemo_add" onclick="javascript:add('♠')">♠</button>
<button type="button" class="scemo_add" onclick="javascript:add('♤')">♤</button>
<button type="button" class="scemo_add" onclick="javascript:add('♣')">♣</button>
<button type="button" class="scemo_add" onclick="javascript:add('♧')">♧</button>
<button type="button" class="scemo_add" onclick="javascript:add('★')">★</button>
<button type="button" class="scemo_add" onclick="javascript:add('☆')">☆</button>
<button type="button" class="scemo_add" onclick="javascript:add('☞')">☞</button>
<button type="button" class="scemo_add" onclick="javascript:add('☜')">☜</button>
<button type="button" class="scemo_add" onclick="javascript:add('▒')">▒</button>
<button type="button" class="scemo_add" onclick="javascript:add('⊙')">⊙</button>
<button type="button" class="scemo_add" onclick="javascript:add('㈜')">㈜</button>
<button type="button" class="scemo_add" onclick="javascript:add('№')">№</button>
<button type="button" class="scemo_add" onclick="javascript:add('㉿')">㉿</button>
<button type="button" class="scemo_add" onclick="javascript:add('♨')">♨</button>
<button type="button" class="scemo_add" onclick="javascript:add('™')">™</button>
<button type="button" class="scemo_add" onclick="javascript:add('℡')">℡</button>
<button type="button" class="scemo_add" onclick="javascript:add('∑')">∑</button>
<button type="button" class="scemo_add" onclick="javascript:add('∏')">∏</button>
<button type="button" class="scemo_add" onclick="javascript:add('♬')">♬</button>
<button type="button" class="scemo_add" onclick="javascript:add('♪')">♪</button>
<button type="button" class="scemo_add" onclick="javascript:add('♩')">♩</button>
<button type="button" class="scemo_add" onclick="javascript:add('♭')">♭</button>
</div>
</div>
<div id="write_emo" class="write_scemo">
<strong>이모티콘</strong>
<div class="scemo_list">
<button type="button" class="scemo_add" onclick="javascript:add('*^^*')">*^^*</button>
<button type="button" class="scemo_add" onclick="javascript:add('♡.♡')">♡.♡</button>
<button type="button" class="scemo_add" onclick="javascript:add('@_@')">@_@</button>
<button type="button" class="scemo_add" onclick="javascript:add('☞_☜')">☞_☜</button>
<button type="button" class="scemo_add" onclick="javascript:add('ㅠ ㅠ')">ㅠ ㅠ</button>
<button type="button" class="scemo_add" onclick="javascript:add('Θ.Θ')">Θ.Θ</button>
<button type="button" class="scemo_add" onclick="javascript:add('^_~♥')">^_~♥</button>
<button type="button" class="scemo_add" onclick="javascript:add('~o~')">~o~</button>
<button type="button" class="scemo_add" onclick="javascript:add('★.★')">★.★</button>
<button type="button" class="scemo_add" onclick="javascript:add('(!.!)')">(!.!)</button>
<button type="button" class="scemo_add" onclick="javascript:add('⊙.⊙')">⊙.⊙</button>
<button type="button" class="scemo_add" onclick="javascript:add('q.p')">q.p</button>
<button type="button" class="scemo_add emo_long" onclick="javascript:add('↖(^-^)↗')">↖(^-^)↗</button>
<button type="button" class="scemo_add emo_long" onclick="javascript:add('(*^-^*)')">(*^-^*)</button>
<button type="button" class="scemo_add emo_long" onclick="javascript:add('d(^-^)b')">d(^-^)b</button>
</div>
</div>
</div>
<div class="win_btn">
<input type="submit" value="전송" class="btn_submit">
<button type="button" onclick="window.close();">창닫기</button>
</div>
</form>
</div>
<?php if( count($emoticon_group) ){ //회원에게 공개된 이모티콘 그룹이 있다면 ?>
<div id="send_emo">
<h2>이모티콘 목록</h2>
<form name="emoticon_form">
<label for="emo_sel" class="sound_only">이모티콘 그룹</label>
<select name="fg_no" id="emo_sel">
<option value="" <?php echo $fg_no?'':'selected'?>>전체</option>
<?php for($i=0; $i<count($emoticon_group); $i++) {?>
<option value="<?php echo $emoticon_group[$i]['fg_no']?>"<?php echo ($fg_no==$emoticon_group[$i]['fg_no'])?'selected':''?>><?php echo $emoticon_group[$i]['fg_name']?> (<?php echo number_format($emoticon_group[$i]['fg_count'])?>)</option>
<?php } ?>
</select>
</form>
<ul class="emo_list">
</ul>
<nav class="pg_wrap">
<span class="pg" id="emoticon_pg"></span>
</nav>
<form name="emoticon_search" id="emoticon_search">
<input type="hidden" name="page" id="hidden_page" >
</form>
</div>
<?php } ?>
</div>
<script>
function sms_error(obj, err) {
alert(err);
obj.value = '';
}
function smssend_submit(f)
{
if (!f.mh_message.value)
{
alert('보내실 문자를 입력하십시오.');
f.mh_message.focus();
return false;
}
if (!f.mh_reply.value)
{
alert('발신 번호를 입력하십시오.\n\n발신 번호는 회원정보의 휴대폰번호입니다.');
return false;
}
return true;
//f.submit();
//win.focus();
}
function booking_show()
{
if (document.getElementById('booking_flag').checked) {
document.getElementById('mh_by').disabled = false;
document.getElementById('mh_bm').disabled = false;
document.getElementById('mh_bd').disabled = false;
document.getElementById('mh_bh').disabled = false;
document.getElementById('mh_bi').disabled = false;
} else {
document.getElementById('mh_by').disabled = true;
document.getElementById('mh_bm').disabled = true;
document.getElementById('mh_bd').disabled = true;
document.getElementById('mh_bh').disabled = true;
document.getElementById('mh_bi').disabled = true;
}
}
function add(str) {
var conts = document.getElementById('mh_message');
var bytes = document.getElementById('sms_bytes');
conts.focus();
conts.value+=str;
byte_check('mh_message', 'sms_bytes');
return;
}
function byte_check(mh_message, sms_bytes)
{
var conts = document.getElementById(mh_message);
var bytes = document.getElementById(sms_bytes);
var i = 0;
var cnt = 0;
var exceed = 0;
var ch = '';
for (i=0; i<conts.value.length; i++)
{
ch = conts.value.charAt(i);
if (escape(ch).length > 4) {
cnt += 2;
} else {
cnt += 1;
}
}
bytes.innerHTML = cnt;
if (cnt > 80)
{
exceed = cnt - 80;
alert('메시지 내용은 80바이트를 넘을수 없습니다.\n\n작성하신 메세지 내용은 '+ exceed +'byte가 초과되었습니다.\n\n초과된 부분은 자동으로 삭제됩니다.');
var tcnt = 0;
var xcnt = 0;
var tmp = conts.value;
for (i=0; i<tmp.length; i++)
{
ch = tmp.charAt(i);
if (escape(ch).length > 4) {
tcnt += 2;
} else {
tcnt += 1;
}
if (tcnt > 80) {
tmp = tmp.substring(0,i);
break;
} else {
xcnt = tcnt;
}
}
conts.value = tmp;
bytes.innerHTML = xcnt;
return;
}
}
byte_check('mh_message', 'sms_bytes');
</script>
<script src="<?php echo G5_JS_URL?>/jquery.sms_paging.js"></script>
<script>
var emoticon_list = {
go : function(fo_no){
var wr_message = document.getElementById('mh_message');
//wr_message.focus();
wr_message.value = document.getElementById('fo_contents_' + fo_no).value;
byte_check('mh_message', 'sms_bytes');
}
};
(function($){
$(".box_txt").bind("focus keydown", function(){
$("#wr_message_lbl").hide();
});
var $search_form = $("form#emoticon_search");
emoticon_list.fn_paging = function( hash_val,total_page ){
$('#emoticon_pg').paging({
current:hash_val ? hash_val : 1,
max:total_page == 0 || total_page ? total_page : 45,
length : 5,
liitem : 'span',
format:'{0}',
next:'next',
prev:'prev',
first:'&lt;&lt;',last:'&gt;&gt;',
href:'#',
itemCurrent:'pg_current',
itemClass:'pg_page',
appendhtml:'<span class="sound_only">페이지</span>',
onclick:function(e,page){
e.preventDefault();
$("#hidden_page").val( page );
var params = $($search_form).serialize();
emoticon_list.select_page( params, "json" );
}
});
}
emoticon_list.loading = function( el, src ){
if( !el || !src) return;
$(el).append("<span class='tmp_loading'><img src='"+src+"' title='loading...' ></span>");
}
emoticon_list.loadingEnd = function( el ){
$(".tmp_loading", $(el)).remove();
}
emoticon_list.select_page = function( params, type ){
if( !type ){
type = "json";
}
emoticon_list.loading(".emo_list", "<?php echo $sms5_skin_url?>/img/ajax-loader.gif" ); //로딩 이미지 보여줌
$.ajax({
url: "./ajax.sms_emoticon.php",
cache:false,
timeout : 30000,
dataType:type,
data:params,
success: function(HttpRequest) {
if( type == "json" ){
if (HttpRequest.error) {
alert(HttpRequest.error);
return false;
} else {
var $emoticon_box = $(".emo_list");
var list_text = "";
$.each( HttpRequest.list_text , function(num) {
var list_data = HttpRequest.list_text[num];
list_text = list_text + "<li class=\"screen_list sms5_box\"><span class=\"box_ico\"></span><textarea class=\"sms_textarea box_txt box_square\" readonly onclick=\"emoticon_list.go("+list_data.fo_no+")\">"+list_data.fo_content+"</textarea><textarea id=\"fo_contents_"+list_data.fo_no+"\" style=\"display:none; width:0; height:0\">"+list_data.fo_content+"</textarea><strong class=\"emo_tit\">"+list_data.fo_name+"</strong></li>";
});
if( !list_text ){
list_text = "<li>데이터가 없습니다.</li>";
}
$emoticon_box.html( list_text );
emoticon_list.fn_paging( HttpRequest.page, HttpRequest.total_page );
$("#hidden_page").val( HttpRequest.page );
}
}
emoticon_list.loadingEnd(".emo_list"); //로딩 이미지 지움
}
});
}
$("#emo_sel").bind("change", function(e){
var params = { fg_no : $(this).val() };
$search_form[0].reset();
$("#hidden_fg_no").val( $(this).val() );
emoticon_list.select_page( params, "json" );
});
$search_form.submit(function(e){
e.preventDefault();
var $form = $(this),
params = $(this).serialize();
emoticon_list.select_page( params, "json" );
});
if( $("#emo_sel").length ){
$("#emo_sel").trigger("change");
}
})(jQuery);
</script>

View File

@ -0,0 +1,394 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$sms5_skin_url.'/mobile.css">', 0);
?>
<div id="sms5_send" class="new_win">
<h1 id="win_title">SMS 보내기</h1>
<div id="send_write">
<form action="<?php echo $action_url?>" onsubmit="return smssend_submit(this);" name="smsform" method="post" autocomplete="off">
<input type="hidden" name="token" value="<?php echo $token?>">
<input type="hidden" name="mh_hp" value="">
<input type="hidden" name="mb_id" value="<?php echo $mb_id?>">
<h2>보낼내용</h2>
<div class="sms5_box">
<span class="box_ico"></span>
<label for="mh_message" id="wr_message_lbl">내용</label>
<textarea name="mh_message" id="mh_message" class="box_txt" onkeyup="byte_check('mh_message', 'sms_bytes');"></textarea>
<div id="sms_byte"><span id="sms_bytes">0</span> / 80 byte</div>
</div>
<div class="write_inner">
<?php if( $mb['mb_id'] ){ //회원 아이디가 있다면 ?>
<div id="write_rcv">
<strong>수신회원</strong> <?php echo $mb['mb_nick']?>
</div>
<?php } ?>
<div id="write_reply">
<label for="mh_reply">회신번호</label>
<input type="text" name="mh_reply" value="<?php echo $member['mb_hp']?>" id="mh_reply" <?php if ($is_admin != 'super') { ?> readonly<?php } ?>>
</div>
</div>
<div id="write_rsv" class="write_inner">
<h2>예약전송</h2>
<div class="write_floater">
<label for="booking_flag"><span class="sound_only">예약전송 </span>사용</label>
<input type="checkbox" name="booking_flag" id="booking_flag" value="true" onclick="booking_show()" >
</div>
<select name="mh_by" id="mh_by" disabled>
<option value="<?php echo date('Y')?>"><?php echo date('Y')?></option>
<option value="<?php echo date('Y')+1?>"><?php echo date('Y')+1?></option>
</select> 년
<select name="mh_bm" id="mh_bm" disabled>
<?php for ($i=1; $i<=12; $i++) { ?>
<option value="<?php echo sprintf("%02d",$i)?>" <?php echo date('m')==$i?'selected':''?>><?php echo sprintf("%02d",$i)?></option>
<?php } ?>
</select> 월
<span class="rsv_line"></span>
<select name="mh_bd" id="mh_bd" disabled>
<?php for ($i=1; $i<=31; $i++) { ?>
<option value="<?php echo sprintf("%02d",$i)?>" <?php echo date('d')==$i?'selected':''?>><?php echo sprintf("%02d",$i)?></option>
<?php } ?>
</select> 일
<select name="mh_bh" id="mh_bh" disabled>
<?php for ($i=0; $i<24; $i++) { ?>
<option value="<?php echo sprintf("%02d",$i)?>" <?php echo date('H')+1==$i?'selected':''?>><?php echo sprintf("%02d",$i)?></option>
<?php } ?>
</select> 시
<select name="mh_bi" id="mh_bi" disabled>
<?php for ($i=0; $i<=59; $i+=5) { ?>
<option value="<?php echo sprintf("%02d",$i)?>"><?php echo sprintf("%02d",$i)?></option>
<?php } ?>
</select> 분
</div>
<div class="write_inner">
<div id="write_sc" class="write_scemo">
<button type="button" id="scemo_sc" class="scemo_btn">특수기호</button>
<div class="scemo_list scemo_sc">
<div class="list_closer"><button type="button" class="list_closer_btn">특수기호닫기</button></div>
<button type="button" class="scemo_add" onclick="javascript:add('■')">■</button>
<button type="button" class="scemo_add" onclick="javascript:add('□')">□</button>
<button type="button" class="scemo_add" onclick="javascript:add('▣')">▣</button>
<button type="button" class="scemo_add" onclick="javascript:add('◈')">◈</button>
<button type="button" class="scemo_add" onclick="javascript:add('◆')">◆</button>
<button type="button" class="scemo_add" onclick="javascript:add('◇')">◇</button>
<button type="button" class="scemo_add" onclick="javascript:add('♥')">♥</button>
<button type="button" class="scemo_add" onclick="javascript:add('♡')">♡</button>
<button type="button" class="scemo_add" onclick="javascript:add('●')">●</button>
<button type="button" class="scemo_add" onclick="javascript:add('○')">○</button>
<button type="button" class="scemo_add" onclick="javascript:add('▲')">▲</button>
<button type="button" class="scemo_add" onclick="javascript:add('▼')">▼</button>
<button type="button" class="scemo_add" onclick="javascript:add('▶')">▶</button>
<button type="button" class="scemo_add" onclick="javascript:add('▷')">▷</button>
<button type="button" class="scemo_add" onclick="javascript:add('◀')">◀</button>
<button type="button" class="scemo_add" onclick="javascript:add('◁')">◁</button>
<button type="button" class="scemo_add" onclick="javascript:add('☎')">☎</button>
<button type="button" class="scemo_add" onclick="javascript:add('☏')">☏</button>
<button type="button" class="scemo_add" onclick="javascript:add('♠')">♠</button>
<button type="button" class="scemo_add" onclick="javascript:add('♤')">♤</button>
<button type="button" class="scemo_add" onclick="javascript:add('♣')">♣</button>
<button type="button" class="scemo_add" onclick="javascript:add('♧')">♧</button>
<button type="button" class="scemo_add" onclick="javascript:add('★')">★</button>
<button type="button" class="scemo_add" onclick="javascript:add('☆')">☆</button>
<button type="button" class="scemo_add" onclick="javascript:add('☞')">☞</button>
<button type="button" class="scemo_add" onclick="javascript:add('☜')">☜</button>
<button type="button" class="scemo_add" onclick="javascript:add('▒')">▒</button>
<button type="button" class="scemo_add" onclick="javascript:add('⊙')">⊙</button>
<button type="button" class="scemo_add" onclick="javascript:add('㈜')">㈜</button>
<button type="button" class="scemo_add" onclick="javascript:add('№')">№</button>
<button type="button" class="scemo_add" onclick="javascript:add('㉿')">㉿</button>
<button type="button" class="scemo_add" onclick="javascript:add('♨')">♨</button>
<button type="button" class="scemo_add" onclick="javascript:add('™')">™</button>
<button type="button" class="scemo_add" onclick="javascript:add('℡')">℡</button>
<button type="button" class="scemo_add" onclick="javascript:add('∑')">∑</button>
<button type="button" class="scemo_add" onclick="javascript:add('∏')">∏</button>
<button type="button" class="scemo_add" onclick="javascript:add('♬')">♬</button>
<button type="button" class="scemo_add" onclick="javascript:add('♪')">♪</button>
<button type="button" class="scemo_add" onclick="javascript:add('♩')">♩</button>
<button type="button" class="scemo_add" onclick="javascript:add('♭')">♭</button>
<div class="list_closer"><button type="button" class="list_closer_btn">특수기호닫기</button></div>
</div>
</div>
<div id="write_emo" class="write_scemo">
<button type="button" id="scemo_emo" class="scemo_btn">이모티콘</button>
<div class="scemo_list scemo_emo">
<div class="list_closer"><button type="button" class="list_closer_btn">이모티콘닫기</button></div>
<button type="button" class="scemo_add" onclick="javascript:add('*^^*')">*^^*</button>
<button type="button" class="scemo_add" onclick="javascript:add('♡.♡')">♡.♡</button>
<button type="button" class="scemo_add" onclick="javascript:add('@_@')">@_@</button>
<button type="button" class="scemo_add" onclick="javascript:add('☞_☜')">☞_☜</button>
<button type="button" class="scemo_add" onclick="javascript:add('ㅠ ㅠ')">ㅠ ㅠ</button>
<button type="button" class="scemo_add" onclick="javascript:add('Θ.Θ')">Θ.Θ</button>
<button type="button" class="scemo_add" onclick="javascript:add('^_~♥')">^_~♥</button>
<button type="button" class="scemo_add" onclick="javascript:add('~o~')">~o~</button>
<button type="button" class="scemo_add" onclick="javascript:add('★.★')">★.★</button>
<button type="button" class="scemo_add" onclick="javascript:add('(!.!)')">(!.!)</button>
<button type="button" class="scemo_add" onclick="javascript:add('⊙.⊙')">⊙.⊙</button>
<button type="button" class="scemo_add" onclick="javascript:add('q.p')">q.p</button>
<button type="button" class="scemo_add emo_long" onclick="javascript:add('↖(^-^)↗')">↖(^-^)↗</button>
<button type="button" class="scemo_add emo_long" onclick="javascript:add('(*^-^*)')">(*^-^*)</button>
<button type="button" class="scemo_add emo_long" onclick="javascript:add('d(^-^)b')">d(^-^)b</button>
<div class="list_closer"><button type="button" class="list_closer_btn">이모티콘닫기</button></div>
</div>
</div>
</div>
<div class="win_btn">
<input type="submit" value="전송" class="btn_submit">
<button type="button" onclick="window.close();">창닫기</button>
</div>
</form>
</div>
<?php if( count($emoticon_group) ){ //회원에게 공개된 이모티콘 그룹이 있다면 ?>
<div id="send_emo">
<h2>이모티콘 목록</h2>
<form name="emoticon_form">
<label for="emo_sel" class="sound_only">이모티콘 그룹</label>
<select name="fg_no" id="emo_sel">
<option value="" <?php echo $fg_no?'':'selected'?>>전체</option>
<?php for($i=0; $i<count($emoticon_group); $i++) {?>
<option value="<?php echo $emoticon_group[$i]['fg_no']?>"<?php echo ($fg_no==$emoticon_group[$i]['fg_no'])?'selected':''?>><?php echo $emoticon_group[$i]['fg_name']?> (<?php echo number_format($emoticon_group[$i]['fg_count'])?>)</option>
<?php } ?>
</select>
</form>
<ul class="emo_list">
</ul>
<nav class="pg_wrap">
<span class="pg" id="emoticon_pg"></span>
</nav>
<form name="emoticon_search" id="emoticon_search">
<input type="hidden" name="page" id="hidden_page" >
</form>
</div>
<?php } ?>
</div>
<script>
function sms_error(obj, err) {
alert(err);
obj.value = '';
}
function smssend_submit(f)
{
if (!f.mh_message.value)
{
alert('보내실 문자를 입력하십시오.');
f.mh_message.focus();
return false;
}
if (!f.mh_reply.value)
{
alert('발신 번호를 입력하십시오.\n\n발신 번호는 회원정보의 휴대폰번호입니다.');
return false;
}
return true;
//f.submit();
//win.focus();
}
function booking_show()
{
if (document.getElementById('booking_flag').checked) {
document.getElementById('mh_by').disabled = false;
document.getElementById('mh_bm').disabled = false;
document.getElementById('mh_bd').disabled = false;
document.getElementById('mh_bh').disabled = false;
document.getElementById('mh_bi').disabled = false;
} else {
document.getElementById('mh_by').disabled = true;
document.getElementById('mh_bm').disabled = true;
document.getElementById('mh_bd').disabled = true;
document.getElementById('mh_bh').disabled = true;
document.getElementById('mh_bi').disabled = true;
}
}
function add(str) {
var conts = document.getElementById('mh_message');
var bytes = document.getElementById('sms_bytes');
conts.focus();
conts.value+=str;
byte_check('mh_message', 'sms_bytes');
return;
}
function byte_check(mh_message, sms_bytes)
{
var conts = document.getElementById(mh_message);
var bytes = document.getElementById(sms_bytes);
var i = 0;
var cnt = 0;
var exceed = 0;
var ch = '';
for (i=0; i<conts.value.length; i++)
{
ch = conts.value.charAt(i);
if (escape(ch).length > 4) {
cnt += 2;
} else {
cnt += 1;
}
}
bytes.innerHTML = cnt;
if (cnt > 80)
{
exceed = cnt - 80;
alert('메시지 내용은 80바이트를 넘을수 없습니다.\n\n작성하신 메세지 내용은 '+ exceed +'byte가 초과되었습니다.\n\n초과된 부분은 자동으로 삭제됩니다.');
var tcnt = 0;
var xcnt = 0;
var tmp = conts.value;
for (i=0; i<tmp.length; i++)
{
ch = tmp.charAt(i);
if (escape(ch).length > 4) {
tcnt += 2;
} else {
tcnt += 1;
}
if (tcnt > 80) {
tmp = tmp.substring(0,i);
break;
} else {
xcnt = tcnt;
}
}
conts.value = tmp;
bytes.innerHTML = xcnt;
return;
}
}
byte_check('mh_message', 'sms_bytes');
</script>
<script src="<?php echo G5_JS_URL?>/jquery.sms_paging.js"></script>
<script>
var emoticon_list = {
go : function(fo_no){
var wr_message = document.getElementById('mh_message');
//wr_message.focus();
wr_message.value = document.getElementById('fo_contents_' + fo_no).value;
byte_check('mh_message', 'sms_bytes');
}
};
(function($){
$(".box_txt").bind("focus keydown", function(){
$("#wr_message_lbl").hide();
});
var $search_form = $("form#emoticon_search");
emoticon_list.fn_paging = function( hash_val,total_page ){
$('#emoticon_pg').paging({
current:hash_val ? hash_val : 1,
max:total_page == 0 || total_page ? total_page : 45,
length : 5,
liitem : 'span',
format:'{0}',
next:'next',
prev:'prev',
first:'&lt;&lt;',last:'&gt;&gt;',
href:'#',
itemCurrent:'pg_current',
itemClass:'pg_page',
appendhtml:'<span class="sound_only">페이지</span>',
onclick:function(e,page){
e.preventDefault();
$("#hidden_page").val( page );
var params = $($search_form).serialize();
emoticon_list.select_page( params, "json" );
}
});
}
emoticon_list.loading = function( el, src ){
if( !el || !src) return;
$(el).append("<span class='tmp_loading'><img src='"+src+"' title='loading...' ></span>");
}
emoticon_list.loadingEnd = function( el ){
$(".tmp_loading", $(el)).remove();
}
emoticon_list.select_page = function( params, type ){
if( !type ){
type = "json";
}
emoticon_list.loading(".emo_list", "<?php echo $sms5_skin_url?>/img/ajax-loader.gif" ); //로딩 이미지 보여줌
$.ajax({
url: "./ajax.sms_emoticon.php",
cache:false,
timeout : 30000,
dataType:type,
data:params,
success: function(HttpRequest) {
if( type == "json" ){
if (HttpRequest.error) {
alert(HttpRequest.error);
return false;
} else {
var $emoticon_box = $(".emo_list");
var list_text = "";
$.each( HttpRequest.list_text , function(num) {
var list_data = HttpRequest.list_text[num];
list_text = list_text + "<li class=\"screen_list\"><div class=\"sms5_box\"><span class=\"box_ico\"></span><textarea class=\"sms_textarea box_txt box_square\" readonly onclick=\"emoticon_list.go("+list_data.fo_no+")\">"+list_data.fo_content+"</textarea><textarea id=\"fo_contents_"+list_data.fo_no+"\" style=\"display:none; width:0; height:0\">"+list_data.fo_content+"</textarea><strong class=\"emo_tit\">"+list_data.fo_name+"</strong></div></li>";
});
if( !list_text ){
list_text = "<li>데이터가 없습니다.</li>";
}
$emoticon_box.html( list_text );
emoticon_list.fn_paging( HttpRequest.page, HttpRequest.total_page );
$("#hidden_page").val( HttpRequest.page );
}
}
emoticon_list.loadingEnd(".emo_list"); //로딩 이미지 지움
}
});
}
$("#emo_sel").bind("change", function(e){
var params = { fg_no : $(this).val() };
$search_form[0].reset();
$("#hidden_fg_no").val( $(this).val() );
emoticon_list.select_page( params, "json" );
});
$search_form.submit(function(e){
e.preventDefault();
var $form = $(this),
params = $(this).serialize();
emoticon_list.select_page( params, "json" );
});
if( $("#emo_sel").length ){
$("#emo_sel").trigger("change");
}
$(".scemo_btn").click(function(){
var scemoid = $(this).attr("id");
$(this).hide();
$(".scemo_list").hide();
$("."+scemoid).show();
});
$(".list_closer_btn").click(function(){
$(".scemo_btn").show();
$(".scemo_list").hide();
});
})(jQuery);
</script>

269
plugin/sms5/sms5.lib.php Normal file
View File

@ -0,0 +1,269 @@
<?php
if (!defined('_GNUBOARD_')) exit;
/*************************************************************************
**
** sms5에 사용할 함수 모음
**
*************************************************************************/
// 스킨디렉토리를 SELECT 형식으로 얻음
function get_sms5_skin_select($skin_gubun, $id, $name, $selected='', $event='')
{
$skins = get_skin_dir($skin_gubun, G5_SMS5_PATH);
$str = "<select id=\"$id\" name=\"$name\" $event>\n";
for ($i=0; $i<count($skins); $i++) {
if ($i == 0) $str .= "<option value=\"\">선택</option>";
$str .= option_selected($skins[$i], $selected);
}
$str .= "</select>";
return $str;
}
if ( ! function_exists('array_overlap')) {
function array_overlap($arr, $val) {
for ($i=0, $m=count($arr); $i<$m; $i++) {
if ($arr[$i] == $val)
return true;
}
return false;
}
}
if ( ! function_exists('get_hp')) {
function get_hp($hp, $hyphen=1)
{
global $g5;
if (!is_hp($hp)) return '';
if ($hyphen) $preg = "$1-$2-$3"; else $preg = "$1$2$3";
$hp = str_replace('-', '', trim($hp));
$hp = preg_replace("/^(01[016789])([0-9]{3,4})([0-9]{4})$/", $preg, $hp);
if ($g5['sms5_demo'])
$hp = '0100000000';
return $hp;
}
}
if ( ! function_exists('is_hp')) {
function is_hp($hp)
{
$hp = str_replace('-', '', trim($hp));
if (preg_match("/^(01[016789])([0-9]{3,4})([0-9]{4})$/", $hp))
return true;
else
return false;
}
}
if ( ! function_exists('alert_just')) {
// 경고메세지를 경고창으로
function alert_just($msg='', $url='')
{
global $g5;
if (!$msg) $msg = '올바른 방법으로 이용해 주십시오.';
//header("Content-Type: text/html; charset=$g5[charset]");
echo "<meta charset=\"utf-8\">";
echo "<script language='javascript'>alert('$msg');";
echo "</script>";
exit;
}
}
if ( ! function_exists('utf2euc')) {
function utf2euc($str) {
return iconv("UTF-8","cp949//IGNORE", $str);
}
}
if ( ! function_exists('is_ie')) {
function is_ie() {
return isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false);
}
}
/**
* SMS 발송을 관장하는 메인 클래스이다.
*
* 접속, 발송, URL발송, 결과등의 실질적으로 쓰이는 모든 부분이 포함되어 있다.
*/
class SMS5 extends SMS {
var $Log = array();
function SMS_con($sms_server,$sms_id,$sms_pw,$port) {
$this->ID=$sms_id; // 계약 후 지정
$this->PWD=$sms_pw; // 계약 후 지정
$this->SMS_Server=$sms_server;
$this->SMS_Port=$port;
$this->ID = spacing($this->ID,10);
$this->PWD = spacing($this->PWD,10);
}
/**
* 발송번호의 값이 정확한 값인지 확인합니다.
*
* @param strDest 발송번호 배열입니다.
* nCount 배열의 크기입니다.
* @return 처리결과입니다.
*/
function CheckCommonTypeDest($strDest, $nCount) {
for ($i=0; $i<$nCount; $i++) {
$hp_number = preg_replace("/[^0-9]/","",$strDest[$i]['bk_hp']);
if (strlen($hp_number)<10 || strlen($hp_number)>11) return "휴대폰 번호가 틀렸습니다";
$CID=substr($hp_number,0,3);
if ( preg_match("/[^0-9]/",$CID) || ($CID!='010' && $CID!='011' && $CID!='016' && $CID!='017' && $CID!='018' && $CID!='019') ) return "휴대폰 앞자리 번호가 잘못되었습니다";
}
}
/**
* 회신번호의 값이 정확한 값인지 확인합니다.
*
* @param strDest 회신번호입니다.
* @return 처리결과입니다.
*/
function CheckCommonTypeCallBack($strCallBack) {
if (preg_match("/[^0-9]/", $strCallBack)) return "회신 전화번호가 잘못되었습니다";
}
/**
* 예약날짜의 값이 정확한 값인지 확인합니다.
*
* @param text 원하는 문자열입니다.
* size 원하는 길이입니다.
* @return 처리결과입니다.
*/
function CheckCommonTypeDate($strDate) {
$strDate=preg_replace("/[^0-9]/","",$strDate);
if ($strDate) {
if (!checkdate(substr($strDate,4,2),substr($strDate,6,2),substr($rsvTime,0,4))) return "예약날짜가 잘못되었습니다";
if (substr($strDate,8,2)>23 || substr($strDate,10,2)>59) return "예약시간이 잘못되었습니다";
}
}
/**
* URL콜백용으로 메세지 크기를 수정합니다.
*
* @param url URL 내용입니다.
* msg 결과메시지입니다.
* desk 문자내용입니다.
*/
function CheckCallCenter($url, $dest, $data) {
switch (substr($dest,0,3)) {
case '010': //20바이트
return cut_char($data,20);
break;
case '011': //80바이트
return cut_char($data,80);
break;
case '016': // 80바이트
return cut_char($data,80);
break;
case '017': // URL 포함 80바이트
return cut_char($data,80 - strlen($url));
break;
case '018': // 20바이트
return cut_char($data,20);
break;
case '019': // 20바이트
return cut_char($data,20);
break;
default:
return cut_char($data,80);
break;
}
}
function Add($strDest, $strCallBack, $strCaller, $strURL, $strMessage, $strDate="", $nCount) {
global $g5;
$Error = $this->CheckCommonTypeDest($strDest, $nCount);
$Error = $this->CheckCommonTypeCallBack($strCallBack);
$Error = $this->CheckCommonTypeDate($strDate);
$strCallBack = spacing($strCallBack,11);
$strCaller = spacing($strCaller,10);
$strDate = spacing($strDate,12);
for ($i=0; $i<$nCount; $i++) {
$hp_number = spacing($strDest[$i]['bk_hp'],11);
$strData = $strMessage;
if( !empty($strDest[$i]['bk_name']) ){
$strData = str_replace("{이름}", $strDest[$i]['bk_name'], $strData);
}
// 아이코드에서는 문자에 utf-8 인코딩 형식을 아직 지원하지 않는다.
$strData = iconv('utf-8', "euc-kr", stripslashes($strData));
if (!$strURL) {
$strData = spacing(cut_char($strData,80),80);
$this->Data[$i] = '01144 '.$this->ID.$this->PWD.$hp_number.$strCallBack.$strCaller.$strDate.$strData;
} else {
$strURL = spacing($strURL,50);
$strData = spacing($this->CheckCallCenter($strURL, $hp_number, $strData),80);
$this->Data[$i] = '05173 '.$this->ID.$this->PWD.$hp_number.$strCallBack.$strURL.$strDate.$strData;
}
}
return true; // 수정대기
}
function Send() {
global $g5;
$count = 1;
if ($g5['sms5_demo_send']) {
foreach($this->Data as $puts) {
if (rand(0,10)) {
$phone = substr($puts,26,11);
$code = '47022497 ';
} else {
$phone = substr($puts,26,11);
$code = 'Error(02)';
}
$this->Result[] = "$phone:$code";
$this->Log[] = $puts;
}
$this->Data = "";
return true;
exit;
}
$fsocket=fsockopen($this->SMS_Server,$this->SMS_Port);
if (!$fsocket) return false;
set_time_limit(300);
## php4.3.10일경우
## zend 최신버전으로 업해주세요..
## 또는 69번째 줄을 $this->Data as $tmp => $puts 로 변경해 주세요.
foreach($this->Data as $puts) {
$dest = substr($puts,26,11);
fputs($fsocket, $puts);
while(!$gets) {
$gets = fgets($fsocket,30);
}
if (substr($gets,0,19) == "0223 00".$dest) {
$this->Result[] = $dest.":".substr($gets,19,10);
$this->Log[] = $puts;
} else {
$this->Result[$dest] = $dest.":Error(".substr($gets,6,2).")";
$this->Log[] = $puts;
}
$gets = "";
// 1천건씩 전송 후 5초 쉼
if ($count++%1000 == 0) sleep(5);
}
fclose($fsocket);
$this->Data = "";
return true;
}
}
?>

72
plugin/sms5/write.php Normal file
View File

@ -0,0 +1,72 @@
<?php
if (!defined('_GNUBOARD_')) exit;
if( !$sms5['bo_skin'] ){
$sms5['bo_skin'] = "basic";
}
$err = null;
if (!$mb_id){
$err = "받는회원 아이디가 넘어오지 않았습니다.";
alert_close($err);
}
if (!$sms5['cf_member']){
$err = "문자전송이 허용되지 않았습니다.\\n\\n사이트 관리자에게 문의하여 주십시오.";
alert_close($err);
}
if (!$err and !$is_member){
$err = "로그인 해주세요.";
alert_close($err);
}
if (!$err and $member['mb_level'] < $sms5['cf_level']){
$err = "회원 {$sms5['cf_level']} 레벨 이상만 문자전송이 가능합니다.";
alert_close($err);
}
// 오늘 문자를 보낸 총 건수
$row = sql_fetch(" select count(*) as cnt from {$g5['sms5_member_history_table']} where mb_id='{$member['mb_id']}' and date_format(mh_datetime, '%Y-%m-%d') = '".G5_TIME_YMD."' ");
$total = $row['cnt'];
// 건수 제한
if (!$err and $sms5['cf_day_count'] > 0 && $is_admin != 'super') {
if ($total >= $sms5['cf_day_count']) {
$err = "하루에 보낼수 있는 문자갯수(".number_format($sms5['cf_day_count'])." 건)를 초과하였습니다.";
alert_close($err);
}
}
// 포인트 검사
if (!$err and $sms5['cf_point'] > 0 && $is_admin != 'super') {
if ($sms5['cf_point'] > $member['mb_point']) {
$err = "보유하신 포인트(".number_format($member['mb_point'])." 포인트)가 없거나 모자라서\\n\\n문자전송(".number_format($sms5['cf_point'])." 포인트)이 불가합니다.\\n\\n포인트를 적립하신 후 다시 시도 해 주십시오.";
alert_close($err);
}
}
// 특정회원에게 문자 전송
if ($mb_id) {
$mb = get_member($mb_id);
if (!$mb['mb_hp']) alert_close("회원 휴대폰번호가 없습니다.");
if (!$mb['mb_open']) alert_close("정보를 공개하지 않았습니다.");
if (!$mb['mb_sms']) alert_close("SMS 수신여부가 비활성화 되어 있습니다.");
//$hp = $mb['mb_hp'];
}
$g5['title'] = "문자전송";
$token = get_token();
$emoticon_group = array();
$qry = sql_query("select * from {$g5['sms5_form_group_table']} where fg_member = 1 order by fg_name");
while ($res = sql_fetch_array($qry)) array_push($emoticon_group, $res);
$action_url = "./write_update.php";
if( G5_IS_MOBILE ){
$write_skin_page = "/write_mobile.skin.php";
} else {
$write_skin_page = "/write.skin.php";
}
include_once ($sms5_skin_path.$write_skin_page);
echo PHP_EOL.'<!-- skin : '.$sms5_skin_path.' -->'.PHP_EOL;
?>

View File

@ -0,0 +1,157 @@
<?php
include_once("./_common.php");
$g5['title'] = "문자전송중";
if (!($token && get_session("ss_token") == $token))
die("올바른 방법으로 사용해 주십시오.");
if (!$sms5['cf_member'])
die("문자전송이 허용되지 않았습니다. 사이트 관리자에게 문의하여 주십시오.");
if (!$is_member)
die("로그인 해주세요.");
if ($member['mb_level'] < $sms5['cf_level'])
alert("회원 {$sms5['cf_level']}레벨 이상만 문자전송이 가능합니다.");
if (!trim($mh_reply))
alert('보내는 번호를 입력해주세요.');
if (!trim($mh_message))
alert('메세지를 입력해주세요.');
if ($is_admin != 'super')
{
$mh_reply = get_hp($mh_reply, 0);
if (!$mh_reply)
alert("보내는 번호가 올바르지 않습니다.");
}
else
{
$mh_reply = str_replace("-", "", $mh_reply);;
if (!check_string($mh_reply, G5_NUMERIC))
alert("보내는 번호가 올바르지 않습니다.");
}
$mh_hp = explode(',', $mh_hp);
if ($mb_id) {
$mb = get_member($mb_id);
if (!$mb['mb_sms'] || !$mb['mb_open']) {
alert("정보를 공개하지 않았습니다.");
}
if( $mb['mb_hp'] ){
array_push( $mh_hp, $mb['mb_hp'] );
}
}
if (!count($mh_hp))
alert('받는 번호를 입력해주세요.');
// 핸드폰 번호만 걸러낸다.
$tmp = array();
for ($i=0; $i<count($mh_hp); $i++)
{
$hp = trim($mh_hp[$i]);
$hp = get_hp($hp);
if ($hp)
$tmp[]['bk_hp'] = get_hp($hp, 0);
}
$mh_hp = $tmp;
$total = count($mh_hp);
// 건수 제한
if ($sms5['cf_day_count'] > 0 && $is_admin != 'super') {
$row = sql_fetch(" select count(*) as cnt from {$g5['sms5_member_history_table']} where mb_id='{$member['mb_id']}' and date_format(mh_datetime, '%Y-%m-%d') = '".G5_TIME_YMD."' ");
if ($row['cnt'] + $total > $sms5['cf_day_count']) {
alert("하루에 보낼수 있는 문자갯수(".number_format($sms5['cf_day_count']).")를 초과하였습니다.");
}
}
// 포인트 검사
if ($sms5['cf_point'] > 0 && $is_admin != 'super') {
$minus_point = $sms5['cf_point'] * $total;
if ($minus_point > $member['mb_point'])
alert("보유하신 포인트(".number_format($member['mb_point']).")가 없거나 모자라서 문자전송(".number_format($minus_point).")이 불가합니다.\\n\\n포인트를 적립하신 후 다시 시도 해 주십시오.");
} else
$minus_point = 0;
// 예약전송
if ($mh_by && $mh_bm && $mh_bd && $mh_bh && $mh_bi) {
$mh_booking = "$mh_by-$mh_bm-$mh_bd $mh_bh:$mh_bi:00";
$booking = $mh_by.$mh_bm.$mh_bd.$mh_bh.$mh_bi;
} else {
$mh_booking = '';
$booking = '';
}
$SMS = new SMS5;
$SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']);
$result = $SMS->Add($mh_hp, $mh_reply, '', '', $mh_message, $booking, $total);
$is_success = null;
if ($result)
{
$result = $SMS->Send();
if ($result) //SMS 서버에 접속했습니다.
{
foreach ($SMS->Result as $result)
{
list($hp, $code) = explode(":", $result);
if (substr($code,0,5) == "Error")
{
$is_success = false;
switch (substr($code,6,2)) {
case '02': // "02:형식오류"
$mh_log = "형식이 잘못되어 전송이 실패하였습니다.";
break;
case '23': // "23:인증실패,데이터오류,전송날짜오류"
$mh_log = "데이터를 다시 확인해 주시기바랍니다.";
break;
case '97': // "97:잔여코인부족"
$mh_log = "잔여코인이 부족합니다.";
break;
case '98': // "98:사용기간만료"
$mh_log = "사용기간이 만료되었습니다.";
break;
case '99': // "99:인증실패"
$mh_log = "인증 받지 못하였습니다. 계정을 다시 확인해 주세요.";
break;
default: // "미 확인 오류"
$mh_log = "알 수 없는 오류로 전송이 실패하었습니다.";
break;
}
}
else
{
$is_success = true;
$mh_log = "문자전송:".get_hp($hp, 1);
}
$hp = get_hp($hp, 1);
$log = array_shift($SMS->Log);
sql_query("insert into {$g5['sms5_member_history_table']} set mb_id='{$member['mb_id']}', mh_reply='$mh_reply', mh_hp='$hp', mh_datetime='".G5_TIME_YMDHIS."', mh_booking='$mh_booking', mh_log='$mh_log', mh_ip='".$_SERVER['REMOTE_ADDR']."'");
if ($is_admin == 'super')
$sms5['cf_point'] = 0;
if ($is_success)
insert_point($member['mb_id'], (-1) * $sms5['cf_point'], "$mh_log");
}
$SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
}
else alert("에러: SMS 서버와 통신이 불안정합니다.");
}
else alert("에러: SMS 데이터 입력도중 에러가 발생하였습니다.");
alert_close("$total 건의 문자메세지 전송을 완료하였습니다.");
?>