alert 문의드립니다.

alert 문의드립니다.

QA

alert 문의드립니다.

본문

alert 문의드립니다.

alert("$total 건의 문자메세지 전송을 완료하였습니다.", "write.php"); 이렇게 제일 하단에 띄웠는데요 
첨부처럼 나옵니다. 
글짜로만 문자전송이 완료되었습니다. 가 되어야하거던요 
고수님들 도움 부탁드립니다.
ssss.jpg

아래는 해당 소스입니다. 맨아래 있어요


<?
include_once("./_common.php");

$g4[title] = "문자전송중";

$mngrphone = array();
$mngrphone[0] = "010";
$mngrphone[1] = "0000";
$mngrphone[2] = "0000";
$mh_hp = implode('', $_POST['phonenumber']);
$mngr_hp = implode('', $mngrphone);
$mh_reply = trim($_POST['phonenumber'][0]).trim($_POST['phonenumber'][1]).trim($_POST['phonenumber'][2]);
//$mh_reply = '*** 개인정보보호를 위한 휴대폰번호 노출방지 ***';
$mh_name = $_POST['name'];
$mh_message = '"'.$_POST['name'].'"님께서 상담요청을 하셨습니다.';

// SMS 설정값 배열변수
$sms4 = sql_fetch("select * from $g4[sms4_config_table]");

if (!($token && get_session("ss_token") == $token)) {
header('X-Status: error');
    die("올바른 방법으로 사용해 주십시오.");
}

if(preg_match("/<.*?>/msi", $_POST['name']) || preg_match("/<.*?>/msi", $_POST['message'])) {
header('X-Status: error');
    die("태그에 사용되는 특수문자는 입력하실 수 없습니다.");
}

/*if (!$sms4[cf_member])
    die("문자전송이 허용되지 않았습니다. 사이트 관리자에게 문의하여 주십시오.");

if (!$is_member)
    die("로그인 해주세요.");

if ($member[mb_level] < $sms4[cf_level])
    die("회원 $sms4[cf_level]레벨 이상만 문자전송이 가능합니다.");
*/
if (!trim($mh_reply)) {
header('X-Status: error');
    die('보내는 번호를 입력해주세요.');
}

if (!trim($mngr_hp)) {
header('X-Status: error');
    die('관리자 번호를 확인해주세요.');
}

if (!trim($mh_message)) {
header('X-Status: error');
    die('메세지를 입력해주세요.');
}

if (!trim($mh_hp)) {
header('X-Status: error');
    die('받는 번호를 입력해주세요.');
}

if (!trim($_POST['agreement'])) {
header('X-Status: error');
die('개인정보취급방침에 동의해야 합니다.');
}

if ($is_admin != 'super')
{
    $mh_reply = get_hp($mh_reply, 0);
    if (!$mh_reply) {
header('X-Status: error');
        die("보내는 번호가 올바르지 않습니다.");
}
}
else
{
    $mh_reply = str_replace("-", "", $mh_reply);;
    if (!check_string($mh_reply, _G4_NUMERIC_)) {
header('X-Status: error');
        die("보내는 번호가 올바르지 않습니다.");
}
}

$mh_hp = explode(',', $mh_hp);
$mngr_hp = explode(',', $mngr_hp);

// 핸드폰 번호만 걸러낸다.
$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);
}

// 관리자에게 문자를 보내기 위한 처리. 2012.11.22
$tmp2 = array();
for ($i=0; $i<count($mngr_hp); $i++) 
{
    $hp2 = trim($mngr_hp[$i]);
    $hp2 = get_hp($hp2);

    if ($hp2) 
        $tmp2[][bk_hp] = get_hp($hp2, 0);
}

$mh_hp = $tmp2;

$total = count($mh_hp);

// 건수 제한
if ($sms4[cf_day_count] > 0 and $is_admin != 'super') {
    $row = sql_fetch(" select count(*) as cnt from $g4[sms4_member_history_table] where mb_id='$member[mb_id]' and date_format(mh_datetime, '%Y-%m-%d') = '$g4[time_ymd]' ");
    if ($row[cnt] + $total >= $sms4[cf_day_count]) {
header('X-Status: error');
        die("하루에 보낼수 있는 문자갯수(".number_format($sms4[cf_day_count]).")를 초과하였습니다.");
    }
}

// 포인트 검사
if ($sms4[cf_point] > 0 and $is_admin != 'super') {
    $minus_point = $sms4[cf_point] * $total;
    if ($minus_point > $member[mb_point]) {
header('X-Status: error');
        die("보유하신 포인트(".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 SMS4;
$SMS->SMS_con($sms4[cf_ip], $sms4[cf_id], $sms4[cf_pw], $sms4[cf_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 $g4[sms4_member_history_table] set mb_id='$member[mb_id]', mh_reply='$mh_reply', mh_hp='$hp', mh_datetime='$g4[time_ymdhis]', mh_booking='$mh_booking', mh_log='$mh_log', mh_ip='$REMOTE_ADDR'");

            if ($is_admin == 'super')
                $sms4[cf_point] = 0;

            if ($is_success)
                insert_point($member[mb_id], (-1) * $sms4[cf_point], "$mh_log");

            if (!$sms4[cf_point]) { // 포인트 차감이 없어도 내역을 남김
                $sql  = " insert into $g4[point_table] set ";
                $sql .= " mb_id = '$member[mb_id]' ";
                $sql .= " ,po_datetime = '$g4[time_ymdhis]' ";
                $sql .= " ,po_content = '".addslashes($mh_log)."' ";
                $sql .= " ,po_point = '$sms4[cf_point]'";
                sql_query($sql);
            }
        }
        $SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
    }
    else alert("에러: SMS 서버와 통신이 불안정합니다.");
}
else alert("에러: SMS 데이터 입력도중 에러가 발생하였습니다.");

alert("$total 건의 문자메세지 전송을 완료하였습니다.", "write.php");
?>
 

이 질문에 댓글 쓰기 :

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

회원로그인

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