Just nu i M3-nätverket
Jump to content

Problem med onlinelista


Gammacea

Recommended Posts

Inte för att jag vet vad jag sysslar med när det gäller ASP, men detta problem är lite över mitt lilla logiska tänkande. Har en onlinelista på min sajt, funkar kanon. tar denna koden å lägger på default.asp (som givetvis ligger i rooten och det gör databasen oxå) för att visa vilka sidor som besöks även på startsidan, funkar kanon.

 

Nu kommer det skumma... tar exakt samma kod och lägger på nyheter_pa_ig.asp som också ligger i rooten, helt plötsligt så nollställer den antal online... hmmm någon som har något förslag på vad det kan bero på.

 

koden jag använder för att visa var besökarna befinner sig ser ut som följande:

======================================================================

[log]

<%

 

Set Connect = Server.CreateObject("ADODB.Connection")

Connect.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("xxx.mdb")

 

Set RecSet = Server.CreateObject("ADODB.Recordset")

Radera = "DELETE FROM besokare WHERE Tid < '" & DateAdd("n","-20",now()) & "'"

 

 

RecSet.Open Radera, Connect

 

Addera = " SELECT * FROM besokare WHERE Tid > '" & DateAdd("n","-20",now()) & "'"

RecSet.Open Addera, Connect

 

Response.Write "<table border=""0"">"

While Not RecSet.EOF

 

IF RecSet("Sida") = "/lista.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren tittar på " & "" & "Onlinelistan" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/butiker/001inkclub/index.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren tittar på " & "" & "InkClubs annons" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/butiker/002tradera/index.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren tittar på " & "" & "Traderas annons" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/Plan2/onlinespel.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren tittar på " & "" & " Onlinespel" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/Plan1/script.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren tittar på " & "" & "scriptsamlingen" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/igtavlingar.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren besöker " & "" & "IG's tävlingar" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/default.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren är på " & "" & "Startsidan" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/formular/tavling1.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren håller på med " & "" & "I-G's tävling" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/Plan2/poker.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren tittar på " & "" & "Poker online" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/Plan3/film_musik.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren tittar på sidan " & "" & "Film och musik" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/riktnummer/allariktnummer.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren tittar på " & "" & "riktnummer Sverige" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/riktnummer/search.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren granskar " & "" & "sökresultat riktnummer" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/Plan3/klader.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren tittar på " & "" & "Postorder och kläder" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/forslag_till_ig.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren tittar på sidan " & "" & "Förslag till IG" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/nyheter_pa_ig.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren tittar på " & "" & "Nyheter på IG" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/LiquidChat2/Enter.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren är och " & "" & "Chattar på Café Chatterian" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/LiquidChat2/default.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren ska " & "" & "logga in till Café Chatterian" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/tipsa.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren funderar på att " & "" & "tipsa en vän om IG" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/formular/skicka_annons.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren har skickat " & "" & "annons till IG" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/butiker/visa.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren tittar på " & "" & "Annonserna" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/tack.html" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren har skickat " & "" & "tips om IG till en vän" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/kontakt/kontakt.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren " & "" & " kontaktar InternetGallerian" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/links_to_tavlingar.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren tittar på " & "" & " Länkar till tävlingar" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/skicka.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren skickade tips " & "" & " om InternetGallerian" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/Default.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren är på " & "" & "Startsidan" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/Formular/formular_alt.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren tittar på " & "" & "Annonsera på InternetGallerian" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/Formular/skicka.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren har skickat " & "" & "Annons till InternetGallerian" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

ElseIf RecSet("Sida") = "/tavling3.asp" THEN

Response.write "<tr><td width=""75%"" bgcolor=""#A6B3BD""> <Font face=""Verdana"" size=""1"">" & "Besökaren håller på med " & "" & " InternetGallerians tävling" & "" & "</td><td width=""90px"" align=""center"" bgcolor=""#99CCCC""> <Font face=""Verdana"" size=""1"">" & RecSet("Klocka") & "</td></tr>" & "</font>"

 

 

 

 

END IF

 

RecSet.MoveNext

Wend

 

RecSet.Close

Connect.close

Set Radera=Nothing

Set Addera=Nothing

Response.Write "</table>"

%>

========================================================================

 

Koden i början av SAMTLIGA asp-sidor på platsen ser ut som följer:

========================================================================

 

<%

Dim Conn, RS, sida

Set Conn = Server.CreateObject("ADODB.Connection")

Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("xxx.mdb") & ";"

 

Set RS = Conn.execute("SELECT count(ID) as online FROM besokare WHERE Tid > '" & DateAdd("n","-20",now()) & "'")

 

%>

<%

 

Set Conn = Server.CreateObject("ADODB.Connection")

Conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("xxx.mdb")

 

Set RecSet = Server.CreateObject("ADODB.Recordset")

Radera = "DELETE FROM besokare WHERE Tid < '" & DateAdd("n","-20",now()) & "'"

 

 

RecSet.Open Radera, Conn

%>

<% 'dessa rader är nyinlagda

 

Set Conn = Server.CreateObject("ADODB.Connection")

Conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("xxxx_xx.mdb")

 

Set RecSet = Server.CreateObject("ADODB.Recordset")

Radera = "DELETE FROM besokare WHERE Tid < '" & DateAdd("d","-5",now()) & "'"

 

 

RecSet.Open Radera, Conn

'ner hit %>

<%

Dim Connect, Radera, Addera, RecSet

Set Connect = Server.CreateObject("ADODB.Connection")

Connect.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("xxx.mdb")

 

Set RecSet = Server.CreateObject("ADODB.Recordset")

Radera = "SELECT * FROM besokare WHERE ID = '" & Request.ServerVariables("REMOTE_ADDR") & "'"

RecSet.Open Radera, Connect, adOpenStatic, adLockOptimistic

If RecSet.EOF Then

Radera=null

Else

 

 

RecSet.Delete

 

RecSet.Close

Connect.Close

End If

%>

 

<% Set Connect = Server.CreateObject("ADODB.Connection")

Connect.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("xxx.mdb")

 

Set RecSet = Server.CreateObject("ADODB.Recordset")

Addera = "SELECT * FROM besokare"

 

RecSet.Open Addera, Connect, adOpenStatic, adLockOptimistic

 

RecSet.AddNew

 

RecSet("ID") = Request.ServerVariables("REMOTE_ADDR")

RecSet("Sida") = Request.ServerVariables("PATH_INFO")

RecSet("Tid") = FormatDateTime(Now)

RecSet("Klocka") = Time

 

 

RecSet.Update

RecSet.Close

Connect.Close %>

<% Set Connect = Server.CreateObject("ADODB.Connection")

Connect.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("xxxx_xx.mdb")

 

Set RecSet = Server.CreateObject("ADODB.Recordset")

Addera = "SELECT * FROM besokare"

 

RecSet.Open Addera, Connect, adOpenStatic, adLockOptimistic

 

RecSet.AddNew

 

RecSet("ID") = Request.ServerVariables("REMOTE_ADDR")

RecSet("Sida") = Request.ServerVariables("PATH_INFO")

RecSet("Tid") = FormatDateTime(Now)

RecSet("Klocka") = Time

RecSet("From") = Request.ServerVariables("HTTP_REFERER")

 

RecSet.Update

RecSet.Close

Connect.Close %>

========================================================================= [/log]

 

hoppas nån kan förklara va fasen som händer... för jag begriper de inte

 

 

 

[inlägget ändrat 2006-09-28 19:58:09 av Erik Junesjö]

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...