<% '************** Information **************************************** ' Program Title : SMS 전송 ' Company : (주)나우아이텍 (053)955-9055 ' Creator : 최 경 수 2006-03-17 '********************************************************************* Function SmsSend(tran_phone, tran_callback, Msg, RDate, s_num) 'tran_phone = b_phone1&"-"&b_phone2&"-"&b_phone3 '받는사람 'tran_phone = a_smssend_addr '받는사람 'tran_callback = "053-955-9055" '보내는 사람 'a_num = 고유번호 tran_phone = Replace(tran_phone, "-" , "") tran_phone = Replace(tran_phone, " " , "") message_temp = StringToHTML2(Msg, 80, true) messageArr = Split(message_temp, "
") if clng(smsSelect()) <= 0 then Back_back2 "당월 남은 건수가 부족합니다.", request.servervariables("http_referer") If UBound(messageArr) > 0 Then For ii = 0 To UBound(messageArr) response.write ii&"=ii
" if clng(smsSelect()) <= 0 then Back_back2 "당월 남은 건수가 부족합니다.", request.servervariables("http_referer") SQL = "Insert into em_tran(tran_id, tran_phone, tran_callback, tran_status, tran_date, tran_msg, tran_etc1, tran_etc2, tran_etc3, tran_etc4) values (" SQL = SQL & "'"&session("ss_m_id")&"','"&tran_phone&"', '"&tran_callback&"', '1', '"&Rdate&"', '"&ii+1&")"&messageArr(ii)&"','', '"&s_num&"','"&session("ss_bdm_idx")&"', '"&get_bdm_idx2(session("ss_bdm_idx"))&"')" 'response.write sql & "
" 'response.write "
sql="&sql 'response.end dbcon.execute sql sql = "update member set M_g_sms = M_g_sms - 1 where M_id = '" & session("ss_m_id") & "'" dbcon.execute sql next else SQL = "Insert into em_tran(tran_id, tran_phone, tran_callback, tran_status, tran_date, tran_msg, tran_etc1, tran_etc2, tran_etc3, tran_etc4) values (" SQL = SQL & "'"&session("ss_m_id")&"','"&tran_phone&"', '"&tran_callback&"', '1', '"&Rdate&"', '"&Msg&"','', '"&s_num&"', '"&session("ss_bdm_idx")&"','"&get_bdm_idx2(session("ss_bdm_idx"))&"')" 'response.write sql & "
" 'response.write "
sql="&sql 'response.end dbcon.execute sql sql = "update member set M_g_sms = M_g_sms - 1 where M_id = '" & session("ss_m_id") & "'" dbcon.execute sql End if End Function '************** Information **************************************** ' Program Title : SMS 전송 ' Company : (주)나우아이텍 (053)955-9055 ' Creator : 최 경 수 2006-03-17 '********************************************************************* Function SmsSend_s(tran_phone, tran_callback, Msg, RDate, s_num) 'tran_phone = b_phone1&"-"&b_phone2&"-"&b_phone3 '받는사람 'tran_phone = a_smssend_addr '받는사람 'tran_callback = "053-955-9055" '보내는 사람 'a_num = 고유번호 tran_phone = Replace(tran_phone, "-" , "") tran_phone = Replace(tran_phone, " " , "") message_temp = StringToHTML2(Msg, 80, true) messageArr = Split(message_temp, "
") If UBound(messageArr) > 0 Then For ii = 0 To UBound(messageArr) 'response.write ii&"=ii
" SQL = "Insert into em_tran(tran_id, tran_phone, tran_callback, tran_status, tran_date, tran_msg, tran_etc1, tran_etc2, tran_etc3, tran_etc4) values (" SQL = SQL & "'"&session("ss_m_id")&"','"&tran_phone&"', '"&tran_callback&"', '1', '"&Rdate&"', '"&ii+1&")"&messageArr(ii)&"','', '"&s_num&"','"&session("ss_bdm_idx")&"', '"&get_bdm_idx2(session("ss_bdm_idx"))&"')" 'response.write sql & "
" 'response.write "
sql="&sql 'response.end dbcon.execute sql next else SQL = "Insert into em_tran(tran_id, tran_phone, tran_callback, tran_status, tran_date, tran_msg, tran_etc1, tran_etc2, tran_etc3, tran_etc4) values (" SQL = SQL & "'"&session("ss_m_id")&"','"&tran_phone&"', '"&tran_callback&"', '1', '"&Rdate&"', '"&Msg&"','', '"&s_num&"', '"&session("ss_bdm_idx")&"','"&get_bdm_idx2(session("ss_bdm_idx"))&"')" 'response.write sql & "
" 'response.write "
sql="&sql 'response.end dbcon.execute sql End if End Function '************** Information **************************************** ' Program Title : SMS 전송 ' Company : (주)나우아이텍 (053)955-9055 ' Creator : 최 경 수 2006-03-17 '********************************************************************* Function SmsSend_2(tran_phone, tran_callback, Msg, RDate, a_num, qry, rowcnt) 'tran_phone = b_phone1&"-"&b_phone2&"-"&b_phone3 '받는사람 'tran_phone = a_smssend_addr '받는사람 'tran_callback = "053-955-9055" '보내는 사람 'a_num = 고유번호 tran_phone = Replace(tran_phone, "-" , "") tran_phone = Replace(tran_phone, " " , "") message_temp = StringToHTML2(Msg, 80, true) messageArr = Split(message_temp, "
") if clng(smsSelect()) <= 0 then Back_back2 "당월 남은 건수가 부족합니다.", request.servervariables("http_referer") If UBound(messageArr) > 0 Then For ii = 0 To UBound(messageArr) 'response.write ii&"=ii
" qry_value = Replace(qry, Msg, ii+1&")"&messageArr(ii) ) if clng(smsSelect()) <= 0 then Back_back2 "당월 남은 건수가 부족합니다.", request.servervariables("http_referer") sql = "Insert into em_tran(tran_id, tran_phone, tran_callback, tran_status, tran_date, tran_msg, tran_etc1, tran_etc2, tran_etc3, tran_etc4) " & qry_value 'select '"&session("ss_m_id")&"', m_mobile, '"&callback&"', '1', getdate(), '"&message&"', '', '', '"&session("ss_bdm_idx")&"','"&get_bdm_idx(session("ss_bdm_idx"))&"' from member" 'SQL = "Insert into em_tran(tran_id, tran_phone, tran_callback, tran_status, tran_date, tran_msg, tran_etc1, tran_etc2, tran_etc3, tran_etc4) " &qry 'response.write sql & "
" 'response.write "
sql="&sql 'response.end dbcon.execute sql sql = "update member set M_g_sms = M_g_sms - "&rowcnt&" where M_id = '" & session("ss_m_id") & "'" dbcon.execute sql next else SQL = "Insert into em_tran(tran_id, tran_phone, tran_callback, tran_status, tran_date, tran_msg, tran_etc1, tran_etc2, tran_etc3, tran_etc4) " &qry '"select '"&session("ss_m_id")&"', m_mobile, '"&callback&"', '1', getdate(), '"&message&"', '', '', '"&session("ss_bdm_idx")&"','"&get_bdm_idx(session("ss_bdm_idx"))&"' from member" 'response.write sql & "
" 'response.write "
sql="&sql 'response.end dbcon.execute sql sql = "update member set M_g_sms = M_g_sms - "&rowcnt&" where M_id = '" & session("ss_m_id") & "'" 'response.write sql dbcon.execute sql End if End Function '************** Information **************************************** ' Program Title : SMS 전송 ' Company : (주)나우아이텍 (053)955-9055 ' Creator : 최 경 수 2006-03-17 '********************************************************************* Function SmsSend_s_2(tran_phone, tran_callback, Msg, RDate, a_num, qry, rowcnt) 'tran_phone = b_phone1&"-"&b_phone2&"-"&b_phone3 '받는사람 'tran_phone = a_smssend_addr '받는사람 'tran_callback = "053-955-9055" '보내는 사람 'a_num = 고유번호 tran_phone = Replace(tran_phone, "-" , "") tran_phone = Replace(tran_phone, " " , "") message_temp = StringToHTML2(Msg, 80, true) messageArr = Split(message_temp, "
") If UBound(messageArr) > 0 Then For ii = 0 To UBound(messageArr) 'response.write ii&"=ii
" qry_value = Replace(qry, Msg, ii+1&")"&messageArr(ii) ) sql = "Insert into em_tran(tran_id, tran_phone, tran_callback, tran_status, tran_date, tran_msg, tran_etc1, tran_etc2, tran_etc3, tran_etc4) " & qry_value 'response.write sql & "
" 'response.write "
sql="&sql 'response.end dbcon.execute sql next else SQL = "Insert into em_tran(tran_id, tran_phone, tran_callback, tran_status, tran_date, tran_msg, tran_etc1, tran_etc2, tran_etc3, tran_etc4) " &qry '"select '"&session("ss_m_id")&"', m_mobile, '"&callback&"', '1', getdate(), '"&message&"', '', '', '"&session("ss_bdm_idx")&"','"&get_bdm_idx(session("ss_bdm_idx"))&"' from member" 'response.write sql & "
" 'response.write "
sql="&sql 'response.end dbcon.execute sql End if End Function '************** Information **************************************** ' Program Title : MMS 전송 '********************************************************************* sub mmsSend(tran_phone, tran_callback, Msg, RDate, s_num) 'tran_phone = b_phone1&"-"&b_phone2&"-"&b_phone3 '받는사람 'tran_phone = a_smssend_addr '받는사람 'tran_callback = "053-955-9055" '보내는 사람 'a_num = 고유번호 Dim subject, now_date, sql tran_phone = Replace(tran_phone, "-" , "") tran_phone = Replace(tran_phone, " " , "") now_date = Replace( Date(), "-", "" ) & Right("0"&hour(now), 2) & Right("0"&minute(now), 2) & Right("0"&second(now), 2) SCHEDULE_TYPE = 0 If now_date < rdate Then SCHEDULE_TYPE = 1 End if subject = StringToHTML( Msg, 30, false ) if clng(smsSelect()) <= 0 then Back_back2 "당월 남은 건수가 부족합니다.", request.servervariables("http_referer") sql = "insert into SDK_MMS_SEND( user_id, subject, now_date, send_date, dest_count, dest_info, msg_type, mms_msg, content_count, content_data, callback, RESERVED1, RESERVED2, RESERVED3, RESERVED4, SCHEDULE_TYPE) values('" sql = sql & session("ss_m_id") & "','" sql = sql & subject & "', '" sql = sql & now_date & "','" sql = sql & RDate & "', '" sql = sql & "1', '" sql = sql & "noname^" & tran_phone & "', '" sql = sql & "0', '" sql = sql & Msg & "', '" sql = sql & "1', '" sql = sql & "', '" sql = sql & tran_callback & "', '" sql = sql & "', '" sql = sql & s_num & "', '" sql = sql & session("ss_bdm_idx") & "', '" sql = sql & get_bdm_idx2(session("ss_bdm_idx")) & "', '" sql = sql & SCHEDULE_TYPE & "'" sql = sql & ")" 'Response.write "
" & sql executeQuery( sql ) sql = "update member set M_g_sms = M_g_sms - 3 where M_id = '" & session("ss_m_id") & "'" executeQuery( sql ) End sub '************** Information **************************************** ' Program Title : MMS 전송 (쿼리로 대량발송) '********************************************************************* sub mmsSend2(tran_callback, Msg, RDate, s_num, qry) Dim subject, now_date, rs, i, dest_info, rowcnt, sql Set ST = New SelectTable rs = ST.selectQueryTable( qry ) dest_info = "" rowcnt = 0 If Not( isnull( rs ) ) Then rowcnt = ubound( rs ) + 1 dest_info = rs(0)("dest_info") For i = 1 To ubound( rs ) dest_info = dest_info & "|" & rs(i)("dest_info") Next End if now_date = Replace( Date(), "-", "" ) & Right("0"&hour(now), 2) & Right("0"&minute(now), 2) & Right("0"&second(now), 2) SCHEDULE_TYPE = 0 If now_date < rdate Then SCHEDULE_TYPE = 1 End if subject = StringToHTML( Msg, 30, false ) if clng(smsSelect()) <= 0 then Back_back2 "당월 남은 건수가 부족합니다.", request.servervariables("http_referer") sql = "insert into SDK_MMS_SEND( user_id, subject, now_date, send_date, dest_count, dest_info, msg_type, mms_msg, content_count, content_data, callback, RESERVED1, RESERVED2, RESERVED3, RESERVED4, SCHEDULE_TYPE) values('" sql = sql & session("ss_m_id") & "','" sql = sql & subject & "', '" sql = sql & now_date & "','" sql = sql & RDate & "', '" sql = sql & "1', '" sql = sql & dest_info & "', '" sql = sql & "0', '" sql = sql & Msg & "', '" sql = sql & "1', '" sql = sql & "', '" sql = sql & tran_callback & "', '" sql = sql & "', '" sql = sql & s_num & "', '" sql = sql & session("ss_bdm_idx") & "', '" sql = sql & get_bdm_idx2(session("ss_bdm_idx")) & "', '" sql = sql & SCHEDULE_TYPE & "'" sql = sql & ")" 'Response.write sql 'Response.end executeQuery( sql ) rowcnt = rowcnt * 3 sql = "update member set M_g_sms = M_g_sms - "& rowcnt &" where M_id = '" & session("ss_m_id") & "'" executeQuery( sql ) End sub Function SMSdateChk(dateval, hourval, minval) If CDate(dateval) > Date() Then '날짜가 오늘날짜보다 크면 SMSdateChk = True ElseIf CDate(dateval) = Date() Then '날짜가 같다면 If CInt(hourval) > CInt(hour(now)) Then '같은날짜 시간이 크다면 SMSdateChk = True ElseIf Not(CInt(hourval) < CInt(hour(now))) And CInt(minval) > Minute(now) Then'시간이 작지않고 분이 크다면 SMSdateChk = True Else SMSdateChk = false End If Else SMSdateChk = False End if End function '************** Information **************************************** ' Program Title : sms건수 조회 ' Company : '********************************************************************* function smsSelect() Dim rs, sql If session("ss_m_id") <> "" Then sql = "select m_g_sms from member where m_id = '" & session("ss_m_id") & "'" 'Response.write sql Set rs = dbcon.execute( sql ) If rs.bof Or rs.eof Then smsSelect = 0 Else smsSelect = rs(0) End If Set rs = Nothing End If End Function function smsSelect2(m_id) Dim rs, sql If m_id <> "" Then sql = "select m_g_sms from member where m_id = '" & m_id & "'" Set rs = dbcon.execute( sql ) If rs.bof Or rs.eof Then smsSelect2 = 0 Else smsSelect2 = rs(0) End If Set rs = Nothing End If End Function '=======================회원별 남은 통수 보기========================================================= Function smsMail() Dim strConnect, Db, sql, rs_mail strConnect="Provider=SQLOLEDB.1;Data Source=(local);Initial catalog="&Application("DB")&";user ID="&Application("DB_id")&";Password="&Application("DB_pwd") Set Db=Server.CreateObject("ADODB.Connection") Db.Open strConnect sql = "select M_g_mail from member where M_id = '" & session("ss_m_id") & "'" Set rs_mail = Db.Execute(sql) If rs_mail.bof Or rs_mail.eof Then smsMail = 0 Else smsMail = rs_mail(0) End If Set rs_mail = Nothing Db.close Set Db = nothing End Function '===================내 소속 실국 번호 알아내기========================== Function mysilguk() sql = "select b.bdm_ref from member as a inner join bd_menu_page b on a.bdm_idx = b.bdm_idx where a.M_id = '" & session("ss_m_id") & "'" Set rs = Dbcon.Execute(sql) If rs.bof Or rs.eof Then mysilguk = null Else mysilguk = cint(rs(0)) End If Set rs = nothing End function '======================================================================= '---------------------sms 용 수정 최경수--------------- function StringToHTML2( str, max, br ) Dim i, length, buf, tmp, count, count2, ch, first first = false if ( isnull(str) ) then StringToHTML = "ㅋㅋㅋ" Exit Function end if if max>0 then buf = Trim( str ) 'buf = Replace( buf, CHR(9), " " ) 'buf = Replace( buf, CHR(13), "" ) length = len( buf ) count = 1 count2 = 0 tmp = "" for i=1 to length if count>max then if br=false then tmp = tmp & "..." exit for end if if i" count = 1 first = true end if ch = mid( buf, i, 1 ) 'if ch=CHR(10) then 'if br=false then ' exit for 'end if 'tmp = tmp & "
" 'count = 1 'first = true 'Else if count>1 AND ch=CHR(32) then if not first then tmp = tmp & " " end if elseif count = 1 and ch = CHR(32) then tmp = tmp else tmp = tmp & ch first = false end if if asc(ch)<0 then '한글이면 count = count+2 else '영문이면 count = count+1 end if next else tmp = str tmp = Trim( tmp ) tmp = Replace( tmp, "&", "&" ) tmp = Replace( tmp, "<", "<" ) tmp = Replace( tmp, ">", ">" ) 'tmp = Replace( tmp, CHR(10), "
" ) 'tmp = Replace( tmp, CHR(32), " " ) end if StringToHTML2 = tmp end function '************** Information **************************************** ' Program Title : '회원 최상위부서 ' Company : (주)나우아이텍 (053)955-9055 ' Creator : 윤 종 우 2005-07-24 '********************************************************************* function get_bdm_idx2(bdm_idx) if bdm_idx <> 0 then SQL = "Select bdm_ref from bd_menu_page where bdm_idx = "&bdm_idx 'response.write sql set rs_buseo = DbCon.Execute(sql) if rs_buseo.eof then get_bdm_idx2 = 0 else get_bdm_idx2 = rs_buseo(0) end if Set rs_buseo = nothing else get_bdm_idx2 = 0 end if end Function '************** Information **************************************** ' Program Title : '회원부서 ' Company : (주)나우아이텍 (053)955-9055 ' Creator : 윤 종 우 2005-07-24 '********************************************************************* function get_buseo(bdm_idx) If IsNull(bdm_idx) Or Trim(bdm_idx) = "" Then bdm_idx = 0 if CLng(bdm_idx) > 0 then SQL = "Select bdm_menuname from bd_menu_page where bdm_idx = "&bdm_idx 'response.write sql set rs_buseo = DbCon.Execute(sql) if rs_buseo.eof then get_buseo = "부서없음" else get_buseo = rs_buseo(0) end if Set rs_buseo = nothing else get_buseo = "부서없음" end if end Function '휴대폰번호 정규화 Function phoneValue(value) Dim phone_arr_temp, phone_arr_temp_len, i If IsNull( value ) Then value = "" phone_arr_temp = Trim(value) '---------------불필요한 문자열 제거------------------ phone_arr_temp = Replace(phone_arr_temp,")","") phone_arr_temp = Replace(phone_arr_temp,"(","") phone_arr_temp = Replace(phone_arr_temp,"-","") phone_arr_temp = Replace(phone_arr_temp," ","") phone_arr_temp = Replace(phone_arr_temp,"ㅡ","") phone_arr_temp = Replace(phone_arr_temp,"*","") '---------------불필요한 문자열 제거------------------ phone_arr_temp_len = Len(phone_arr_temp) 'phone_arr_temp = Split(mem_list(4, i), "-") If Left(phone_arr_temp, 2) = "00" Then '지역번호에 0이 2개 들어갔을 경우 phone_arr_temp = Mid(phone_arr_temp, 2) End if 'response.write "["& mem_list(4, i) &"], " '---------------전화번호를 정규화------------------ Select Case phone_arr_temp_len Case 7 phone_arr = Array("053",Left(phone_arr_temp,3),right(phone_arr_temp,4)) Case 8 phone_arr = Array("053",Left(phone_arr_temp,4),right(phone_arr_temp,4)) Case 10 phone_arr = Array(Left(phone_arr_temp,3),mid(phone_arr_temp,4,3),right(phone_arr_temp,4)) Case 11 phone_arr = Array(Left(phone_arr_temp,3),mid(phone_arr_temp,4,4),right(phone_arr_temp,4)) Case 12 phone_arr = Array(Left(phone_arr_temp,4),mid(phone_arr_temp,5,4),right(phone_arr_temp,4)) Case Else phone_arr = Array("","","") End select '---------------전화번호를 정규화끝------------------ '---------------마지막필터 숫자냐--------------- If IsNumeric(phone_arr(0)) And IsNumeric(phone_arr(1)) And IsNumeric(phone_arr(2)) Then M_phone = phone_arr(0) & "-" & phone_arr(1) & "-" & phone_arr(2) Else M_phone = "--" End If '---------------마지막필터 숫자냐--------------- phoneValue = M_phone End Function Function setDate(value) value = Replace(value, "Y", year(now)) value = Replace(value, "m", Right("0" & month(now), 2)) value = Replace(value, "d", Right("0" & day(now), 2)) value = Replace(value, "H", Right("0" & hour(now), 2)) value = Replace(value, "i", Right("0" & minute(now), 2)) value = Replace(value, "s", Right("0" & second(now), 2)) setDate = value End function Function createDate( value ) Dim y, m, d, h, i, s, ret_value y = mid(value,1,4) m = mid(value,5,2) d = mid(value,7,2) h = "00" i = "00" s = "00" If Len(value) >= 10 Then h = mid(value,9,2) If Len(value) >= 12 Then i = mid(value,11,2) If Len(value) >= 14 Then s = mid(value,13,2) 'ret_value = y & "-" & m & "-" & d & " " & h & ":" & i & ":" & s ret_value = y & "-" & m & "-" & d & " " & h & ":" & i createDate = ret_value End function %>