%
const htmlBr = "
"
Dim fs, f, area, script_name, cookie_name
area = Request.ServerVariables("QUERY_STRING") 'section a, b, c or d
script_name = Request.ServerVariables("SCRIPT_NAME") 'use script_name for unqiue name for cookie to stop episodes effecting each other
cookie_name = "ydkj_room_" & script_name & "_" & area
'If no cookie set yet for section start on room 1.
If Request.cookies(cookie_name)="" Then
Response.cookies(cookie_name) = 1
End If
n = Request.cookies(cookie_name)
'Update cookie
Response.cookies(cookie_name) = n+1
'Make sure you get the next page when you next request
Response.AddHeader "cache-control", "private"
Response.Addheader "pragma", "no-cache"
Response.Expires = 0
Set fs = CreateObject("Scripting.FileSystemObject")
Function CheckExists(folderspec,htmlFile)
Dim f1, fc, s
Set f = fs.GetFolder(folderspec)
Set fc = f.Files
CheckExists=false
For Each f1 in fc
If f1.name = htmlFile Then CheckExists=true
s = s & f1.name
s = s & htmlBr
Next
' Response.write(s)
End Function
Dim Room, Path
Path = Request.ServerVariables("PATH_TRANSLATED")
Room = Left(Path,Len(Path)-8) & area
CurrentFile = "room" & n & ".html"
' Response.write Room & htmlBr
' Response.write CheckExists(Room,CurrentFile) & htmlBr
If CheckExists(Room,CurrentFile) Then
Set f = fs.OpenTextFile(Room & "\" & CurrentFile)
Response.write f.ReadAll
Else
Set f = fs.OpenTextFile(Room & "\final.html")
Response.write f.ReadAll
End If
%>