<%@ LANGUAGE="VBSCRIPT" %> <% Option Explicit %> <% 'response.write ("UPDATEYES") 'response.end '터보백신으로부터 받아야 하는 값들 dim Serial , productkey , Clintup_version , Clintup_date , UseUpdateServer,sqlul productkey = Request("productcode") if productkey = "4" then Serial = "sv" & Request("Serialkey") elseif productkey = "6" then Serial = "cp" & Request("Serialkey") else Serial = "tv" & Request("Serialkey") end if clintup_version = request("upversion") clintup_date = request("date") UseUpdateServer = request("useupdateserver") ' 아래는 터보백신 Ai 시리얼키 제품에서 date 를 "" 로 잘못 보내주는 버그가 ' 있어서 이 처리를 위한 코드 2003-07-10 은 수정 시점의 최신 엔진 버전 '클라이언트 버전을 공백일 수 있으므로 디폴드값 설정(박준범) if clintup_version = "" then clintup_version = "0,0,0,0" end if if clintup_date = "" then clintup_date = "2003-07-10" end if '곽TvAi = 0, TvWs = 1, TvMgr = 2, TvAgent = 3 '임TvAi = 0, TvWs = 1, TvAgent = 2 ,TvMgr = 3 if Request("productcode") = "3" then productkey = "2" elseif Request("productcode") = "2" then productkey = "3" else productkey = Request("productcode") end if '에이젼트(2) 메니져(3) 두가지는 무조건 UPDATEYES if productkey ="2" then response.write ("UPDATEYES") response.end end if Dim table_name if productkey = "0" then table_name = "tvai_serial" elseif productkey = "3" then table_name = "tvmgr_serial" elseif productkey = "4" then table_name = "spy_serial" elseif productkey = "6" then table_name = "cpis_serial" elseif productkey = "7" then table_name = "tvis_serial" elseif productkey = "8" then table_name = "tvissrv_serial" elseif productkey = "10" then table_name = "tvmgr40_serial" end if 'tvai_serial " & table_name & " dim tvai_date , tvai_version tvai_date=left(now ,10) '백신쪽입력부분 'tvai_version="2004,12,16,0" '백신쪽입력부분 %> <% ' 초기에 나간 서버제품과 Ai 제품에는 시리얼키 또는 productcode 가 없을 ' 수도 있다. 이러한 경우는 기업이므로 연간 업데이트 하고 있으므로 ' 그냥 UPDATEYES 로 처리한다. if request("Serialkey") = "" or Request("productcode") ="" then 'response.write ("KEYNONE") response.write ("UPDATEYES") response.end end if '컴퍼넌트 돌리기위한 코드 dim obj , nRet 'Set obj = Server.CreateObject("TurboVaccineSerialCheck.SerialCheck") ' nRet = obj.TvSerialCheck("tv" & Request("Serialkey") , productkey) 'Set obj = Nothing 'response.write nRet 'response.end nRet="1" if nRet ="0" then response.write ("LOGINNO") response.end end if '서버는 UpdateSerial_server.asp 로 따로 넘겨서 관리 됩니다. if productkey = "1" then dim Server_Redirect_Url Server_Redirect_Url = "UpdateSerial_server.asp?serial="&Serial&"&productkey="&productkey&"&clintup_version="&clintup_version&"&clintup_date="&clintup_date&"&UseUpdateServer="&UseUpdateServer&"&tvai_date="&tvai_date&"&tvai_version="&tvai_version response.redirect(Server_Redirect_Url) response.end end if 'DB커낵션 변수 Dim StrConnect, pagesize , sql1, sql2, sql3 , sql4 , sql5 , Conn , rs1 Dim start_date , use_month , today_date , final_date , subscription , db_date , db_count , db_version , db_expire,db_name,db_tel,db_mobile , db_expire15 , db_expire5,spare %><% Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open StrConnect 'sql1="SELECT start_date , use_month , getdate() , DATEADD(mm,use_month,start_date), subscription , update_date, update_count ,update_version , DATEADD(mm,6,DATEADD(mm,use_month,start_date)) , DATEADD(d,-15,DATEADD(mm,use_month,start_date)) , DATEADD(d,-5,DATEADD(mm,use_month,start_date)) " 'sql1 = sql1 & " FROM " & table_name & " WHERE serial = '" & serial & "' " 'sqlul = "EXEC [sp_tvprodlog] @v_tblname ='tvprod_update_log' , @serial='" & serial & "' , @prokey ='" & productkey & "'" 'Conn.Execute(sqlul) sql1 = "EXEC UpdateSerialchk @v_tblname ='" & table_name & "' , @v_serial='" & serial & "'" 'response.write sql1 'response.end Set rs1 = Conn.Execute(sql1) '시리얼키 미입력 if rs1.eof then if Len(serial) = "18" then sql2 ="insert into " & table_name & " (serial , productkey , use_month , subscription , start_date , update_count , update_date , update_version , comment) values " sql2 = sql2 & "(" sql2 = sql2 & " '"& serial &"' , " sql2 = sql2 & " '"& productkey &"' , " sql2 = sql2 & " 12 , " sql2 = sql2 & " 1 , " sql2 = sql2 & " '"& Date() &"' , " sql2 = sql2 & " 0 , " sql2 = sql2 & " '2003-01-01' , " sql2 = sql2 & " '0,0,0,0' , " sql2 = sql2 & " '' ) " Conn.Execute(sql2) end if rs1.close Set rs1 = Nothing conn.CLose Set Conn = Nothing response.write ("UPDATEYES") response.end end if start_date= left(rs1(0) , 10) use_month= rs1(1) today_date= left(rs1(2),10) final_date= left(rs1(3),10) subscription= CLng(rs1(4)) db_date= left(rs1(5),10) if db_date = "" then db_date ="2004-06-03" end if db_count= rs1(6) if isnull(rs1(7)) or rs1(7) = "" then db_version = "0,0,0,0" else db_version=rs1(7) end if 'if db_version = "" then 'db_version = "0,0,0,0" 'end if db_expire= left(rs1(8),10) db_expire15= left(rs1(9),10) ' 사용만료 15일전~~ db_expire5= left(rs1(10),10) ' 사용만료 5일전~~ spare = rs1(12) if ISNULL(start_date) or start_date="" or start_date ="2002-03-02" then 'sql2="update " & table_name & " set start_date = '" & left(date(),10) & "' where serial = '" & serial & "'" sql2="exec [UpdateSerialversionchk] '" & table_name & "' ,'" & serial & "','','','','' " Conn.Execute(sql2) rs1.close Set rs1 = Nothing conn.CLose Set Conn = Nothing response.write ("UPDATEYES") response.end end if '사용기간만료인가 아닌가 체크해서 만료면 그냥 둡니다.. if final_date < today_date then rs1.close Set rs1 = Nothing conn.CLose Set Conn = Nothing if spare = "8" then response.write ("EVAL_30_EXPIRE") else response.write ("DATEEXPIRE") end if response.end end if '5일전에 보여주는 경고 메세지 출력시켜줄것. if db_expire5 <= today_date then rs1.close Set rs1 = Nothing conn.CLose Set Conn = Nothing response.write ("DATEEXPIRE5") response.end end if '15일전에 보여주는 경고 메세지 출력시켜줄것. if db_expire15 <= today_date then rs1.close Set rs1 = Nothing conn.CLose Set Conn = Nothing response.write ("DATEEXPIRE15") response.end end if '================================================================ '3개의 버전 (서버asp버전, DB버전, Client버전) 비교 후 업데이트 유무를 판별하는 함수 시작 '================================================================ Dim Array_tvai_version,Array_clint_version , Array_db_version , tvai_db_yes , tvai_clint_yes Array_clint_version = Split(clintup_version, ",", -1, 1) 'Client버전 Array_tvai_version = Split(tvai_version, ",", -1, 1) '서버asp버전 Array_db_version = Split(db_version, ",", -1, 1) 'DB버전 'Clint버전과 서버asp버전 의 버전이 일치 하는지 아닌지 '일치한다면 업데이트가 필요없는 경우 tvai_clint_yes = 0 '일치하지 않은 다면 업데이트가 필요한 경우 tvai_clint_yes = 1 tvai_clint_yes = 0 if CInt(Array_tvai_version(0)) = CInt(Array_clint_version(0)) and CInt(Array_tvai_version(1)) = CInt(Array_clint_version(1)) and CInt(Array_tvai_version(2)) = CInt(Array_clint_version(2)) and CInt(Array_tvai_version(3)) > CInt(Array_clint_version(3)) then tvai_clint_yes = 1 end if if CInt(Array_tvai_version(0)) = CInt(Array_clint_version(0)) and CInt(Array_tvai_version(1)) = CInt(Array_clint_version(1)) and CInt(Array_tvai_version(2)) > CInt(Array_clint_version(2)) then tvai_clint_yes = 1 end if if CInt(Array_tvai_version(0)) = CInt(Array_clint_version(0)) and CInt(Array_tvai_version(1)) > CInt(Array_clint_version(1)) then tvai_clint_yes = 1 end if if CInt(Array_tvai_version(0)) > CInt(Array_clint_version(0)) then tvai_clint_yes = 1 end if 'db의 버전과 서버asp버전 의 버전이 일치 하는지 아닌지 '일치한다면 중복업데이트 경우 tvai_db_yes = 0 '일치하지 않은 다면 신규 업데이트 tvai_db_yes = 1 tvai_db_yes = 0 if CInt(Array_tvai_version(0)) = CInt(Array_db_version(0)) and CInt(Array_tvai_version(1)) = CInt(Array_db_version(1)) and CInt(Array_tvai_version(2)) = CInt(Array_db_version(2)) and CInt(Array_tvai_version(3)) > CInt(Array_db_version(3)) then tvai_db_yes = 1 end if if CInt(Array_tvai_version(0)) = CInt(Array_db_version(0)) and CInt(Array_tvai_version(1)) = CInt(Array_db_version(1)) and CInt(Array_tvai_version(2)) > CInt(Array_db_version(2)) then tvai_db_yes = 1 end if if CInt(Array_tvai_version(0)) = CInt(Array_db_version(0)) and CInt(Array_tvai_version(1)) > CInt(Array_db_version(1)) then tvai_db_yes = 1 end if if CInt(Array_tvai_version(0)) > CInt(Array_db_version(0)) then tvai_db_yes = 1 end if 'response.write ( "\\"&CInt(Array_tvai_version(0)) &"// \\"& CInt(Array_db_version(0)) &"//
") 'response.write ( "\\"&CInt(Array_tvai_version(1)) &"// \\"& CInt(Array_db_version(1)) &"//
") 'response.write ( "\\"&CInt(Array_tvai_version(2)) &"// \\"& CInt(Array_db_version(2)) &"//
") 'response.write ( "\\"&CInt(Array_tvai_version(3)) &"// \\"& CInt(Array_db_version(3)) &"//
") 'response.write ( tvai_db_yes ) '================================================================ '3개의 버전 (서버버전, DB버전, Client버전) 비교 후 업데이트 유무를 판별하는 함수 끝 '================================================================ '서버버전과 DB버전이 같으냐? '같으면(tvai_db_yes = 0) 1회 이상 업데이트 한경우입니다. 다르다면(tvai_db_yes = 1) 업데이트를 처음 한 경우 입습죠. if tvai_db_yes = 1 then '서버버전과 DB버전이 다른 경우 입니다. 서버 버전을 db버전과 일치 시키고 업데이트 시킵니다. 'sql4="update " & table_name & " set update_date = '" & tvai_date & "' , update_count=1 , update_version = '" & tvai_version & "' where serial = '" & serial & "'" sql4="exec [UpdateSerialversionchk] '" & table_name & "' ,'" & serial & "','','" & tvai_date & "','1','" & tvai_version & "' " Conn.Execute(sql4) response.write ("UPDATEYES") 'response.end else '서버버전과 DB버전이 같은 경우입니다. 현재 버전으로 1회 업데이트를 한 조건입니다. '서버버전과 Client 버전이 같으냐? '같으면(tvai_Client_yes = 0) 업데이트가 필요없습니다. 다르다면(tvai_Client_yes = 1) 중복업데이트일수 있습니다. if tvai_clint_yes = 0 then '서버버전과 Client 버전이 같은 경우로 업데이트가 필요없습니다. response.write ("UPDATEYES") else '서버버전과 Client 버전이 다른 경우로 업데이트 횟수를 +1 시킵니다. 'sql5="update " & table_name & " set update_count=update_count+1 where serial = '" & serial& "'" sql5= "exec [UpdateSerialversionchk] '" & table_name & "' ,'" & serial & "','','','update_count+1','' " Conn.Execute(sql5) '과다사용인지 체크합니다. if (subscription * 3) < db_count then 'response.write ("UPDATECOUNTNO") '업데이트 횟수 'response.write ("업데이트 여러번 하면 안되
") response.write ("UPDATEYES") '업데이트 횟수 else response.write ("UPDATEYES") End If '업데이트 횟수 End If '서버버전과 Client 버전이 같으냐 if End If '서버버전과 DB버전이 같으냐 if rs1.close Set rs1 = Nothing conn.CLose Set Conn = Nothing 'http://update.everyzone.com/turbovaccineupdate_r3/x86/update/updateSerial_test.asp?serialkey=6F62FD321AFC6AF4&productcode=7&upversion=2011,10,1,0 'http://www.turboupdate.com/tv/manager_updateserial.asp?serialkey=F559CE8269880CB7&productcode=0&upversion=1,0,2,109 'http://www.turboupdate.com/tv/manager_updateserial.asp?serialkey=17F400918F2BD57F&productcode=1&upversion=1,0,2,109 '매니저 :http://www.turboupdate.com/tv/manager_updateserial.asp?serialkey=6B83EB0577E0B973&productcode=2&upversion=1,0,2,109 '6B83EB0577E0B973 %>