| ||
| This image has been viewed <% Response.write page_hits %> times.Current Rating: <% Const FReading = 1, FWriting = 2, FAppending = 3 Const TstateUseDefault = -2, TstateTrue = -1, TstateFalse = 0 Dim strURL, strLength, counter, findSlash, lastSlash, page strURL = Request.ServerVariables("URL") strLength = len(strURL) FOR counter=1 TO strLength findSlash=instr(counter,strURL,"/") IF findslash = 0 then lastSlash = instr(counter-1,strURL,"/") exit FOR END IF NEXT page = Mid(strURL,lastSlash+1,strLength) page1 = Split(page, ".") Filex = "/" & page1(0) & "rating.txt" Filey = "" & Filex & "" set FS = server.createObject("Scripting.FileSystemObject") Dim Filepat Filepat = Server.MapPath(Filey) if FS.FileExists(Filepat) Then Set TStream = FS.OpenTextFile(Filepat, FReading, False,TstateUseDefault) Dim Content,totaltext,RateCount,RateSum Content = TStream.ReadLine totaltext = Split(Content, "-") RateCount = totaltext(0) RateSum = totaltext(1) resultant = RateSum/RateCount Response.write "" & Round(resultant,2) & "" TStream.Close Set TStream = nothing else Response.write "0" End If Set FS = nothing %> |