신규 생성한 db table에서 선택적으로 문자 전송하는 코드 수정 부탁드립니다.
카라카스
1년 전
조회 5,753
현재 comment_history 라는 테이블을 db에서 만들어서 사용중입니다.
그런데 comment_history 테이블에서 선택을 해서 SMS 보내려고 아래와 같이 코드를 만들었는데
선택한 사람한테 문자가 발송되는 것이 아니라 comment_history 모두에게 문자가 발송이 되고 있습니다.
이부분을 선택한 사람에게 SMS가 발송되게 수정 부탁드립니다.
</p>
<p>if ($_POST['act_button'] == "선택 문자발송") {
$sql = " SELECT * FROM g5_comment_history WHERE comm_id = {$comm_id} and comm_note = '확정' ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
//----------------------------------------------------------
// SMS 문자전송 시작 //게시판에서 문자 보내는걸 막으려면 이부분 주석처리
//----------------------------------------------------------
$sms_contents = "";
$sms_contents = "";
$sms_contents .= '문자내용'; // 문자 내용
$receive_number = preg_replace("/[^0-9]/", "", $row['comm_hp']); // 수신자번호
$send_number = preg_replace("/[^0-9]/", "", $sms5['cf_phone']); // 발신자번호</p>
<p> if ($config['cf_sms_use'] == 'icode') {
if($config['cf_sms_type'] == 'LMS') {
include_once(G5_LIB_PATH.'/icode.lms.lib.php');</p>
<p> $port_setting = get_icode_port_type($config['cf_icode_id'], $config['cf_icode_pw']);</p>
<p> // 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);</p>
<p> $strDest = array();
$strDest[] = $receive_number;
$strCallBack = $send_number;
$strCaller = iconv_euckr(trim($config['cf_title']));
$strSubject = '테스트';
$strURL = '';
$strData = iconv_euckr($sms_contents);
$strDate = '';
$nCount = count($strDest);</p>
<p> $res = $SMS->Add($strDest, $strCallBack, $strCaller, iconv_euckr(stripslashes($strSubject)), $strURL, $strData, $strDate, $nCount);</p>
<p> $SMS->Send();
$SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
}
} else {
include_once(G5_LIB_PATH.'/icode.sms.lib.php');</p>
<p> $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 문자전송 끝
//----------------------------------------------------------
}
alert ("문자 전송이 완료되었습니다.");
}</p>
<p>
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
답변을 작성하려면 로그인이 필요합니다.
로그인