Exemple #1
0
function sms_notice()
{
    global $g5, $bo_table, $member;
    //if ($member['mb_id'] == "gt") return false;
    //if ($member['mb_id'] == "bigmsg") return false;
    $sms = new LMS();
    $page = $_SERVER['PHP_SELF'];
    $wr_subject = $_POST['wr_subject'];
    $w = $_POST['w'];
    $wr_id = $_POST['wr_id'];
    $mb_name = $member['mb_nick'] . "({$member['mb_id']})";
    $mb_name .= $member['mb_hp'] ? "\n" . $member['mb_hp'] : "";
    // 게시판 글쓰기/댓글
    if ($bo_table != "") {
        // 게시판 제목
        $sql = "select * from {$g5['board_table']} where bo_table='{$bo_table}'";
        $row = sql_fetch($sql);
        $bo_subject = $row['bo_subject'];
        $wr_content = cut_str($_POST['wr_content'], 20) . "\n";
        // 게시판 글쓰기(수정은 알림 안함)
        if ($w == "" && $page == "/bbs/write_update.php") {
            $message = "피잡스쿨:{$bo_subject}\n";
            $message .= $wr_subject . "\n\n";
            $message .= $mb_name;
            mylog("문자전송");
            $sms->tran('피잡알림', $message, ADMIN_SMS_PHONE, ADMIN_SMS_PHONE, 'gt', "gt");
            //if($member['mb_id']== "super") exit();
        } else {
            if ($w == "c" && $wr_id == "") {
                $message = "피잡스쿨: {$bo_subject}(댓글)";
                $message .= $wr_content;
                $message .= $mb_name;
                mylog($wr_content, "msg");
                $sms->tran('피잡알림', $message, ADMIN_SMS_PHONE, ADMIN_SMS_PHONE, 'gt', "gt");
            }
        }
    }
    // 1:1 문의
    mylog($page, "page");
    //echo "<br>w: ".$w;
    if ($page == "/bbs/qawrite_update.php") {
        $qa_id = $_POST['qa_id'];
        $qa_subject = cut_str($_POST['qa_subject'], 20);
        /*
        	w: ''	qa_id: ''   // 질문
        	w: 'u' 	qa_id: 23 	// 수정
        	w: 'r' 	qa_id: 23	// 추가질문
        */
        // 답변등록알림(질문자에게 알림)
        if ($w == "a" && $qa_id > 0) {
            $sql = "select * from {$g5['qa_content_table']} where qa_id='{$qa_id}'";
            $row = sql_fetch($sql);
            $qa_hp = $row["qa_hp"];
            if ($qa_hp != "") {
                $message = "피잡스쿨: 답변알림\n";
                $message .= "\\'1:1문의\\' 에 질문하신 \"{$row['qa_subject']}\" 글에 답변이 등록되었습니다.\n\n";
                $message .= "답변: \\'{$qa_subject}\\'";
                mylog($message, "message");
                $sms->tran('피잡알림', $message, $qa_hp, ADMIN_SMS_PHONE, 'gt', "gt");
            }
        } else {
            if ($w != "u") {
                // w = 'a'(메일 답변받기) , w = 'r'(추가질문)
                $message = "피잡스쿨: 1:1문의\n";
                $message .= $qa_subject . "\n";
                $message .= $mb_name;
                mylog($message, "message");
                $sms->tran('피잡알림', $message, ADMIN_SMS_PHONE, ADMIN_SMS_PHONE, 'gt', "gt");
            }
        }
    }
    // 강좌관련
    $it_id = (int) $_POST['it_id'];
    if ($it_id > 1) {
        $sql = "select * from {$g5['g5_shop_item_table']} where it_id='{$it_id}'";
        $row = sql_fetch($sql);
        $it_name = $row['it_name'];
        // 강좌후기
        if ($page == "/shop/itemuseformupdate.php" && $w != "u") {
            $subject = $_POST['is_subject'];
            $message = "피잡스쿨: {$it_name}(후기)\n";
            $message .= $subject . "\n";
            $message .= $mb_name;
            mylog($message, "message");
            $sms->tran('피잡알림', $message, ADMIN_SMS_PHONE, ADMIN_SMS_PHONE, 'gt', "gt");
        }
        // 강좌질문
        if ($page == "/shop/itemqaformupdate.php" && $w != "u") {
            $subject = $_POST['iq_subject'];
            $message = "피잡스쿨: {$it_name}(질문)\n";
            $message .= $subject . "\n";
            $message .= $mb_name;
            mylog($message, "message");
            $sms->tran('피잡알림', $message, ADMIN_SMS_PHONE, ADMIN_SMS_PHONE, 'gt', "gt");
        }
        // 강좌질문 답변 등록알림(질문한 멤버에게 답변등록알림)
        if ($page == "/shop/itemqansformupdate.php" && $w == "u") {
            $iq_id = $_POST['iq_id'];
            $iq_answer = cut_str(strip_tags($_POST['iq_answer']), 20);
            $sql = "select * from {$g5['g5_shop_item_qa_table']} where it_id='{$it_id}' and iq_id='{$iq_id}'";
            $row = sql_fetch($sql);
            $iq_hp = $row['iq_hp'];
            if ($iq_hp != "") {
                $message = "피잡스쿨: 답변알림\n";
                $message .= "\\'{$it_name}\\' 강좌에 질문하신 \"{$row['iq_subject']}\" 글에 답변이 등록되었습니다.\n\n";
                $message .= "답변: \\'{$iq_answer}\\'";
                mylog($message, "message");
                $sms->tran('피잡알림', $message, $iq_hp, ADMIN_SMS_PHONE, 'gt', "gt");
            }
        }
        // 강좌댓글
        if ($page == "/shop/itemcommentupdate.php" && $w == "c") {
            $subject = $_POST['is_subject'];
            $message = "피잡스쿨: {$it_name}(댓글)\n";
            $message .= $subject . "\n";
            $message .= $mb_name;
            mylog($message, "message");
            $sms->tran('피잡알림', $message, ADMIN_SMS_PHONE, ADMIN_SMS_PHONE, 'gt', "gt");
        }
    }
}