<% Server.ScriptTimeOut = 1200 'If Session("Webmaster") <> "Validated" Then 'Response.Redirect("/ctrfiles/stats/login.asp") 'End if %>

  Maris - IDX Feed Update::.
<% IF Request.Form("Continue") = "Continue" Then 'Call DownloadDump() 'Call UnzipDump() 'Call DownloadCatalog() 'Call BackUpDatabase() 'Call PopulateDatabase() 'Call CompactDatabase() 'Call UploadDatabase() Sub DownloadDump() On Error Resume Next set ftp = Server.CreateObject("Majodio.FTP") ftp.URL = "64.218.72.24" ftp.Username = "anonymous" ftp.Password = "someone@nowhere.com" ftp.port = 21 ftp.TransferType = 2 ftp.Passive = True ftp.OpenConnection() ftp.GetFile "/idx/idx.zip", "F:\webroot\houseview-online.com\IDX\showcase\idx.zip", True set ftp = Nothing IF Err.Number = 0 Then Response.Write("
Maris IDX Dump Retrevial Success
") Call UnzipDump() Elseif Err.Number <> 0 Then Response.Write("
Error Retrieving File From Maris, Process aborted
") Response.End End if End Sub Sub UnzipDump() On Error Resume Next set zip = Server.CreateObject("aspZip.EasyZip") Zip.ZipFileName = "F:\webroot\houseview-online.com\IDX\showcase\idx.zip" Zip.ArgsAdd("*.*") Zip.ExtrbaseDir = "F:\webroot\houseview-online.com\IDX\showcase\" Zip.UnZip Set ZIP = Nothing IF Err.Number = 0 Then Response.Write("
Maris IDX Dump Unzip SuccessFull
") Call DownloadCatalog() Elseif Err.Number <> 0 Then Response.Write("
Error Unzipping IDX Dump, " & Zip.LastMessage & " Process aborted
") Response.End End if End Sub Sub DownloadCatalog() On Error Resume Next set ftp = Server.CreateObject("Majodio.FTP") ftp.URL = "69.24.66.2" ftp.Username = "sslinkard" ftp.Password = "Go2House$" ftp.port = 21 ftp.TransferType = 2 ftp.Passive = True ftp.OpenConnection() ftp.GetFile "/db/catalog.mdb", "F:\webroot\houseview-online.com\IDX\showcase\catalognew2.mdb", True set ftp = Nothing IF Err.Number = 0 Then Response.Write("
Catalog Database Download SuccessFull
") Call BackUpDatabase() Elseif Err.Number <> 0 Then Response.Write("
Error Downloading Catalog Database, Process aborted
") Response.End End if End Sub Sub BackUpDatabase() On Error Resume Next 'Create an intence of the FSO object Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 'Database Name And Location and Connection strDbPathAndName = Server.MapPath("/IDX/showcase/catalognew2.mdb") 'Back up the database in case something goes wrong objFSO.CopyFile strDbPathAndName, Replace(strDbPathAndName, ".mdb", "-backup.mdb", 1, -1, 1) 'Get the destination and name of the to be worked then compacted database strWorkDB = Replace(strDbPathAndName, ".mdb", "-wrk.mdb", 1, -1, 1) 'Make a Working Copy of the database objFSO.CopyFile strDbPathAndName, strWorkDB 'Release FSO object Set objFSO = Nothing IF Err.Number = 0 Then Response.Write("
Existing Catalog Database Succssfully backed Up
") Call PopulateDatabase(strWorkDB,strDbPathAndName) Elseif Err.Number <> 0 Then Response.Write("
Error Backing Up Catalog Database, Process aborted
") Response.End End if End Sub 'Sub PopulateDatabase(strWorkDB,strDbPathAndName) 'On Error Resume Next Set Connect = Server.CreateObject("ADODB.Connection") 'Connect.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & strWorkDB Connect.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/IDX/showcase/catalognew2-wrk.mdb") 'Create an intence of the FSO object Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 'Empty the Listings Table to be re-populated Connect.execute("DELETE * FROM IDX") Set MyTextFile = objFSO.OpenTextFile(Server.MapPath("/IDX/showcase/dump.txt"),1,-2) Do While MyTextFile.AtEndOfStream <> TRUE strLine = Trim(MyTextFile.ReadLine) allelements = Split(strLine,"|") IF allelements(17) = "EXIT01" Then sqlnew = "insert into IDX(PropertyType,StreetName,StreetAdditionalInfo,StreetNumber,StreetDirection,StreetSuffix,UnitNumber,City,State,ZipCode,ListingAgentName,ListingAgentID,ListingOfficeName,ListingOfficeID,ListingPrice,Remarks,ListingStatus,SchoolDistrict,ElementarySchool,JrHighSchool,SrHighSchool,PropertyAge,MLSNumber,Status,StatusCode,Subdivision,NoAcres,lotDimensions,VirtualtourLink,totalbedrooms,totalbaths) values('"&Replace(allelements(0),"'","''")&"','"&Replace(allelements(1),"'","''")&"','"&Replace(allelements(2),"'","''")&"','"&Replace(allelements(3),"'","''")&"','"&Replace(allelements(4),"'","''")&"','"&Replace(allelements(5),"'","''")&"','"&Replace(allelements(6),"'","''")&"','"&Replace(allelements(7),"'","''")&"','"&Replace(allelements(8),"'","''")&"','"&Replace(allelements(9),"'","''")&"','"&Replace(allelements(10),"'","''")&"','"&Replace(allelements(12),"'","''")&"','"&Replace(allelements(14),"'","''")&"','"&Replace(allelements(17),"'","''")&"','"&Replace(allelements(21),"'","''")&"','"&Replace(allelements(27),"'","''")&"','"&Replace(allelements(34),"'","''")&"','"&Replace(allelements(80),"'","''")&"','"&Replace(allelements(81),"'","''")&"','"&Replace(allelements(82),"'","''")&"','"&Replace(allelements(83),"'","''")&"','"&Replace(allelements(91),"'","''")&"','"&Replace(allelements(94),"'","''")&"','"&Replace(allelements(111),"'","''")&"','"&Replace(allelements(112),"'","''")&"','"&Replace(allelements(229),"'","''")&"','"&Replace(allelements(233),"'","''")&"','"&Replace(allelements(238),"'","''")&"','"&Replace(allelements(278),"'","''")&"','"&Replace(allelements(219),"'","''")&"','"&Replace(allelements(221),"'","''")&"')" 'Connect.execute(sqlnew) Response.Write(sqlnew & "
") End if Loop Set MyTextFile = Nothing Connect.Close Set Connect = Nothing Set objFSO = Nothing ' IF Err.Number = 0 Then Response.Write("
Catalog Database Succssfully Updated
") ' Call CompactDatabase(strWorkDB,strDbPathAndName) 'Elseif Err.Number <> 0 Then ' Response.Write("
Error Updating Catalog Database, Process aborted
") ' Response.End ' End if 'End Sub Sub CompactDatabase(strWorkDB,strDbPathAndName) On Error Resume Next 'Create an intence of the FSO object Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 'Create an intence of the JET engine object Set objJetEngine = Server.CreateObject("JRO.JetEngine") 'Get the destination and name of the to be worked then compacted database strCompactDB = Replace(strDbPathAndName, ".mdb", "-tmp.mdb", 1, -1, 1) 'Make a Working Copy of the database strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & strWorkDB 'Compact database objJetEngine.CompactDatabase strCon, "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & strCompactDB 'Release Jet object Set objJetEngine = Nothing 'Delete old databases objFSO.DeleteFile strDbPathAndName objFSO.DeleteFile strWorkDB 'Rename temporary database to old name objFSO.MoveFile strCompactDB, strDbPathAndName 'Compact and Restore database Routine================================================================ '==================================================================================================== 'Release FSO object Set objFSO = Nothing IF Err.Number = 0 Then Response.Write("
Catalog Database Compacted and Repaired Succssfully
") Call UploadDatabase() Elseif Err.Number <> 0 Then Response.Write("
Error Compacting and Repairing Catalog Database, Process aborted
") Response.End End if End Sub Sub UploadDatabase() On Error Resume Next set ftp = Server.CreateObject("Majodio.FTP") ftp.URL = "69.24.66.2" ftp.Username = "sslinkard" ftp.Password = "Go2House$" ftp.port = 21 ftp.TransferType = 2 ftp.Passive = True ftp.OpenConnection() ftp.PutFile "F:\webroot\houseview-online.com\IDX\showcase\catalognew2.mdb", "/db/catalognew.mdb" set ftp = Nothing IF Err.Number = 0 Then Response.Write("
New Database Successfully Uploaded...... IDX Updata Complete
") ' Call SendConfirmation() Elseif Err.Number <> 0 Then Response.Write("
Error Uploading Catalog Database, Process aborted
") Response.End End if End Sub Sub SendConfirmation() On Error Resume Next set msg = Server.CreateOBject("JMail.Message") msg.Logging = True msg.silent = True msg.From = "info@stlouisshowcase.com" msg.FromName = "Bo Bickley" msg.AddRecipient "bbickley@stlouisshowcase.com" msg.AddRecipientBCC "scott@houseviewonline.com" msg.Subject = "Maris IDX Updated" msg.Body = "Maris IDX Update Completed Successfully at " & now() msg.Priority = 3 msg.Send("mail.clas.net") set msg = Nothing IF Err.Number = 0 Then Response.Write("
Conirmation Email Sent
") Elseif Err.Number <> 0 Then Response.Write("
Error Sending Confiramtion Email, Process aborted
") Response.End End if End Sub End if %> This will Update the IDX Feed