<%If Session("admin") = "ok" Then If Request.Querystring("mess") = "bort" Then mess = "alert('Posten borttaget!');return true;" End If If Request.Querystring("mess") = "andra" Then mess = "alert('Posten ändrat!');return true;" End If%> <%Public Function FixSQL(ByVal sString) ' As String If Len("" & sString) = 0 Then Exit Function sString = Replace(sString, "'","''") sString = Replace(sString, "\","\\") FixSQL = sString End Function%> Admin BYLA

Admin BYLA

Lägg till och editera info

<% Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db/byla.mdb")%> <% wihte=0 With RecSet .MoveFirst .PageSize = fo .AbsolutePage = sida End With Sidor = RecSet.PageCount Count = 0 Do While Not RecSet.EOF And Count < RecSet.PageSize If wihte = 0 then wihte=1 %> <% else wihte=0 %> <% End If %> <%Count = Count + 1 RecSet.MoveNext Loop If Sidor >= 1 Then%> <%Else%> <%End If End If%>
<%If Request.Querystring("action")= "" Then%> <%Set RecSet = Server.CreateObject("ADODB.Recordset") Const fo = 10 Sidan = Request.QueryString("sida") If Sidan = "" then sida = 1 Else sida = Sidan End If With RecSet .CursorLocation = 3 .CacheSize = fo End With SQL = "SELECT om.rubrik, om.brod, om.id FROM om Order By id asc" RecSet.Open SQL, Conn If RecSet.EOF Then%>
Ingen info inlagd
<%Else%>

Info om Byla

Rubrik: Bröd Text:
<%=RecSet("rubrik")%> <%=RecSet("brod")%>
<%=RecSet("rubrik")%> <%=RecSet("brod")%>&#tab2">Ändra   &#tab2')">Ta bort

<%If Sidor <> 1 Then For Sid = 1 To Sidor If (Int(Sid)) = (Int(sida)) Then%><%=Sid%><%Else%> <%=Sid%> <%End If%> <%Next%> Lägg till
Lägg till
<% RecSet.Close Set RecSet = Nothing End If End If If Request.QueryString("action") = "change_om" Then Set RecSet = Conn.Execute("SELECT * FROM om WHERE id="& Request.Querystring("id"))%> &#tab3" name="change" onSubmit="return add()">
Ändring av info om Byla:
Rubrik:
">
Bröd:
<%RecSet.Close Set RecSet = Nothing End If If Request.QueryString("action") = "andrat_om" Then rubrik = FixSQL(Request.Form("rubrik")) brod = FixSQL(Request.Form("brod")) Conn.execute("Update om Set rubrik='" & rubrik & "', brod='" & brod & "' Where id = "& Request.Querystring("id")) Response.Redirect "Fradminom.asp?visa=cp&#tab2" End If If Request.QueryString("action")= "delete_om" Then Conn.Execute("Delete * From om Where ID=" & Request.Querystring("id")) Response.Redirect "Fradminom.asp?visa=cp&#tab2" End If If Request.QueryString("action") = "add" Then%> <%laggtill = "check" %>
Lägg till info om Byla:
Rubrik:
Bröd:
<%End If If Request.Querystring("action") = "spara_om" Then rubrik = FixSQL(Request.Form("rubrik")) brod = FixSQL(Request.Form("brod")) Conn.Execute("Insert Into om (rubrik,brod) Values('" & rubrik & "','" & brod & "')") Response.Redirect "Fradminom.asp?visa=cp&#tab2" End If%>
<%End If%>