%
'-----------------------------
sub WriteCountNumber
today = day(now)
line = GetTextFileLine(CountFileName)
countArr = split(line, "|")
totalCountNumber = countArr(0) '총 카운트 숫자
todayCountNumber = countArr(1) '오늘의 카운트
yesterdayCountNumber = countArr(2) '어제의 카운트
counterDay = countArr(3) '카운터에 기록된 날짜
if not cint(counterDay) = today then
yesterdayCountNumber = todayCountNumber
todayCountNumber = 0
counterDay = today
end if
countArr(0) = totalCountNumber + 1
countArr(1) = todayCountNumber + 1
countArr(2) = yesterdayCountNumber
countArr(3) = counterDay
WriteTextFileLine CountFileName, join(countArr, "|")
end sub
'-----------------------------
function GetTextFileLine(fileName) '텍스트 파일을 하나의 라인으로 읽어 온다.
set fso = server.createObject("scripting.fileSystemObject")
set file = fso.openTextFile(fileName, 1)
line = file.readAll
file.close
set file = nothing
set fso = nothing
GetTextFileLine = line
end function
'-----------------------------
sub WriteTextFileLine(fileName, line) '텍스트 파일을 덮어 쓴다.
set fso = server.createObject("scripting.fileSystemObject")
set file = fso.openTextFile(fileName, 2)
file.write line
file.close
set file = nothing
set fso = nothing
end sub
'-----------------------------
CountFileName = server.mappath(".")&"\count.dat" '카운트 파일 이름
if request.cookies("count_check") = "" then
WriteCountNumber
response.cookies("count_check") = "counted"
end if
line = GetTextFileLine(CountFileName)
countArr = split(line, "|")
totalCountNumber = countArr(0) '총 방문객 숫자
todayCountNumber = countArr(1) '오늘의 방문객 숫자
yesterdayCountNumber = countArr(2) '어제의 방문객 숫자
Count = totalCountNumber & " " & todayCountNumber
for i = 1 to len(Count)
select case Mid(Count,i,1)
case "1"
ImgCount = ImgCount & "
"
case "2"
ImgCount = ImgCount & "
"
case "3"
ImgCount = ImgCount & "
"
case "4"
ImgCount = ImgCount & "
"
case "5"
ImgCount = ImgCount & "
"
case "6"
ImgCount = ImgCount & "
"
case "7"
ImgCount = ImgCount & "
"
case "8"
ImgCount = ImgCount & "
"
case "9"
ImgCount = ImgCount & "
"
case "0"
ImgCount = ImgCount & "
"
case else
ImgCount = ImgCount & Mid(Count,i,1)
End select
Next
%>
| <%=imgcount%> | |
|
|
|
|