<%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 Conn = Server.CreateObject("ADODB.Connection") Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db/byla.mdb")%> <%With RecSet .MoveFirst .PageSize = fo .AbsolutePage = sida End With Sidor = RecSet.PageCount Count = 0 Do While Not RecSet.EOF And Count < RecSet.PageSize%> <%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 bilder.plats, bilder.bild, bilder.id FROM bilder Order By id asc" RecSet.Open SQL, Conn If RecSet.EOF Then%>
Inga Sponsorer inlagd
<%Else%>

Hantera Sponsorer

Plats: Logga:  
<%=RecSet("plats")%> "width="80%" height="40%" > &#tab4">Ändra   &#tab4')">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" Then Set RecSet = Conn.Execute("SELECT * FROM bilder WHERE id="& Request.Querystring("id"))%> &#tab4" name="change" enctype="multipart/form-data" onSubmit="return add()">
Plats:
">
bild:
">
<%RecSet.Close Set RecSet = Nothing End If If Request.QueryString("action") = "andrat" Then byteCount = Request.TotalBytes RequestBin = Request.BinaryRead(byteCount) Set UploadRequest = CreateObject("Scripting.Dictionary") BuildUploadRequest RequestBin contentType = UploadRequest.Item("bild").Item("ContentType") filepathname = UploadRequest.Item("bild").Item("FileName") filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\")) value = UploadRequest.Item("bild").Item("Value") bilden = filename platsen = UploadRequest.Item("plats").Item("Value") Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject") pathEnd = Len(Server.mappath(Request.ServerVariables("PATH_INFO")))-14 if bilden = "" then Set RecSet = Conn.Execute("SELECT * FROM bilder WHERE id="& Request.Querystring("id")) bilden = RecSet("bild") else 'Response.write filename Set MyFile = ScriptObject.CreateTextFile(Server.mappath("bild/"&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 Conn.execute("Update bilder Set plats='" & platsen & "', bild='" & bilden & "' Where id = "& Request.Querystring("id")) Response.Redirect "Fradminb.asp?visa=cp&#tab4" 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:
Plats:
Bild:
<%End If If Request.Querystring("action") = "spara" Then plats = FixSQL(Request.Form("plats")) bild = FixSQL(Request.Form("bild")) blid = "janne" Conn.Execute("Insert Into bilder (plats,bild) Values('" & plats & "','" & bild & "')") Response.Redirect "Fradminb.asp?visa=cp&#tab4" End If%>
<%End If%>