<%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

<% Set Conntj = Server.CreateObject("ADODB.Connection") Conntj.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db/byla.mdb")%> <%With RecSettj .MoveFirst .PageSize = fotj .AbsolutePage = sidatj End With Sidortj = RecSettj.PageCount Counttj = 0 Do While Not RecSettj.EOF And Counttj < RecSettj.PageSize%> <%Counttj = Counttj + 1 RecSettj.MoveNext Loop If Sidortj >= 1 Then%> <%Else%> <%End If End If%>
<%If Request.Querystring("action")= "" Then%> <%Set RecSettj = Server.CreateObject("ADODB.Recordset") Const fotj = 10 Sidantj = Request.QueryString("sidatj") If Sidantj = "" then sidatj = 1 Else sidatj = Sidantj End If With RecSettj .CursorLocation = 3 .CacheSize = fotj End With SQLtj = "SELECT tjanster.rubrik2, tjanster.texten2, tjanster.vad, tjanster.id FROM tjanster Order By id asc" RecSettj.Open SQLtj, Conntj If RecSettj.EOF Then%>
Inga Händelser inlagd
<%Else%>

Hantera Händelser

Tjänst: Rubrik: Texten:  
<%=RecSettj("vad")%> <%=RecSettj("rubrik2")%> <%=RecSettj("texten2")%> &#tab3">Ändra   &#tab3')">Ta bort
<%If Sidortj <> 1 Then For Sidtj = 1 To Sidortj If (Int(Sidtj)) = (Int(sidatj)) Then%><%=Sidtj%><%Else%> <%=Sidtj%> <%End If%> <%Next%> Lägg till
Lägg till
<% RecSettj.Close Set RecSettj = Nothing End If End If If Request.QueryString("action") = "change_tj" Then Set RecSettj = Conntj.Execute("SELECT * FROM tjanster WHERE id="& Request.Querystring("id"))%> &#tab3" name="change" enctype="multipart/form-data" onSubmit="return add()">
Tjänst:
"readonly>
Rubrk:
">
Text:
<%RecSettj.Close Set RecSettj = Nothing End If If Request.QueryString("action") = "andrat_tj" Then byteCount = Request.TotalBytes RequestBin = Request.BinaryRead(byteCount) Set UploadRequest = CreateObject("Scripting.Dictionary") BuildUploadRequest RequestBin contentType = UploadRequest.Item("vad").Item("ContentType") filepathname = UploadRequest.Item("vad").Item("FileName") filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\")) value = UploadRequest.Item("vad").Item("Value") bilden = filename vad = FixSQL(UploadRequest.Item("vad").Item("Value")) rubrik = FixSQL(UploadRequest.Item("rubrik").Item("Value")) texten = FixSQL(UploadRequest.Item("texten").Item("Value")) Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject") pathEnd = Len(Server.mappath(Request.ServerVariables("PATH_INFO")))-14 if bilden = "" then Set RecSettj = Conntj.Execute("SELECT * FROM tjanster WHERE id="& Request.Querystring("id")) bilden = RecSettj("bild") else Set MyFile = ScriptObject.CreateTextFile(Server.mappath("bild/"&filename)) 'Response.write filename bilden = "bild/"&filename For i = 1 to LenB(value) MyFile.Write chr(AscB(MidB(value,i,1))) Next MyFile.Close end if 'response.write bilden Conntj.execute("Update tjanster Set rubrik2='" & rubrik & "', texten2='" & texten & "' Where id = "& Request.Querystring("id")) Response.Redirect "Fradmintj.asp?visa=cp&#tab3" Sub BuildUploadRequest(RequestBin) PosBeg = 1 PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13))) boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg) boundaryPos = InstrB(1,RequestBin,boundary) Do until (boundaryPos=InstrB(RequestBin,boundary & getByteString("--"))) Dim UploadControl Set UploadControl = CreateObject("Scripting.Dictionary") Pos = InstrB(BoundaryPos,RequestBin,getByteString("Content-Disposition")) Pos = InstrB(Pos,RequestBin,getByteString("name=")) PosBeg = Pos+6 PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34))) Name = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg)) PosFile = InstrB(BoundaryPos,RequestBin,getByteString("filename=")) PosBound = InstrB(PosEnd,RequestBin,boundary) If PosFile<>0 AND (PosFile <%laggtill = "check" %>
Lägg till ny Bild:
Tjänst:
Rubrik:
Text:
<%End If If Request.Querystring("action") = "spara_tj" Then rubrik = FixSQL(Request.Form("rubrik")) texten = FixSQL(Request.Form("texten")) bild = FixSQL(Request.Form("vad")) blid = "janne" Conntj.Execute("Insert Into tjanster (rubrik2,texten2,vad) Values('" & rubrik & "','" & texten & "','" & bild & "')") Response.Redirect "Fradmintj.asp?visa=cp&#tab3" End If%>
<%End If%>