Problemet med Response.Write(Hour(Now()) & ":" & Minuts(Now()))Response.Write(Hour(Now()) & ":" & Minuts(Now())) er at det teoretisk er muligt for de to aflæsninger af now() at ske sådan: den første aflæser 13.59 og den anden 14.00 - så resultatet bliver 13:00 - en time forkert.
Hvis den skal bruges i denne(beklager at jeg ikke skrev det i starten... men jeg tænkte ikke i Response...):
<% antal = 0 Application.Lock LocalOnline = Application("BrugereOnline")
FOR k=0 TO UBOUND(LocalOnline, 1) if LocalOnline(k, 0) <> "0" and LocalOnline(k, 0) <> "" then antal = antal + 1 end if if datediff("s",LocalOnline(k,7), now) >= LocalOnline(k,8) * 60 then LocalOnline(k, 0) = "" end if IF LocalOnline(k, 0) = session("id") and session("id") <> "0" THEN LocalOnline(k, 7) = now END IF NEXT
Application("BrugereOnline") = LocalOnline Application("AntalBrugere") = antal Application.UnLock %>
<% antal = 0 Application.Lock LocalOnline = Application("BrugereOnline")
FOR k=0 TO UBOUND(LocalOnline, 1) if LocalOnline(k, 0) <> 0 and LocalOnline(k, 0) <> "" then antal = antal + 1 end if if datediff("s",LocalOnline(k,7), now) >= LocalOnline(k,8) * 60 then LocalOnline(k, 0) = "" end if IF LocalOnline(k, 0) = session("id") and session("id") <> 0 THEN strTid = Now() LocalOnline(k, 7) = Hour(strTid)& ":" & Minuts(strTid) END IF NEXT
Application("BrugereOnline") = LocalOnline Application("AntalBrugere") = antal Application.UnLock %>
<% antal = 0 Application.Lock LocalOnline = Application("BrugereOnline")
FOR k=0 TO UBOUND(LocalOnline, 1) if LocalOnline(k, 0) <> 0 and LocalOnline(k, 0) <> "" then antal = antal + 1 end if if datediff("s",LocalOnline(k,7), now) >= LocalOnline(k,8) * 60 then LocalOnline(k, 0) = "" end if IF LocalOnline(k, 0) = session("id") and session("id") <> 0 THEN strTid = Now() LocalOnline(k, 7) = Hour(strTid)& ":" & Minute(strTid) END IF NEXT
Application("BrugereOnline") = LocalOnline Application("AntalBrugere") = antal Application.UnLock %>
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.