<%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")%>
<%If Request.Querystring("action")= "" Then%> &#tab5" name="change" enctype="multipart/form-data" onSubmit="return add()">
Mapp:
bild:
<% 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") mapp = UploadRequest.Item("mapp").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(mapp&"/"&filename)) bilden = mapp&"/"&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 & "', mapp='" & mapp & "' Where id = "& Request.Querystring("id")) Response.Redirect "addbilder.asp?visa=cp&#tab5" 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
<%End If%>