File: D:/HostingSpaces/PvdBoogaard/indoorski.nl/backup/oude-site/asp/gastenboek/toevoegen.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Session.LCID = 1043 'Dutch regional setttings %>
<!--#include virtual="/Connections/indoorski_writer.asp" -->
<%
'Store information in a Session variable.
IP_ADDRESS = Request.ServerVariables("REMOTE_ADDR")
Session("IP_ADDRESS") = IP_ADDRESS
%>
<%
Session("DATE_ENTERED") = NOW
%>
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
If condition = "" Then
MM_IIf = ifFalse
Else
MM_IIf = ifTrue
End If
End Function
%>
<%
If (CStr(Request("MM_insert")) = "guestform") Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_indoorski_writer_STRING
MM_editCmd.CommandText = "INSERT INTO TABEL_GASTENBOEK (NAAM, EMAILADRES, URL, TITEL, BERICHT, IPADDRES, DATUM) VALUES (?, ?, ?, ?, ?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 75, Request.Form("Naam")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 75, Request.Form("E-Mailadres")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 75, Request.Form("HomeURL")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1, 50, Request.Form("titel")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 202, 1, 250, Request.Form("bericht")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 202, 1, 20, Request.Form("IPADDRES")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 135, 1, -1, MM_IIF(Request.Form("DATUM"), Request.Form("DATUM"), null)) ' adDBTimeStamp
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "geplaatst.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
<html>
<head>
<title></title>
<link href="/css/gastenboek.css" rel="stylesheet" type="text/css">
<link href="/css/standaard.css" rel="stylesheet" type="text/css">
<script type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function YY_checkform() { //v4.71
//copyright (c)1998,2002 Yaromat.com
var a=YY_checkform.arguments,oo=true,v='',s='',err=false,r,o,at,o1,t,i,j,ma,rx,cd,cm,cy,dte,at;
for (i=1; i<a.length;i=i+4){
if (a[i+1].charAt(0)=='#'){r=true; a[i+1]=a[i+1].substring(1);}else{r=false}
o=MM_findObj(a[i].replace(/\[\d+\]/ig,""));
o1=MM_findObj(a[i+1].replace(/\[\d+\]/ig,""));
v=o.value;t=a[i+2];
if (o.type=='text'||o.type=='password'||o.type=='hidden'){
if (r&&v.length==0){err=true}
if (v.length>0)
if (t==1){ //fromto
ma=a[i+1].split('_');if(isNaN(v)||v<ma[0]/1||v > ma[1]/1){err=true}
} else if (t==2){
rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-zA-Z]{2,4}$");if(!rx.test(v))err=true;
} else if (t==3){ // date
ma=a[i+1].split("#");at=v.match(ma[0]);
if(at){
cd=(at[ma[1]])?at[ma[1]]:1;cm=at[ma[2]]-1;cy=at[ma[3]];
dte=new Date(cy,cm,cd);
if(dte.getFullYear()!=cy||dte.getDate()!=cd||dte.getMonth()!=cm){err=true};
}else{err=true}
} else if (t==4){ // time
ma=a[i+1].split("#");at=v.match(ma[0]);if(!at){err=true}
} else if (t==5){ // check this 2
if(o1.length)o1=o1[a[i+1].replace(/(.*\[)|(\].*)/ig,"")];
if(!o1.checked){err=true}
} else if (t==6){ // the same
if(v!=MM_findObj(a[i+1]).value){err=true}
}
} else
if (!o.type&&o.length>0&&o[0].type=='radio'){
at = a[i].match(/(.*)\[(\d+)\].*/i);
o2=(o.length>1)?o[at[2]]:o;
if (t==1&&o2&&o2.checked&&o1&&o1.value.length/1==0){err=true}
if (t==2){
oo=false;
for(j=0;j<o.length;j++){oo=oo||o[j].checked}
if(!oo){s+='* '+a[i+3]+'\n'}
}
} else if (o.type=='checkbox'){
if((t==1&&o.checked==false)||(t==2&&o.checked&&o1&&o1.value.length/1==0)){err=true}
} else if (o.type=='select-one'||o.type=='select-multiple'){
if(t==1&&o.selectedIndex/1==0){err=true}
}else if (o.type=='textarea'){
if(v.length<a[i+1]){err=true}
}
if (err){s+='* '+a[i+3]+'\n'; err=false}
}
if (s!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+s)}
document.MM_returnValue = (s=='');
}
//-->
</script>
</head>
</html>
<SCRIPT LANGUAGE="JavaScript">
<!--
function SetEmoticon(Which) {
if (document.guestform.bericht.createTextRange) {
document.guestform.bericht.focus();
document.selection.createRange().duplicate().text = Which;
} else {
document.guestform.bericht.value += Which;
}
}
//-->
</SCRIPT>
<body bgcolor="#FFFFFF">
<form ACTION="<%=MM_editAction%>" METHOD="POST" NAME="guestform" onSubmit="YY_checkform('guestform','Naam','#q','0','Het veld \'Naam\' is een verplicht veld','E-Mailadres','S','2','Het veld \'E-mailadres\' is een verplicht veld','titel','#q','0','Het veld \'Titel\' is een verplicht veld','bericht','5','1','Het veld \'Bericht\' is een verplicht veld');return document.MM_returnValue">
<div align="center"><center>
<p class="Style01">Bericht toevoegen </p>
</center></div>
<div align="center"><center><table border="0">
<tr>
<td width="70" align="left" class="Style02">Naam:<span class="Style03">*</span></td>
<td width="252"><font color="#000000"><input name="Naam" type="text" class="inputborder-gast" value="<% =Request("Naam") %>" size="30">
</font></td>
</tr>
<tr>
<td align="left"><span class="Style02">E-Mailadres</span>:<span class="Style03">*</span></td>
<td><font color="#000000"><input name="E-Mailadres" type="text" class="inputborder-gast" value="<% =Request("emailadres") %>" size="40">
</font></td>
</tr>
<tr>
<td align="left" class="Style02">Homepage:</td>
<td><font color="#000000"><input name="HomeURL" type="text" class="inputborder-gast" value="http://<% =Request("HomeURL") %>" size="50">
</font></td>
</tr>
<tr>
<td align="left" valign="top" class="Style02">Titel: <span class="Style03">*</span></td>
<td><font color="#000000"><input name="titel" type="text" class="inputborder-gast" value="<% =Request("TITEL") %>" size="50"></font></td>
</tr>
<tr>
<td align="left" valign="top" class="Style02">Bericht: <span class="Style03">*</span></td>
<td><font color="#000000"><textarea name="bericht" cols="50" rows="4" class="inputborder-gast" value="<% =Request("Bericht") %>"size="50"></textarea></font></td>
</tr>
<tr>
<td align="left" valign="top" class="Style02">Smilies:</td>
<td>
<A HREF="javascript:SetEmoticon(':)')" ONFOCUS="filter:blur()"><img src="images/emoticons/smile.gif" border="0" width="15" height="15"></A>
<A HREF="javascript:SetEmoticon(':eek')" ONFOCUS="filter:blur()"><img src="images/emoticons/eek.gif" border="0" width="15" height="15"></A>
<A HREF="javascript:SetEmoticon(':lol')" ONFOCUS="filter:blur()"><img src="images/emoticons/laugh.gif" border="0" width="15" height="15"></A>
<A HREF="javascript:SetEmoticon(';)')" ONFOCUS="filter:blur()"><img src="images/emoticons/wink.gif" border="0" width="15" height="15"></A>
<A HREF="javascript:SetEmoticon(':(')" ONFOCUS="filter:blur()"><img src="images/emoticons/frown.gif" border="0" width="15" height="15"></A>
<A HREF="javascript:SetEmoticon(':mad')" ONFOCUS="filter:blur()"><img src="images/emoticons/mad.gif" border="0" width="15" height="15"></A>
<A HREF="javascript:SetEmoticon(':o')" ONFOCUS="filter:blur()"><img src="images/emoticons/embarassed.gif" border="0" width="15" height="15"></A>
<A HREF="javascript:SetEmoticon(':x')" ONFOCUS="filter:blur()"><img src="images/emoticons/sick.gif" border="0" width="15" height="15"></A>
<A HREF="javascript:SetEmoticon(':|')" ONFOCUS="filter:blur()"><img src="images/emoticons/indifferent.gif" border="0" width="15" height="15"></A>
<A HREF="javascript:SetEmoticon(':?')" ONFOCUS="filter:blur()"><img src="images/emoticons/question.gif" border="0" width="15" height="15" alt=></A>
<A HREF="javascript:SetEmoticon(':!')" ONFOCUS="filter:blur()"><img src="images/emoticons/exclamation.gif" border="0" width="15" height="15"> </A>
</td>
</tr>
</table>
<input name="IPADDRES" type="hidden" class="inputborder-gast" id="IPADRES" value="<% = Session("IP_ADDRESS") %>" size="50">
<input name="DATUM" type="hidden" class="inputborder-gast" id="DATUM" value="<% = Session("DATE_ENTERED") %>" size="50">
</center></div><div align="center">
<center>
<p><input type="submit" class="form-button" onClick="MM_validateForm('E-Mailadres','','RisEmail');return document.MM_returnValue" value="Toevoegen">
</p>
</center></div>
<input type="hidden" name="MM_insert" value="guestform">
</form>
<br>
</body>
</html>