Köp /
sälj /skänk /byt
(Avsett för
privatpersoner. Småländska tar inget ansvar för innehållet i annonserna.)
<%
'*******************************************************
'*******************************************************
%>
<%
' Now that we're done implementing features you probably won't want,
' let's get to the actual script...
Dim objFSO ' FileSystemObject Variable
Dim objFile ' File Object Variable
Dim strFile ' String variable to store the path / file we write to
Dim strBuffer ' Temporary area to swap order of the guestbook entries
Dim strVerifikation
Dim strHTTPreferer
strFile = Server.MapPath("kopsalj.txt")
' If the script doesn't have anything posted to it we display the form
' otherwise we process the input and append it to the guestbook file.
If Request.Form("name") = "" Or Request.Form("comment") = "" Then
strVerifikation = Session.SessionId
strHTTPreferer = Request.ServerVariables("HTTP_REFERER")
' Display the entry form.
%>
<%
Else
'===============================================================
'===== Check for banned IPs ====================================
'===============================================================
Dim strBlockedFile, strUnwanted, visitor, strURL, strBlockedEntry
strBlockedFile = Server.MapPath("kopsalj_blocked_IP.txt")
Dim objBlockedFSO 'FileSystemObject Variable
Dim objBlockedFile 'File Object Variable
' Create an instance of the FileSystemObject
Set objBlockedFSO = Server.CreateObject("Scripting.FileSystemObject")
' Open the textfile
Set objBlockedFile = objBlockedFSO.OpenTextFile(strBlockedFile, 1, False)
strURL = "http://www.fbi.gov/mostwant.htm" ' modify this line for target redirect host
strBlockedEntry = "NO"
visitor = Request.ServerVariables("REMOTE_ADDR")
strUnwanted = objBlockedFile.Readline
if Instr(Request.Form("comment"), "a href=") <> 0 then ' Check if there's a link
strUnwanted = "LINKBLOCK:" ' if it's a spambot, there's no need to compare ip's
strBlockedEntry = "YES"
end if
if Instr(Request.Form("comment"), "[url=http://") <> 0 then ' Check if there's a link
strUnwanted = "LINKBLOCK:" ' if it's a spambot, there's no need to compare ip's
strBlockedEntry = "YES"
end if
if Request.Form("verifikation") <> Session.SessionId then ' Check if it's a spambot
strUnwanted = strUnwanted & "SPAMBOT:" ' if it's a spambot, there's no need to compare ip's
strBlockedEntry = "YES"
end if
If InStr(1,Request.Form("referer"),"specimen.se/") = 0 then
strUnwanted = strUnwanted & "SPAMMER(" & Request.Form("referer") & "):"
strBlockedEntry = "YES"
end if
If InStr(1,Request.ServerVariables("HTTP_REFERER"),"specimen.se/") = 0 then
strUnwanted = strUnwanted & "SPAMMER2(" & Request.ServerVariables("HTTP_REFERER") & "):"
strBlockedEntry = "YES"
end if
do while strUnwanted <> "END"
if Instr(visitor, strUnwanted) = 1 then ' =1 will only be true if the IPs are identical from the first number
strBlockedEntry = "YES"
strUnwanted = strUnwanted & "IP-BLOCK:"
end if
if strBlockedEntry = "YES" then
objBlockedFile.Close
Set objBlockedFile = Nothing
Set objBlockedFSO = Nothing
'### log the comment the blocked IP did
Dim strWasteFile
strWasteFile = Server.MapPath("kopsalj_waste.htm")
Dim objWasteFSO 'FileSystemObject Variable
Dim objWasteFile 'File Object Variable
' Create an instance of the FileSystemObject
Set objWasteFSO = Server.CreateObject("Scripting.FileSystemObject")
' Open the TextFile (FileName, ForAppending, AllowCreation)
Set objWasteFile = objWasteFSO.OpenTextFile(strWasteFile, 8, True)
objWasteFile.Write ""
objWasteFile.Write Server.HTMLEncode(Request.Form("name"))
objWasteFile.Write " "
objWasteFile.Write Server.HTMLEncode(Request.Form("email"))
objWasteFile.Write " (" & Day(Date()) & "/" & Month(Date())& "-" & Year(Date()) & " - " & Right("00" & Hour(Time()) ,2) & ":" & Right("00" & Minute(Time()) ,2)
objWasteFile.Write ") : - "
objWasteFile.Write Request.ServerVariables("REMOTE_HOST") & " - " & Request.Form("referer") & " - " & Request.ServerVariables("HTTP_REFERER") & "
"
if Instr(strUnwanted, "SPAMBOT") > 0 then
'objWasteFile.Write "SPAMBOT " & Request.Form("verifikation") & "/" & Session.SessionId & ":"
strUnwanted = "" & strUnwanted & " " & Request.Form("verifikation") & "/" & Session.SessionId & ":"
else
strUnwanted = "" & strUnwanted & ""
end if
'if strUnwanted = "LINKBLOCK" then
' objWasteFile.Write "LINKBLOCK: "
'end if
objWasteFile.Write strUnwanted
objWasteFile.Write Server.HTMLEncode(Request.Form("comment"))
objWasteFile.Write "
"
objWasteFile.WriteLine ""
objWasteFile.Close
Set objWasteFile = Nothing
Set objWasteFSO = Nothing
' end Wasteging
'=== Är filen stor, skapa ny papperskorg
dim fs,f,fs2,f2
set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.GetFile(strWasteFile)
IF f.size > 250000 then
'strWasteFile = "Waste_" & Year(Date()) & Right("00" & Month(Date()) ,2) & Right("00" & Day(Date()) ,2) & ".htm"
strWasteFile = "kopsalj_waste_old.htm"
set fs2=Server.CreateObject("Scripting.FileSystemObject")
If (fs2.FileExists(strWasteFile))=true Then
set f2=fs2.GetFile(strWasteFile)
f2.Delete
set f2=nothing
end if
set fs2=nothing
f.Move(strWasteFile)
Set f=fs.CreateTextFile("kopsalj_waste.htm", True)
f.close
end if
set f=nothing
set fs=nothing
'=== SLUT ny papperskorg
'Response.Clear()
'Response.Redirect(strURL)
If InStr(1,strUnwanted, "SPAMBOT") > 0 then
'if strUnwanted = "SPAMBOT" then
%>
Ditt inlägg har stoppats av gästbokens anti-spam filter.
Filtret har tolkat dig som ett spam-script.
Stäng webbläsaren, öppna den sen på nytt och försök igen. Går det inte så kontakta Webmaster.
<%
'objBlockedFile.Close
'Set objBlockedFile = Nothing
'Set objBlockedFSO = Nothing
Response.End
end if
If InStr(1,strUnwanted, "LINKBLOCK") > 0 then
'if strUnwanted = "LINKBLOCK" then
%>
Ditt inlägg har stoppats av gästbokens anti-spam filter.
Du har försökt lägga in en aktiv (klickbar) länk, vilket inte är tillåtet.
<%
'objBlockedFile.Close
'Set objBlockedFile = Nothing
'Set objBlockedFSO = Nothing
Response.End
end if
%>
Din IP är spärrad från att skriva inlägg i gästboken
<%
'objBlockedFile.Close
'Set objBlockedFile = Nothing
'Set objBlockedFSO = Nothing
Response.End
end if
strUnwanted = objBlockedFile.Readline
if strBlockedEntry = "YES" then ' if this is a blocked entry, no need to go through the IP's again
strUnwanted = "END"
end if
loop
objBlockedFile.Close
Set objBlockedFile = Nothing
Set objBlockedFSO = Nothing
' end Blocking
'===============================================================
'===== Log the entry to the guestbook file =====================
'===============================================================
' Create an instance of the FileSystemObject
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
' Open the TextFile and read the entire contents into memory
Set objFile = objFSO.OpenTextFile(strFile, 1, False)
strBuffer = objFile.ReadAll
objFile.Close
' Overwrite the old file with a blank one and dump new entry
' into it followed by all the previous.
Set objFile = objFSO.CreateTextFile(strFile, True)
' Log the new results
' I simply bold the name and do a
.
' You can make it look however you'd like.
' Once again I remind readers that we by no means claim to
' be UI experts. Although one person did ask us if we had a
' graphic designer! I laughed so hard that I almost hurt myself!
objFile.Write ""
objFile.Write Server.HTMLEncode(Request.Form("name")) & ""
objFile.Write "
Tel: " & Server.HTMLEncode(Request.Form("tel"))
objFile.Write "
e-mail: " & Server.HTMLEncode(Request.Form("email"))
objFile.Write "
Datum: " & Day(Date()) & "/" & Month(Date())& "-" & Year(Date()) & "
"
objFile.Write "" & Server.HTMLEncode(Request.Form("type")) & ":"
'objFile.Write Server.HTMLEncode(Request.Form("comment"))
objFile.Write Replace(Server.HTMLEncode(Request.Form("comment")),vbNewLine, "
" & vbNewLine)
objFile.Write "
"
objFile.WriteLine ""
' Return the previous results to the file
objFile.Write strBuffer
' Close the file and dispose of our objects
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
' Logging entries
Dim strLogFile
strLogFile = Server.MapPath("kopsaljlog.htm")
Dim objLogFSO 'FileSystemObject Variable
Dim objLogFile 'File Object Variable
' Create an instance of the FileSystemObject
Set objLogFSO = Server.CreateObject("Scripting.FileSystemObject")
' Open the TextFile (FileName, ForAppending, AllowCreation)
Set objLogFile = objLogFSO.OpenTextFile(strLogFile, 8, True)
'Erik (6/12-2004 - 14:23) : - 62.119.124.125
objLogFile.Write ""
objLogFile.Write Server.HTMLEncode(Request.Form("name"))
objLogFile.Write ""
'objLogFile.Write " (" & Day(Date()) & "/" & Month(Date())& "-" & Year(Date()) & " - " & Hour(Time()) & ":" & Minute(Time())
objLogFile.Write " (" & Day(Date()) & "/" & Month(Date())& "-" & Year(Date()) & " - " & Right("00" & Hour(Time()) ,2) & ":" & Right("00" & Minute(Time()) ,2)
objLogFile.Write ") : - "
objLogFile.Write Request.ServerVariables("REMOTE_HOST") & " - " & Request.Form("referer") & "
"
objLogFile.Close
Set objLogFile = Nothing
Set objLogFSO = Nothing
' end Logging
' Tell people we've written their info
%>
Tack för din annons!
Tillbaka
<%
End If
%>