Files
sms_host20170829/hostsms_dmc.asp
T
2026-02-23 10:01:00 +09:00

137 lines
3.8 KiB
Plaintext

<!--#include virtual = "/common/lib/dbcon.asp" -->
<!--#include virtual = "/common/lib/func.asp" -->
<%
'────────────────────────────────────────────────────
' 의료원에서 사용중
'────────────────────────────────────────────────────
' 기등록 예약문제 지우기
Function del_em_tran(tran_etc2, m_id)
sql = " SELECT count(*) as cnt FROM em_tran WHERE tran_id = '"&m_id&"' and tran_etc2='"&tran_etc2&"'"
Set rs = dbcon.execute(sql)
delcnt = CInt(rs(0))
rs.close : Set rs = Nothing
If delcnt>0 then
sql = " DELETE FROM em_tran WHERE tran_id = '"&m_id&"' and tran_etc2='"&tran_etc2&"'"
Response.write SQL&"<br/>"
dbcon.execute sql
sql = "update member set M_g_sms = M_g_sms + "&delcnt&" where M_id = '"&m_id&"'"
Response.write SQL&"<br/>"
Dbcon.Execute sql
End if
End function
'm_id : 회원ID
'msg : 메세지
'tran_callback : 회신번호
'tran_phone : 수신번호 ex) 0111231234,0171231234
'rtn_url : 리턴URL ex) http://nninc.co.kr
m_id = inputValue( Request("sms_m_id") )
msg = inputValue( Request("sms_msg") )
tran_callback = inputValue( Request("sms_tran_callback") )
tran_phone = inputValue( Request("sms_tran_phone") )
rtn_url = inputValue( Request("sms_rtn_url"))
sms_b_num = inputValue( Request("sms_b_num")) ' 게시글 b_num :: 게시글 삭제할때만 쉼표로 구분되서 많이 들어올수 있음, 등록/수정시에는 하나씩만
etc_info1 = inputValue( Request("etc_info1")) ' 방문일자
etc_info2 = inputValue( Request("etc_info2")) ' 몇시간전
etc_info3 = inputValue( Request("etc_info3")) ' 알람 사용여부
' etc_info1 = "2015-04-11 15:00"
' etc_info2 = "24"
sms_b_num = Replace(sms_b_num," ","")
If tran_callback = "" Then tran_callback = tran_callback1&tran_callback2&tran_callback3
If rtn_url = "" Then rtn_url = Request.ServerVariables("HTTP_REFERER")
If etc_info3<>"Y" And sms_b_num<>"" Then ' 알림 사용안함 / 글 삭제
arr_b_num = Split(sms_b_num,",")
For i = 0 To UBound( arr_b_num )
If arr_b_num(i)<>"" then
tran_etc2 = "dmc" & arr_b_num(i)
Call del_em_tran (tran_etc2, m_id)
End if
next
End if
If m_id<>"" And msg<>"" And tran_phone<>"" Then
If smsSelect2(m_id) > 0 Then
send_flag = false
If sms_b_num<>"" And etc_info1<>"" And etc_info2<>"" And etc_info3="Y" then
tran_etc2 = "dmc" & sms_b_num
Call del_em_tran (tran_etc2, m_id)
' 발송시간 계산
tmp_date = dateAdd("h", -1*CInt(etc_info2) ,etc_info1)
Rdate = datevalue(tmp_date) & " " & Right("0"&Hour(tmp_date),2) &":"& Right("0"&Minute(tmp_date),2)
'Rdate = Date()& " " & Hour(now)&":"&Minute(now)
If DateDiff("s", now, Rdate )>0 Then
send_flag = true
End if
Else
Rdate = Date()& " " & Hour(now)&":"&Minute(now)
tran_etc2 = ""
send_flag = true
End if
tran_callback = Replace(tran_callback, "-", "")
tran_phone_arr = Split(tran_phone,",")
z = 0
If send_flag then
For i = 0 To UBound( tran_phone_arr )
If Trim(tran_phone_arr(i)) <> "" then
tran_phone = Replace(tran_phone_arr(i), "-", "")
SQL = "Insert into em_tran(tran_id, tran_phone, tran_callback, tran_status, tran_date, tran_msg, tran_etc2) values ("
SQL = SQL & "'"&m_id&"','"&tran_phone&"', '"&tran_callback&"', '1', '"&Rdate&"', '"&Msg&"', '"&tran_etc2&"')"
'Response.write SQL&"<br/>"
Dbcon.Execute sql
z = z + 1
End if
Next
End if
sql = "update member set M_g_sms = M_g_sms - "&z&" where M_id = '"&m_id&"'"
Response.write SQL&"<br/>"
Dbcon.Execute sql
End If
End If
Dbcon.close
Set Dbcon = Nothing
If rtn_url <> "" then
response.redirect rtn_url
End If
%>