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

SNS회원가입시 신규가입 쿠폰 발행

· 6년 전 · 4370 · 2
회원스킨 register_form_update.tail.skin.php

<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가

//----------------------------------------------------------
// SMS 문자전송 시작
//----------------------------------------------------------

$sms_contents = $default['de_sms_cont1'];
$sms_contents = str_replace("{이름}", $mb_name, $sms_contents);
$sms_contents = str_replace("{회원아이디}", $mb_id, $sms_contents);
$sms_contents = str_replace("{회사명}", $default['de_admin_company_name'], $sms_contents);

// 핸드폰번호에서 숫자만 취한다
$receive_number = preg_replace("/[^0-9]/", "", $mb_hp); // 수신자번호 (회원님의 핸드폰번호)
$send_number = preg_replace("/[^0-9]/", "", $default['de_admin_company_tel']); // 발신자번호

if ($w == "" && $default['de_sms_use1'] && $receive_number)
{
if ($config['cf_sms_use'] == 'icode')
{
if($config['cf_sms_type'] == 'LMS') {
include_once(G5_LIB_PATH.'/icode.lms.lib.php');

$port_setting = get_icode_port_type($config['cf_icode_id'], $config['cf_icode_pw']);

// SMS 모듈 클래스 생성
if($port_setting !== false) {
$SMS = new LMS;
$SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $port_setting);

$strDest = array();
$strDest[] = $receive_number;
$strCallBack = $send_number;
$strCaller = iconv_euckr(trim($default['de_admin_company_name']));
$strSubject = '';
$strURL = '';
$strData = iconv_euckr($sms_contents);
$strDate = '';
$nCount = count($strDest);

$res = $SMS->Add($strDest, $strCallBack, $strCaller, $strSubject, $strURL, $strData, $strDate, $nCount);

$SMS->Send();
$SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
}
} else {
include_once(G5_LIB_PATH.'/icode.sms.lib.php');

$SMS = new SMS; // SMS 연결
$SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']);
$SMS->Add($receive_number, $send_number, $config['cf_icode_id'], iconv_euckr(stripslashes($sms_contents)), "");
$SMS->Send();
$SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
}
}
}
//----------------------------------------------------------
// SMS 문자전송 끝
//----------------------------------------------------------


//쇼핑몰 사용하고 소셜계정이 있다면 신규회원 쿠폰발생
if ($g5['g5_shop_default_table']) { //쇼핑몰일경우
if($w == '' && $sm_id && $default['de_member_reg_coupon_use'] && $default['de_member_reg_coupon_term'] > 0 && $default['de_member_reg_coupon_price'] > 0) {// 신규회원 소셜계정회원 신규가입 쿠폰이 있을 경우
$j = 0;
$create_coupon = false;

do {
$cp_id = get_coupon_id();

$sql3 = " select count(*) as cnt from {$g5['g5_shop_coupon_table']} where cp_id = '$cp_id' ";
$row3 = sql_fetch($sql3);

if(!$row3['cnt']) {
$create_coupon = true;
break;
} else {
if($j > 20)
break;
}
} while(1);

if($create_coupon) {
$cp_subject = '신규 회원가입 축하 쿠폰';
$cp_method = 2;
$cp_target = '';
$cp_start = G5_TIME_YMD;
$cp_end = date("Y-m-d", (G5_SERVER_TIME + (86400 * ((int)$default['de_member_reg_coupon_term'] - 1))));
$cp_type = 0;
$cp_price = $default['de_member_reg_coupon_price'];
$cp_trunc = 1;
$cp_minimum = $default['de_member_reg_coupon_minimum'];
$cp_maximum = 0;

$sql = " INSERT INTO {$g5['g5_shop_coupon_table']}
( cp_id, cp_subject, cp_method, cp_target, mb_id, cp_start, cp_end, cp_type, cp_price, cp_trunc, cp_minimum, cp_maximum, cp_datetime )
VALUES
( '$cp_id', '$cp_subject', '$cp_method', '$cp_target', '$mb_id', '$cp_start', '$cp_end', '$cp_type', '$cp_price', '$cp_trunc', '$cp_minimum', '$cp_maximum', '".G5_TIME_YMDHIS."' ) ";

$res = sql_query($sql, false);

if($res)
set_session('ss_member_reg_coupon', 1);
}
}
}
?>

문제 있으면 코멘트 부탁드립니다.

댓글 작성

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

로그인하기

댓글 2개

감사합니다.
오 좋은 팁이네요!!

게시글 목록

번호 제목
1634
1632
1631
1630
1629
1625
1608
1595
1578
1571
1567
1561
1560
1558
1555
1554
1553
1552
1551
1547
1538
1531
1527
1523
1522
1512
1511
1506
1503
1489