<%If Request.Querystring("action")= "" AND Session("gastbok") = Secure Then%>
<%Set RecSet = Server.CreateObject("ADODB.Recordset")
Const gbaps1 = 15
Sidan = Request.QueryString("sida")
If Sidan = "" then
sida = 1
Else
sida = Sidan
End If
With RecSet
.CursorLocation = 3
.CacheSize = gbaps1
End With
SQL = "Select * From gastbok Order By datum desc"
RecSet.Open SQL, Conn
If RecSet.EOF Then%>
Inga inlägg i gästboken!
<%Else%>
Rubrik:
Datum:
Namn:
<%With RecSet
.MoveFirst
.PageSize = gbaps1
.AbsolutePage = sida
End With
Sidor = RecSet.PageCount
Count = 0
Do While Not RecSet.EOF And Count < RecSet.PageSize %>
<%If Sidor <> 1 Then
For Sid = 1 To Sidor
If (Int(Sid)) = (Int(sida)) Then%><%=Sid%><%Else%> <%=Sid%> <%End If%>
<%Next%>
<%End If
End If%>
<%RecSet.Close:Set RecSet = Nothing
End If
ElseIf Request.Querystring("action")= "change" AND Session("gastbok") = Secure Then
Set RecSet = Conn.Execute("Select * From gastbok Where id="& FixSQL(Request.Querystring("id")))%>
<%RecSet.Close:Set RecSet = Nothing
Conn.Close:Set Conn = Nothing
ElseIf Request.Querystring("action") = "andrat" AND Session("gastbok") = Secure Then
Namn = FixSQL(Request.Form("namn"))
Rubrik = FixSQL(Request.Form("rubrik"))
Mail = FixSQL(Request.Form("mail"))
Url = FixSQL(Request.Form("url"))
Msg = FixSQL(Request.Form("msg"))
Conn.execute("Update gastbok Set namn='" & Namn & "',rubrik='" & Rubrik & "',mail='" & Mail & "',url='" & Url & "',msg='" & Msg & "' Where id = "& Request.Querystring("id"))
Conn.Close:Set Conn = Nothing
Response.Redirect "admin.asp?do=inne"
ElseIf Request.Querystring("action") = "delete" AND Session("gastbok") = Secure Then
Conn.Execute("Delete * From gastbok Where id=" & FixSQL(Request.Querystring("id")))
Conn.Close:Set Conn = Nothing
Response.Redirect "admin.asp?do=inne"
ElseIf Request.Querystring("action") = "svara" AND Session("gastbok") = Secure Then
Set RecSet = Conn.Execute("Select * From gastbok Where id=" & FixSQL(Request.Querystring("id")))%>
<%RecSet.Close:Set RecSet = Nothing
Conn.Close:Set Conn = Nothing
ElseIf Request.Querystring("action") = "svarat" AND Session("gastbok") = Secure Then
Svar = FixSQL(Request.Form("svar"))
Conn.Execute("Update gastbok Set Svar='"& Svar &"' Where id=" & FixSQL(Request.Querystring("id")))
Conn.Close:Set Conn = Nothing
Response.Redirect "admin.asp?do=inne"
End If
ElseIf Request.Querystring("do") = "logut" Then
Session.Abandon
Conn.Close:Set Conn = Nothing
Response.Redirect "admin.asp"
End If%>