Here is the code
<%
'Create object to put script at sleep to avoid tarpit
Set Shell = CreateObject("Wscript.Shell")
Dim PathToPB
'Open recordset with players
rst.OPEN "SELECT playerID, playerLFSWNick FROM tblPlayers WHERE playerStatus = 1 OR playerStatus = 2 OR playerStatus = 3", Conn, 3, 1
if not rst.EOF then
'Loop through recordset
Do While Not rst.EOF
'Empty txt file containing data
EmptyTxt(PathToPBTxt)
'URL (path) to LFSWorld Pubstat PB data
PathToPB = PubStatPB & rst("playerLFSWNick")
'Create object to "grab" data from LFSWorld
Dim xobjPB
Set xobjPB = CreateObject("SOFTWING.ASPtear")
'"grab" data from LFSWorld
Dim strRetPB
strRetPB = xobjPB.Retrieve(PathToPB, Request_GET, "test=wille", "", "")
'Destroj object
Set xobjPB = nothing
'Check if there is any record
if Trim(strRetPB) = "pb: racer has no pbs" then
Response.Write("No PB's for: " & rst("playerLFSWNick") & "<br>")
elseif Trim(strRetPB) = "can't reload this page that quickly after another" then
Response.Write("Too soon<br>")
else
'Save data to TXT file
Call SaveToTxt(PathToPBtxt, strRetPB)
'Read data from TXT file and put it into array
dim strPB
redim arrPB(-1)
dim e, objFSPB, objTSPB
set objFSPB = Server.CreateObject("Scripting.FileSystemObject")
set objTSPB = objFSPB.OpenTextFile(PathToPBtxt, ForReading)
e = 1
do until objTSPB.AtEndOfStream
redim preserve arrPB(e)
arrPB(e) = objTSPB.ReadLine
e = e + 1
loop
set objFSPB = nothing
Set objTSPB = nothing
'Parse data from array
Dim fPB
Dim arrPBUpper, SplitPB
Dim PBId, PBTrack, PBCar, PBSplit1, PBSplit2, PBSplit3, PBTime, PBLaps
Dim PBPlayerID, PBTrackID, PBCarID
fPB = 1
arrPBUpper = UBound(arrPB)
Do While Not fPB > arrPBUpper
SplitPB = Split(arrPB(fPB), " ")
PBTrack = SplitPB(0)
PBCar = SplitPB(1)
PBTime = SplitPB(2)
PBLaps = SplitPB(3)
PBPlayerID = rst("playerID")
PBTrackID = GetTrackID_LFSWID(PBTrack)
PBCarID = GetCarID_CarShort(PBCar)
'open recordset with players records and insert or modify record
rst2.OPEN "SELECT playerID, carID, trackID, recordLFSOnline, recordLFSHotLap, recordLFSLapper FROM tblRecords WHERE playerID = " & PBPlayerID & " AND carID = " & PBCarID & " AND trackID = " & PBTrackID & "", Conn, 1, 2
if rst2.EOF then
rst2.AddNew
rst2("playerID") = PBPlayerID
rst2("carID") = PBCarID
rst2("trackID") = PBTrackID
rst2("recordLFSOnline") = PBTime
rst2("recordLFSHotLap") = "0"
rst2("recordLFSLapper") = "0"
rst2.Update
else
if rst2("recordLFSOnline") <> PBTime then
rst2("playerID") = PBPlayerID
rst2("carID") = PBCarID
rst2("trackID") = PBTrackID
rst2("recordLFSOnline") = PBTime
rst2.Update
end if
end if
rst2.Close
fPB = fPB + 1
Loop
end if
'Move to next player
rst.MoveNext
'Empty TXT file
EmptyTxt(PathToPBTxt)
Response.Flush()
'Put script to sleep for 6 seconds
Shell.Popup "", 6
Loop
end if
'Destroy shell object
Set shell = nothing
%>