Hvorfor kan der sendes tomme/blanke mailformularer ??
Kære alleJeg hjælper til på en hjemmeside, hvor vi har følgende ASP side (se nederst).
Først viser den lidt tekst hentet i en tabel og nederst er det muligt at sende en form med nogle data...
PROBLEMET er, at der næsten hver dag fremsendes tomme formularer !! - Og jeg har da været inde og gøre således, at man IKKE kan sende formularen uden at indtaste data !!!
Men der må være en fejl et sted !!
Er der nogen der kan se hvad det kunne være ???
Det er virkelig et stort problem for mig....
På forhånd TUSIND TAK for hjælpen
<%@ LANGUAGE=VBSCRIPT%>
<!--#include file="../lib/connection.asp"-->
<!--#include file="../lib/odbc.asp"-->
<%
Response.Expires = 0
Response.ExpiresAbsolute = Date() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%>
<html>
<head>
<title>Book lejlighed</title>
<link href="../style.css" rel="STYLESHEET" TYPE="text/css">
</head>
<script type="text/javascript">
function Form2_Validator(TheForm2)
{
if(document.TheForm2.strNavn.value==''){
alert('Angiv venligst navn!');
document.TheForm2.strNavn.focus();
return false;
}
if(document.TheForm2.strAdresse.value==''){
alert('Angiv venligst adresse!');
document.TheForm2.strAdresse.focus();
return false;
}
if(document.TheForm2.strPostnr.value==''){
alert('Angiv venligst postnr.!');
document.TheForm2.strPostnr.focus();
return false;
}
if(document.TheForm2.strBy.value==''){
alert('Angiv venligst by!');
document.TheForm2.strBy.focus();
return false;
}
if(document.TheForm2.strLand.value==''){
alert('Angiv venligst land!');
document.TheForm2.strLand.focus();
return false;
}
if(document.TheForm2.strTelefon.value==''){
alert('Angiv venligst telefon nr.!');
document.TheForm2.strTelefon.focus();
return false;
}
if(document.TheForm2.strEmail.value==''){
alert('Angiv venligst E-Mailadresse.!');
document.TheForm2.strEmail.focus();
return false;
}
return true;
}
</script>
<body topmargin="20" leftmargin="20" marginheight="20" marginwidth="20">
<h1>Ønsket reservering</h1>
<form name="TheForm2" method="post" action="">
<%
lejlighedsnummer = Request.Querystring("lejlighedsnummer")
lejlighedstype = Request.Querystring("type")
first = true
str = split(Request.QueryString,"&")
For i = 0 To uBound(str)-5
newStr = split(str(i),"aId")
newStr2 = split(newStr(1),"=")
If oldId <> newStr2(0) And first = false Then
Response.Write "Det er kun muligt at bestille den samme lejlighed flere uger i træk... <a href=""java script:history.back()"">prøv igen!</a></body></html>"
Response.End
End If
newWeek = split(str(i),"wNo")
newWeek2 = split(newWeek(1),"_")
'Response.Write newWeek2(0) & "<br>"
oldId = newStr2(0)
If first = true Then
uger = uger & newWeek2(0)
Else
uger = uger & ", " & newWeek2(0)
End If
'dato til og fra
Response.Write "<input type=""hidden"" name=""weekNo"" value="""&newWeek2(0)&""">" & vbCrlf
first = false
Next
Response.write "Uge(r): " & uger & "<br>"
strUger = split(uger,", ")
wPrice = 0
dage = 0
For i = 0 To uBound(strUger)
dage = dage + 7
wPrice = wPrice + Request.Querystring("pris")
Next
Fundet = False
For i = 0 To uBound(strUger)
If i = 0 Then
wNo = wNo & "(wNo=" & strUger(i) & " AND Year = " & Request.QueryString("startYear") & ")"
Else
If strUger(i) < oldWeekNo Or fundet = True Then
wNo = wNo & " OR (wNo=" & strUger(i) & " AND Year = " & Request.QueryString("endYear") & ")"
fundet = True
Else
wNo = wNo & " OR (wNo=" & strUger(i) & " AND Year = " & Request.QueryString("startYear") & ")"
End If
End If
oldWeekNo = strUger(i)
Next
'Response.write "<br>select * from queryBook where name='" & lejlighedsnummer & "' AND wNo=" & wNo&"<br>"
If Request.QueryString("startYear") <> Request.QueryString("endYear") Then
strsql = "select * from queryBook where id =" & newStr2(0) & " AND (" & wNo & ")" ' AND (year = " & Request.QueryString("startYear") & " OR year = " & Request.QueryString("endYear") & ")"
Else
strsql = "select * from queryBook where id =" & newStr2(0) & " AND (" & wNo & ") AND year = " & Request.QueryString("startYear")
End If
Set objConn = Server.CreateObject("ADODB.Connection")
With objConn
.Open ConnectionString
Set objRES = .Execute(strsql)
End with
Do until objRES.EOF
'Response.Write objRES("wPrice") & "<br>"
prisuge = prisuge + objRES("wPrice")
' Nedenstående er rettet!
appName = objRES("name")
objRES.Movenext
Loop
'*********************
'Get the selected week
strSelectedWeek = strUger(0)-1 'myForm("uge")
strSelectedWeek = strSelectedWeek-1
'Get the selected year
strSelectedYear = Request.QueryString("startYear")'myForm("aar")
'Get the first date of selected year.
If strSelectedYear = "2001" Then
datfirstDateOfWeek = DateAdd("ww",strSelectedWeek,"6/1/"&strSelectedYear)
ElseIf strSelectedYear = "2002" Then
If strSelectedWeek = -1 Then
datfirstDateOfWeek = DateAdd("ww",strSelectedWeek,"4/1/"&strSelectedYear+1)
Else
datfirstDateOfWeek = DateAdd("ww",strSelectedWeek,"5/1/"&strSelectedYear)
End If
ElseIf strSelectedYear = "2003" Then
datfirstDateOfWeek = DateAdd("ww",strSelectedWeek,"4/1/"&strSelectedYear)
ElseIf strSelectedYear = "2004" Then
datfirstDateOfWeek = DateAdd("ww",strSelectedWeek,"3/1/"&strSelectedYear)
ElseIf strSelectedYear = "2005" Then
datfirstDateOfWeek = DateAdd("ww",strSelectedWeek,"8/1/"&strSelectedYear)
ElseIf strSelectedYear = "2006" Then
datfirstDateOfWeek = DateAdd("ww",strSelectedWeek,"7/1/"&strSelectedYear)
ElseIf strSelectedYear = "2007" Then
datfirstDateOfWeek = DateAdd("ww",strSelectedWeek,"6/1/"&strSelectedYear)
ElseIf strSelectedYear = "2008" Then
datfirstDateOfWeek = DateAdd("ww",strSelectedWeek,"5/1/"&strSelectedYear)
ElseIf strSelectedYear = "2009" Then
datfirstDateOfWeek = DateAdd("ww",strSelectedWeek,"3/1/"&strSelectedYear)
End If
Response.write "Dato fra: " & datfirstDateOfweek & " Kl: 17.00<br><input type='hidden' name='Datofra' value='"& datfirstDateOfweek &"'>"
datForLeave = DateAdd("d",dage,datfirstDateOfweek)
Response.write "Dato til : " & datForLeave & " Kl: 10.00<br><input type='hidden' name='Datotil' value='"& datForLeave &"'>"
Response.write "Lejlighedstype: " & lejlighedstype & "<br><input type='hidden' name='lejlighedstype' value='"& lejlighedstype &"'>"
' Nedenstående er rettet!
Response.write "Lejlighedsnummer: "& appName &"<br><input type='hidden' name='lejlighedsnummer' value='"& appName &"'>"
Response.write "<br>Pris: "& prisuge & ",-<br><input type='hidden' name='wPrice' value='"& prisuge &"'><br>"
If first <> True Then %>
<table border="0" cellspacing="0" cellpadding="0">
<tr><td>Navn:<font color="#FF0000" size="2">*</font></td><td><input type="text" name="strNavn" size="50"></td></tr>
<tr><td>Adresse:<font color="#FF0000" size="2">*</font> </td><td><input type="text" name="strAdresse" size="50"></td></tr>
<tr><td>Postnr:<font color="#FF0000" size="2">*</font> </td><td><input type="text" name="strPostnr" size="50"></td></tr>
<tr><td>By:<font color="#FF0000" size="2">*</font> </td><td><input type="text" name="strBy" size="50"></td></tr>
<tr><td>Land:<font color="#FF0000" size="2">*</font></td><td><input type="text" name="strLand" size="50"></td></tr>
<tr><td>Telefon:<font color="#FF0000" size="2">*</font></td><td><input type="text" name="strTelefon" size="50"></td></tr>
<tr><td>E-mail:<font color="#FF0000" size="2">*</font></td><td><input type="text" name="strEmail" size="50"></td></tr>
<tr><td valign="top">Bemærkninger: </td><td><textarea cols="49" rows="10" name="strText"></textarea></td></tr>
<tr><td colspan="2"><br><br>Felter markeret med <font color="#FF0000" size="2">*</font> SKAL udfyldes.</td></tr>
<tr><td colspan="2"><br><br>Bekræftelse ønskes pr:</td></tr>
<tr><td><br>Alm. post <input type="radio" name="strTyp" value="Post" checked style="border:none"></td></tr>
<tr><td>E-mail <input type="radio" name="strTyp" value="Email" checked style="border:none"></td></tr>
<tr><td></td><td align="right">
<input type="submit" name="bestil" value="Reserver" onClick="this.form.action='sendMail.asp';return Form2_Validator(this);this.form.submit();"></td>
</td></tr>
</table><br><a href="java script://" onClick="window.print()">Udskriv denne side</a>
<%
Else
Response.Write "Du har ikke valgt en eller flere uger, <a href=""java script:history.back()"">prøv igen!</a>"
End If
%>
<br><br><br>
<br>
</form>
<br>
</body>
</html>