26. september 2003 - 14:18
Der er
27 kommentarer og
1 løsning
fejl i databasen
hvad er fejlen i dette stykke ?
Set Conn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.recordset")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("Brugere.mdb")
Conn.Open DSN
strTekst2 = Request.Form("profil")
strTekst2 = Replace(strTekst2, "'", "''")
strTekst2 = Replace(strTekst2,VbCrLf,"<br>")
strTekst1 = Request.Form("usrname")
strTekst1 = Replace(strTekst1, "'", "''")
strTekst3 = Request.Form("usrpsw")
strTekst3 = Replace(strTekst3, "'", "''")
strTekst4 = Request.Form("by")
strTekst4 = Replace(strTekst4, "'", "''")
strTekst5 = Request.Form("Kon")
strTekst5 = Replace(strTekst5, "'", "''")
strSQL="Insert into Brugere (Profil, Bruger,"
strSQL=strSQL & "Kode, Level, By, Kon, Oprettet, Ip)"
strSQL=strSQL & "values "
strSQL=strSQL & "('" & RemoveHTML(strTekst2) & "', "
strSQL=strSQL & "'" & Server.HTMLEncode(strTekst1) & "', "
strSQL=strSQL & "'" & Server.HTMLEncode(strTekst3) & "', "
strSQL=strSQL & "'1', "
strSQL=strSQL & "'" & Server.HTMLEncode(strTekst4) & "', "
strSQL=strSQL & "'" & Server.HTMLEncode(strTekst5) & "', "
strSQL=strSQL & "#"&Now()&"#, "
strSQL=strSQL & "'" & Request.ServerVariables("REMOTE_ADDR") & "')"
rs.Open strSQL, conn
27. september 2003 - 18:49
#26
nå, i får den alligevel ejg håber det er tilladt at knalde så lang en kode ind :P
det er systemet: bruger i skal kigge efter
<%
strGem = Request.Querystring("gem")
if strGem = "" then
Response.Write "du skal gemme i en database"
else
Function RemoveHTML( strInputText )
TAGLIST = ";!--;!DOCTYPE;A;ACRONYM;ADDRESS;APPLET;AREA;BASE;BASEFONT;" &_
"BGSOUND;BIG;BLOCKQUOTE;BODY;BUTTON;CAPTION;CENTER;CITE;CODE;" &_
"COL;COLGROUP;COMMENT;DD;DEL;DFN;DIR;DIV;DL;DT;EM;EMBED;FIELDSET;" &_
"FONT;FORM;FRAME;FRAMESET;HEAD;H1;H2;H3;H4;H5;H6;HR;HTML;IFRAME;IMG;" &_
"INPUT;INS;ISINDEX;KBD;LABEL;LAYER;LAGEND;LI;LINK;LISTING;MAP;MARQUEE;" &_
"MENU;META;NOBR;NOFRAMES;NOSCRIPT;OBJECT;OL;OPTION;P;PARAM;PLAINTEXT;" &_
"PRE;Q;S;SAMP;SCRIPT;SELECT;SMALL;SPAN;STRIKE;STYLE;SUB;SUP;" &_
"TABLE;TBODY;TD;TEXTAREA;TFOOT;TH;THEAD;TITLE;TR;TT;UL;VAR;WBR;XMP;"
Const BLOCKTAGLIST = ";APPLET;EMBED;FRAMESET;HEAD;NOFRAMES;NOSCRIPT;OBJECT;SCRIPT;STYLE;"
Dim nPos1, nPos2, nPos3
Dim strResult, strTagName, bRemove, bSearchForBlock
Dim runNo, AttackLimit, strRef
runNo = 1
AttackLimit = 5
strResult = strInputText
do
runNo = runNo + 1
strRef = strResult
strText = strRef
strResult = ""
nPos1 = InStr(strText, "<")
Do While nPos1 > 0
nPos2 = InStr(nPos1 + 1, strText, ">")
If nPos2 > 0 Then
strTagName = Mid(strText, nPos1 + 1, nPos2 - nPos1 - 1)
strTagName = Replace(Replace(strTagName, vbCr, " "), vbLf, " ")
nPos3 = InStr(strTagName, " ")
If nPos3 > 0 Then
strTagName = Left(strTagName, nPos3 - 1)
End If
If Left(strTagName, 1) = "/" Then
strTagName = Mid(strTagName, 2)
bSearchForBlock = False
Else
bSearchForBlock = True
End If
If InStr(1, TAGLIST, ";" & strTagName & ";", vbTextCompare) > 0 Then
bRemove = True
If bSearchForBlock Then
If InStr(1, BLOCKTAGLIST, ";" & strTagName & ";", vbTextCompare) > 0 Then
nPos2 = Len(strText)
nPos3 = InStr(nPos1 + 1, strText, "</" & strTagName, vbTextCompare)
If nPos3 > 0 Then
nPos3 = InStr(nPos3 + 1, strText, ">")
End If
If nPos3 > 0 Then
nPos2 = nPos3
End If
End If
End If
Else
bRemove = False
End If
If bRemove Then
strResult = strResult & Left(strText, nPos1 - 1)
strText = Mid(strText, nPos2 + 1)
Else
strResult = strResult & Left(strText, nPos1)
strText = Mid(strText, nPos1 + 1)
End If
Else
strResult = strResult & strText
strText = ""
End If
nPos1 = InStr(strText, "<")
Loop
strResult = strResult & strText
loop until (strRef = strResult) OR (runNo = AttackLimit)
if (runNo >= AttackLimit) then
strResult = "text fjernet"
end if
RemoveHTML = strResult
End Function
strAdmin1 = "<font color=" & Request.Form("farve") & ">"
strAdmin2 = "</font>"
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
set rs = Server.CreateObject("ADODB.recordset")
if strGem = "tagwall" then
DSN = DSN & "DBQ=" & Server.MapPath("Tagwall.mdb")
elseif strGem = "forum" then
DSN = DSN & "DBQ=" & Server.MapPath("Forum.mdb")
elseif strGem = "nyhedssystem" then
DSN = DSN & "DBQ=" & Server.MapPath("Nyhed.mdb")
elseif strGem = "bruger" then
DSN = DSN & "DBQ=" & Server.MapPath("Brugere.mdb")
end if
Conn.Open DSN
'115
'TAGWALL
if strGem = "tagwall" then
strTekst1 = Request.Form("Overskrift")
strTekst1 = Replace(strTekst1, "'", "''")
strTekst2 = Request.Form("Tag")
strTekst2 = Replace(strTekst2, "'", "''")
strTekst2 = Replace(strTekst2,VbCrLf,"<br>")
strTekst3 = Request.Form("Email")
strTekst3 = Replace(strTekst3, "'", "''")
strTekst4 = Request.Form("Forfatter")
strTekst4 = Replace(strTekst4, "'", "''")
if cint (session("level")) < 9 then
strTekst1 = Replace(strTekst1, "Siden lukker", "siden lukker ikke")
strTekst1 = Replace(strTekst1, "siden lukker", "siden lukker ikke")
strTekst4 = Replace(strTekst4, "admin", "wannabee admin")
strTekst4 = Replace(strTekst4, "Admin", "wannabee admin")
strTekst4 = Replace(strTekst4, "Ejer", "wannabee admin")
strTekst4 = Replace(strTekst4, "ejer", "wannabee admin")
strTekst4 = Replace(strTekst4, "Koma", "wannabee admin")
strTekst4 = Replace(strTekst4, "koma", "wannabee admin")
strTekst4 = Replace(strTekst4, "Kragen", "wannabee admin")
strTekst4 = Replace(strTekst4, "kragen", "wannabee admin")
strTekst4 = Replace(strTekst4, "Arez", "wannabee admin")
strTekst4 = Replace(strTekst4, "arez", "wannabee admin")
end if
strSQL="Insert into tags (Skriver, Overskrift,"
strSQL=strSQL & "Tag, Email, Dato, Ip)"
strSQL=strSQL & "values "
strSQL=strSQL & "('" & Server.HTMLEncode(strTekst4) & "', "
strSQL=strSQL & "'" & Server.HTMLEncode(strTekst1) & "', "
if (session("level")) => 5 then
strSQL=strSQL & "'" & strAdmin1 & strTekst2 & strAdmin2 & "', "
else
strSQL=strSQL & "'" & RemoveHTML(strTekst2) & "', "
end if
strSQL=strSQL & "'" & Server.HTMLEncode(strTekst3) & "', "
'Nyhedsystem
elseif strGem = "nyhedssystem" then
if Not cint(session("level")) => 7 Then
Response.redirect "login.asp"
end if
strSQL="Insert into nyheder (Forfatter, Overskrift,"
strSQL=strSQL & "Nyhed, Dato, Ip)"
strSQL=strSQL & "values "
strSQL=strSQL & "('" & Request.Form("Forfatter") & "', "
strSQL=strSQL & "'" & Request.Form("Overskrift") & "', "
strSQL=strSQL & "'" & Request.Form("Nyhed") & "', "
'FORUM
elseif strGem = "forum" then
if Request.Querystring("action") = "comment" then
strTekst2 = Request.Form("Comment")
strTekst2 = Replace(strTekst2, "'", "''")
strTekst2 = Replace(strTekst2,VbCrLf,"<br>")
strTekst1 = Request.Form("Forfatter")
strTekst1 = Replace(strTekst1, "'", "''")
strSQL="Insert into Threads (Comskriver, Comid,"
strSQL=strSQL & "Comment, Comdato, Comip)"
strSQL=strSQL & "values "
strSQL=strSQL & "('" & Server.HTMLEncode(strTekst1) & "', "
strSQL=strSQL & "'" & Request.Querystring("id") & "', "
if (session("level")) => 5 then
strSQL=strSQL & "'" & strAdmin1 & strTekst2 & strAdmin2 & "', "
else
strSQL=strSQL & "'" & RemoveHTML(strTekst2) & "', "
end if
elseif Request.Querystring("action") = "create" then
strTekst2 = Request.Form("problem")
strTekst2 = Replace(strTekst2, "'", "''")
strTekst2 = Replace(strTekst2,VbCrLf,"<br>")
strTekst1 = Request.Form("Forfatter")
strTekst1 = Replace(strTekst1, "'", "''")
strTekst3 = Request.Form("Overskrift")
strTekst3 = Replace(strTekst3, "'", "''")
'197
strSQL="Insert into Threads (Threadskriver, Threademne,"
strSQL=strSQL & "Thread, Threadok, Threaddato, Threadip)"
strSQL=strSQL & "values "
strSQL=strSQL & "('" & Server.HTMLEncode(strTekst1) & "', "
strSQL=strSQL & "'" & strTekst3 & "', "
if (session("level")) => 5 then
strSQL=strSQL & "'" & strAdmin1 & strTekst2 & strAdmin2 & "', "
else
strSQL=strSQL & "'" & RemoveHTML(strTekst2) & "', "
end if
strSQL=strSQL & "'ja', "
'Brugersystem
elseif strGem = "bruger" then
strTekst2 = Request.Form("profil")
strTekst2 = Replace(strTekst2, "'", "''")
strTekst2 = Replace(strTekst2,VbCrLf,"<br>")
strTekst1 = Request.Form("usrname")
strTekst1 = Replace(strTekst1, "'", "''")
strTekst3 = Request.Form("usrpsw")
strTekst3 = Replace(strTekst3, "'", "''")
strTekst4 = Request.Form("bynavn")
strTekst4 = Replace(strTekst4, "'", "''")
strTekst5 = Request.Form("Kon")
strTekst5 = Replace(strTekst5, "'", "''")
strSQL="Insert into Brugere (Profil, Bruger,"
strSQL=strSQL & "Kode, level, Bynavn, Kon, Oprettet, Ip)"
strSQL=strSQL & "values "
strSQL=strSQL & "('" & RemoveHTML(strTekst2) & "', "
strSQL=strSQL & "'" & Server.HTMLEncode(strTekst1) & "', "
strSQL=strSQL & "'" & Server.HTMLEncode(strTekst3) & "', "
strSQL=strSQL & "1, "
strSQL=strSQL & "'" & Server.HTMLEncode(strTekst4) & "', "
strSQL=strSQL & "'" & Server.HTMLEncode(strTekst5) & "', "
end if
end if
strSQL=strSQL & "#"&Now()&"#, "
strSQL=strSQL & "'" & Request.ServerVariables("REMOTE_ADDR") & "')"
rs.Open strSQL,conn
'afslutnings tekst
if strGem = "forum" then
if Request.Querystring("action") = "create" then
Response.Write "Tråden er oprettet <a href='sefor.asp'>Se alle tråde</a>"
elseif Request.Querystring("action") = "comment" then
Response.Redirect "sethread.asp?id=" & Request.Querystring("id")
end if
elseif strGem = "tagwall" then
Response.Write "tag oprettet tak for din besked, <a href='setag.asp'>se tagwall</a>"
elseif strGem = "bruger" then
Response.Write "Din bruger er oprettet, <a href='login.asp'>log ind</a>"
elseif strGem = "nyhedssystem" then
Response.Write "Nyheden er oprettet <a href='senyhed.asp'>Til forsiden</a>"
else
Response.Write "Der er ikke angivet nogen data <a href=java script:history.go(-1)>tilbage</a>"
end if
end if
%>