Er jeg blind eller hvad, hjælp!
******
fil 1:
<%@LANGUAGE=\"VBSCRIPT\"%>
<!--#include file=\"Connections/data.asp\" -->
<%
\' *** Edit Operations: declare variables
MM_editAction = CStr(Request(\"URL\"))
If (Request.QueryString <> \"\") Then
MM_editAction = MM_editAction & \"?\" & Request.QueryString
End If
\' boolean to abort record edit
MM_abortEdit = false
\' query string to execute
MM_editQuery = \"\"
%>
<%
\' *** Insert Record: set variables
If (CStr(Request(\"MM_insert\")) <> \"\") Then
MM_editConnection = MM_data_STRING
MM_editTable = \"user\"
MM_editRedirectUrl = \"send_mail2.asp\"
MM_fieldsStr = \"navn|value|user|value|pass|value|email|value|adresse|value|postnr|value|bynavn|value|tilmeldt_user|value\"
MM_columnsStr = \"navn|\',none,\'\'|user|\',none,\'\'|pass|\',none,\'\'|email|\',none,\'\'|adresse|\',none,\'\'|postnr|none,none,NULL|bynavn|\',none,\'\'|tilmeldt_nyhedsbrev|none,1,0\"
\' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, \"|\")
MM_columns = Split(MM_columnsStr, \"|\")
\' set the form values
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(i+1) = CStr(Request.Form(MM_fields(i)))
Next
\' append the query string to the redirect URL
If (MM_editRedirectUrl <> \"\" And Request.QueryString <> \"\") Then
If (InStr(1, MM_editRedirectUrl, \"?\", vbTextCompare) = 0 And Request.QueryString <> \"\") Then
MM_editRedirectUrl = MM_editRedirectUrl & \"?\" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & \"&\" & Request.QueryString
End If
End If
End If
%>
<%
\' *** Insert Record: construct a sql insert statement and execute it
If (CStr(Request(\"MM_insert\")) <> \"\") Then
\' create the sql insert statement
MM_tableValues = \"\"
MM_dbValues = \"\"
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
FormVal = MM_fields(i+1)
MM_typeArray = Split(MM_columns(i+1),\",\")
Delim = MM_typeArray(0)
If (Delim = \"none\") Then Delim = \"\"
AltVal = MM_typeArray(1)
If (AltVal = \"none\") Then AltVal = \"\"
EmptyVal = MM_typeArray(2)
If (EmptyVal = \"none\") Then EmptyVal = \"\"
If (FormVal = \"\") Then
FormVal = EmptyVal
Else
If (AltVal <> \"\") Then
FormVal = AltVal
ElseIf (Delim = \"\'\") Then \' escape quotes
FormVal = \"\'\" & Replace(FormVal,\"\'\",\"\'\'\") & \"\'\"
Else
FormVal = Delim + FormVal + Delim
End If
End If
If (i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & \",\"
MM_dbValues = MM_dbValues & \",\"
End if
MM_tableValues = MM_tableValues & MM_columns(i)
MM_dbValues = MM_dbValues & FormVal
Next
MM_editQuery = \"insert into \" & MM_editTable & \" (\" & MM_tableValues & \") values (\" & MM_dbValues & \")\"
If (Not MM_abortEdit) Then
\' execute the insert
Set MM_editCmd = Server.CreateObject(\"ADODB.Command\")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> \"\") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<%
set rs_user = Server.CreateObject(\"ADODB.Recordset\")
rs_user.ActiveConnection = MM_data_STRING
rs_user.Source = \"SELECT * FROM user\"
rs_user.CursorType = 0
rs_user.CursorLocation = 2
rs_user.LockType = 3
rs_user.Open()
rs_user_numRows = 0
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
<script language=\"JavaScript\">
<!--
function MM_findObj(n, d) { //v4.0
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 && document.getElementById) x=document.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors=\'\',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!=\"\") {
if (test.indexOf(\'isEmail\')!=-1) { p=val.indexOf(\'@\');
if (p<1 || p==(val.length-1)) errors+=\'- \'+nm+\' skal indeholde en e-mail addresse.\\n\';
} else if (test!=\'R\') {
if (isNaN(val)) errors+=\'- \'+nm+\' skal indeholde et tal.\\n\';
if (test.indexOf(\'inRange\') != -1) { p=test.indexOf(\':\');
min=test.substring(8,p); max=test.substring(p+1);
if (val<min || max<val) errors+=\'- \'+nm+\' must contain a number between \'+min+\' and \'+max+\'.\\n\';
} } } else if (test.charAt(0) == \'R\') errors += \'- \'+nm+\' is required.\\n\'; }
} if (errors) alert(\'Følgende fejl opstod:\\n\'+errors);
document.MM_returnValue = (errors == \'\');
}
//-->
</script>
<link rel=\"stylesheet\" href=\"main.css\" type=\"text/css\">
</head>
<body bgcolor=\"#FFFFFF\" text=\"#000000\">
<form method=\"POST\" action=\"<%=MM_editAction%>\" name=\"form1\" onSubmit=\"MM_validateForm(\'navn\',\'\',\'R\',\'user\',\'\',\'R\',\'pass\',\'\',\'R\',\'email\',\'\',\'RisEmail\',\'adresse\',\'\',\'R\',\'postnr\',\'\',\'RisNum\',\'bynavn\',\'\',\'R\');return document.MM_returnValue\">
<br>
<table align=\"center\" class=\"broed\">
<tr valign=\"baseline\">
<td nowrap align=\"right\" colspan=\"2\">
<div align=\"left\">Her kan du tilmelde dig nyhedsbrevet:</div>
</td>
</tr>
<tr valign=\"baseline\">
<td nowrap align=\"right\">navn:</td>
<td>
<input type=\"text\" name=\"navn\" size=\"32\" class=\"form\">
</td>
</tr>
<tr valign=\"baseline\">
<td nowrap align=\"right\">brugernavn:</td>
<td>
<input type=\"text\" name=\"user\" size=\"32\" class=\"form\">
</td>
</tr>
<tr valign=\"baseline\">
<td nowrap align=\"right\">adgangskode:</td>
<td>
<input type=\"password\" name=\"pass\" size=\"32\" class=\"form\">
</td>
</tr>
<tr valign=\"baseline\">
<td nowrap align=\"right\">email:</td>
<td>
<input type=\"text\" name=\"email\" size=\"32\" class=\"form\">
</td>
</tr>
<tr valign=\"baseline\">
<td nowrap align=\"right\">adresse:</td>
<td>
<input type=\"text\" name=\"adresse\" size=\"32\" class=\"form\">
</td>
</tr>
<tr valign=\"baseline\">
<td nowrap align=\"right\">postnr:</td>
<td>
<input type=\"text\" name=\"postnr\" size=\"32\" class=\"form\">
</td>
</tr>
<tr valign=\"baseline\">
<td nowrap align=\"right\">by:</td>
<td>
<input type=\"text\" name=\"bynavn\" size=\"32\" class=\"form\">
</td>
</tr>
<tr valign=\"baseline\">
<td nowrap align=\"right\">tilmeldt:</td>
<td>
<input type=\"checkbox\" name=\"tilmeldt_user\" value=\"checkbox\">
nyhedsbrev</td>
</tr>
<tr valign=\"baseline\">
<td nowrap align=\"right\"> </td>
<td>
<div align=\"right\">
<input type=\"submit\" value=\"opret\" name=\"submit\">
</div>
</td>
</tr>
</table>
<input type=\"hidden\" name=\"MM_insert\" value=\"true\">
</form>
<p> </p>
</body>
</html>
<%
rs_user.Close()
%>
******
fil 2:
<%@LANGUAGE=\"VBSCRIPT\"%>
<meta http-equiv=\"refresh\" content=\"3;URL=http://www.webgalleri.dk/login.asp\">
<%
Set Mailer = Server.CreateObject(\"SMTPsvg.Mailer\")
Mailer.charset = 2
Mailer.ContentType = \"text/html\"
Mailer.FromName = \"Mail fra webgalleri\"
Mailer.FromAddress= \"info@webgalleri.dk\"
Mailer.RemoteHost = \"mail.webgalleri.dk\"
Mailer.AddRecipient Request.Form(\"navn\"), Request.Form(\"email\")
Mailer.Subject = \"velkommen til webgalleri.dk\"
tekst = \"\"
linie = vbCrLf
\'linie = \"<br>\"
udfyldt = false
if Request.Form(\"navn\") <> \"\" then
tekst = tekst & \"navn\" & linie & Request.Form(\"navn\") & linie & linie
udfyldt = true
end if
if Request.Form(\"user\") <> \"\" then
tekst = tekst & \"user\" & linie & Request.Form(\"user\") & linie & linie
udfyldt = true
end if
if Request.Form(\"pass\") <> \"\" then
tekst = tekst & \"pass\" & linie & Request.Form(\"pass\") & linie & linie
udfyldt = true
end if
if Request.Form(\"email\") <> \"\" then
tekst = tekst & \"email\" & linie & Request.Form(\"email\") & linie & linie
udfyldt = true
end if
if Request.Form(\"adresse\") <> \"\" then
tekst = tekst & \"adresse\" & linie & Request.Form(\"adresse\") & linie & linie
udfyldt = true
end if
if Request.Form(\"postnr\") <> \"\" then
tekst = tekst & \"postnr\" & linie & Request.Form(\"postnr\") & linie & linie
udfyldt = true
end if
if Request.Form(\"bynavn\") <> \"\" then
tekst = tekst & \"bynavn\" & linie & Request.Form(\"bynavn\") & linie & linie
udfyldt = true
end if
if Request.Form(\"tilmeldt_user\") <> \"\" then
tekst = tekst & \"tilmeldt nyhedsbrevet:\" & linie & Request.Form(\"tilmeldt_user\") & linie & linie
end if
\'Response.Write \"test\" & tekst
Mailer.BodyText = \"Dit password til webgalleri er: \" & (Request.Form(\"pass\")) & \"<BR>\"& \"Dit brugernavn til webgalleri er: \" & (Request.Form(\"user\")) & \"<BR><a href=http://www.webgalleri.dk>
http://www.webgalleri.dk</a>\"if udfyldt then
if Mailer.SendMail then
Response.Write \"<p>Dit password er send til dig. Check din mail!</p>\"
else
Response.Write \"<p>Dit password blev<b> ikke</b> send</p>\"
Response.Write \"<p>Mail-fejl. Fejlen var: <b>\" & Mailer.Response & \"</b></p>\"
end if
else
Response.Write \"<p>Dit password var <b>IKKE</b> Send</p>\"
Response.Write \"<p>Felterne var ikke udfyldt!</p>\"
end if
%>