<%@ LANGUAGE = VBScript%><% location = "D:\inetpub\wwwroot\cyberoculus.com\data\bf\roster\" gName = Request("Warrior") Set fso = CreateObject("Scripting.FileSystemObject") if gName <> "" and Not fso.FileExists(location & gName & ".txt") then gName="" Sub StartUp() Response.Write "" & chr(13) Response.Write " " & chr(13) Response.Write " Fusilier Roster - " & gName &"" & chr(13) Response.Write " " & chr(13) Response.Write " " & chr(13) Response.Write " " & chr(13) Response.Write " " & chr(13) End Sub Sub Titles() Dim fso 'File System Object variable Dim f 'File for use Dim ModDate 'Date Last Modified 'Create objects and Initialize Variables Set fso = CreateObject("Scripting.FileSystemObject") Set f = FSO.GetFile(location & gNAme & ".txt") ModDate = f.DateLastModified Response.Write " " & chr(13) Response.Write " " & chr(13) Response.Write " " & chr(13) Response.Write " " & chr(13) Response.Write " " & chr(13) Response.Write " " & chr(13) Response.Write " " & chr(13) End Sub Sub Info() 'Dimension variables Dim ColonLoc 'Location of the : in the string Dim Counter 'Counter for repeating read/writes Dim fso 'File System Object variable Dim f 'File to open as a Text Stream Dim s, tmpS, tmpStr 'Strings Dim LineTitle 'Title of the current line in the text file Dim ts 'Text Stream Dim NumOfMedals 'Total number of metals the person has 'Create objects and Initialize Variables Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFile(location & gname & ".txt") Set ts = f.OpenAsTextStream(1) 'Count the number of medals and then close and reopen the file NumOfMedals = 0 Do While not ts.AtEndOfStream s = ts.ReadLine ColonLoc = Find (":", s) LineTitle = Left(s,ColonLoc - 1) If Left(UCASE(LineTitle), 5) = "MEDAL" then If Right(s, Len(s) - (ColonLoc + 1)) <> "0" then NumOFMedals = NumOfMedals + 1 End If Loop ts.Close Set ts = f.OpenAsTextStream(1) Counter = 2 - NumOfMedals Mod 3 Do While not ts.AtEndOfStream s = ts.ReadLine ColonLoc = Find (":", s) LineTitle = Left(s,ColonLoc - 1) Select Case UCASE(LineTitle) Case "SONG" Response.Write "
" Response.Write chr(13) Case "PICTURE" BreakBar() Response.Write " " & chr(13) Response.Write " " & chr(13) Response.Write " " & chr(13) Response.Write " " & chr(13) Response.Write " " & chr(13) Response.Write " " & chr(13) Response.Write " " & chr(13) Response.Write " " & chr(13) For Each f1 in fc If UCase(Right(f1.name, 4)) = ".TXT" Then If Counter = 1 Then Response.Write " " & chr(13) End If Response.Write " " & chr(13) If Counter = 4 Then Response.Write " " & chr(13) Counter = 0 End If Counter = Counter + 1 End If Next End Sub Sub ShutDown() Response.Write "
" & chr(13) Response.Write "
" & chr(13) Response.Write "  & chr(34) &
" & chr(13) Response.Write "  & chr(34) &
" & chr(13) Response.Write " Personal Data File
" & chr(13) Response.Write " " & UCase(gName) Response.Write "


" & chr(13) Response.Write " This Page was last updated on" & chr(13) Response.Write " " Response.Write MonthName(Month(ModDate)) & " " & Day(ModDate) & ", " Response.Write (3059 + (Year(ModDate) - 1999)) & "
" & chr(13) End Sub Function Find(theSubString, theString) Dim Counter 'Counter for incrementing location in loop Dim FoundIt 'Did we find the string yet? Dim MaxLoc 'Maximum possible location of theSubString in theString Dim SubLen 'Length of theSubString Counter = 1 FountIt = False SubLen = Len (theSubString) MaxLoc = Len (theString) - SubLen While FoundIt = False If Mid (theString, Counter, SubLen) = theSubString Then FoundIt = True If Counter > MaxLoc Then Counter = 0 FoundIt = True Else Counter = Counter + 1 End If Wend Find = Counter - 1 End Function Sub DisplayInfo(s, ColonLoc) Response.Write " " & Left(s, ColonLoc) & "" & chr(13) Response.Write " " & Right(s, Len(s) - ColonLoc) Response.Write "
" & chr(13) End Sub Sub BreakBar() Response.Write "
" & chr(13) Response.Write "
" & chr(13) Response.Write "
" & chr(13) Response.Write "
" & chr(13) Response.Write "
" & chr(13) Response.Write "  & chr(34) & gName
        Response.Write chr(34) & " & chr(13) Response.Write " " & chr(13) Case "BIRTH" If Left (s, ColonLoc) = "Birth:" Then s = "Age: " & DateDiff("yyyy", CDate(Right(s,Len(s) - 6)), Date) ColonLoc = 4 End If DisplayInfo s, ColonLoc Case "MECH OF CHOICE" BreakBar() Response.Write " " & chr(13) Response.Write "  & chr(34)
        Response.Write Right(s, Len(s) - (ColonLoc + 1)) & chr(34) & " & chr(13) Response.Write " " & chr(13) DisplayInfo s, ColonLoc Case "AWARDS" BreakBar() Response.Write " " & chr(13) Response.Write " Awards and Decorations" & chr(13) Response.Write "
" & chr(13) tmpStr = "
" Case Else If Left(UCASE(LineTitle), 5) <> "MEDAL" then DisplayInfo s, ColonLoc Else If Right(s, Len(s) - (ColonLoc + 1)) <> "0" then If Counter < 2 Then Counter = Counter + 1 Else Counter = 0 Response.Write "
" & chr(13) tmpStr = tmpStr + "
" End If tmpS = Right (LineTitle, Len(LineTitle) - 8) if (Len(tmpStr) > 16) and (Counter <> 0) then tmpStr = tmpStr + "," tmpStr = tmpStr + " " & tmpS & "(" & Right(s, Len(s) - (ColonLoc + 1)) & ")" Response.Write "  & chr(34) & tmpS & chr(34) & " & chr(13) End If End If End Select Loop Response.Write tmpStr & chr(13) ts.Close BreakBar() End Sub Sub Who() 'Dimension variables Dim Counter 'Counter for counting files Dim fso 'File System Object variable Dim f 'Folder variable Dim f1 'Throw away variable for looping through files & folders Dim fc 'Folders Variable 'Create objects and Initialize Variables Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFolder(location) Set fc = f.Files Counter = 1 Response.Write "
Select a warrior:
" & Left(f1.name, Len(f1.name) - 4) Response.Write "
" & chr(13) Response.Write "
" & chr(13) Response.Write " " & chr(13) Response.Write " " & chr(13) Response.Write "" & chr(13) End Sub StartUp() If gName <> "" Then Titles() Info () Else Who() End If Shutdown()%>