---
title: "AKUT PROBLEM! Help needed nu"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/44543-akut-problem-help-needed-nu"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "medialabs"
published: "2002-05-25T21:02:50.000Z"
updated: "2002-05-26T09:03:29.000Z"
replies: 9
views: 372
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/44543-akut-problem-help-needed-nu"
---

# AKUT PROBLEM! Help needed nu

## #1 — medialabs, 2002-05-25T21:02Z

Hej!

jag undrar om någon skulle kunna vara så snäll och skriva om mail scriptet som finns här till "aspSmartMail"

jag har inte lyckats. det e lite bråttom också....

\----------------------------------------------------
\<%@ Language=VBScript %\>
\<%
Option Explicit
'/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
'\*           register.asp                                    \*
'\*           copyright Simon Norris 2002                     \*
'\*           email: <si@web-sn.com>                            \*
'\*           home page: <http://www.web-sn.com>                \*
'\*                                                           \*
'\*           You may use or modify this script for           \*
'\*           non-profit sites provided this copyright        \*
'\*           notice remains unchanged.                       \*
'\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/
Response.Expires = 0
Session.Timeout = 120
Response.Buffer = True
%\>
\<!--#include file="db.asp"--\>
\<!--#include file="../config.asp"--\>
\<%
Dim isAttempt, failed, isReg
isAttempt = Request.QueryString("l")
failed = False
isReg = "No"

If isAttempt = "y" Then
  Dim strSQL, RS, usern, pass, pass2, forename, surname, email, fso, strSQLUpdate
  Dim DBuNameExists, FSuNameExists
  usern = Trim(Request.Form("flder"))
  pass = Trim(Request.Form("pass"))
  pass2 = Trim(Request.Form("pass2"))
  forename = Trim(Request.Form("forename"))
  surname = Trim(Request.Form("surname"))
  email = Trim(Request.Form("email"))
  Set fso = Server.CreateObject("Scripting.FileSystemObject")
  

  strSQL = "SELECT user FROM users WHERE user='" & usern & "';"
  Set RS = conn.Execute(strSQL) 'check if user exists in DB
  
  If Not RS.EOF Then 'user already exists in database
    DBuNameExists = True
    failed = True
  End If
  
  'remove this if you are not using the user manager with FileAce
  'If fso.FolderExists(physicalPathToUsers & "\\" & usern) Then
  '  FSuNameExists = True 'folder already exists
	'failed = True
  End If
  
 ' If Not failed Then 
  '  If FileAceExists = "yes" Then
  '    fso.CreateFolder (physicalPathToUsers & "\\" & usern) ' create the root folder
'End If
    strSQLUpdate = "INSERT INTO users (user, pass, email, forename, surname)"
    strSQLUpdate = strSQLUpdate & " VALUES ('" & Server.HTMLEncode(usern) & "'"
    strSQLUpdate = strSQLUpdate & ",'" & Replace(Server.HTMLEncode(pass),"'","&#39") & "'"
	strSQLUpdate = strSQLUpdate & ",'" & Replace(Server.HTMLEncode(email),"'","&#39") & "'"
    strSQLUpdate = strSQLUpdate & ",'" & Replace(Server.HTMLEncode(forename),"'","&#39") & "'"
    strSQLUpdate = strSQLUpdate & ",'" & Replace(Server.HTMLEncode(surname),"'","&#39") & "');"
    conn.Execute(strSQLUpdate) 'enter details into database
	isReg = "Yes"
  End If
End If

%\>

\<html\>
\<head\>
	\<title\>Login&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\</title\>
\<script language="JavaScript"\>
document.oncontextmenu = function() {return false};
var regd = "\<%= isReg %\>";
if (regd == "Yes") {
  window.opener.openwin(360, 175, 'login.asp?reg=y', 'no');
  window.close();
}

function isValid() {
 var illegalChar = '\\\\,/,:,\*,\<,\>,\|,=,(,),$,%,£,^,&,!,?,{,},\[,\],\\',+,¬,\\"'; // not an exhaustive list
 var arrBad = illegalChar.split(",");
 
  with (document.regfrm) {
   for (i=0;i\<elements.length;i++) { // loop through form elements and ensure they are not blank
    if(elements*.value == "") {
      alert("Please complete all fields");
	  elements*.focus();
	  return false;
    }
   }
   for(i=0;i\<arrBad.length;i++) { // loop through illegal characters and compare to username
    if (flder.value.indexOf(arrBad*) != -1)  {
       alert(arrBad *\+ " is an invalid character for a username. Please try again");
       flder.focus();
	   return false;
     }
   }
   if (pass.value != pass2.value) { // check that passwords match up
    alert("The passwords you entered do not match.");
    pass.focus();
	return false;
   }
   if (!/^.+@.+\\..{2,3}$/.test(email.value)) { // check format of email address for legality
    alert("Your email address is incorrectly formatted");
	email.focus();
	return false;
   }
 }
 return true;
}
\</script\>
\<link rel="stylesheet" href="web-sn_popup.css" type="text/css"\>
\</head\>
\<body\>
\<form name="regfrm" action="register.asp?l=y" method="post" onSubmit="return isValid()"\>
\<table border="0" cellspacing="5" cellpadding="4" width="95%" align="center"\>
\<tr\>
 \<td\>\<fieldset\>\<legend\>
    \<% If failed Then
	    Response.Write("\<font color='red'\>\<b\>Registration Failed. See Notes Below\</b\>\</font\>")
	   Else
	    Response.Write("Site Manager Registration")
	   End If
	%\>
	\</legend\>\<br\>
  \<table border="0" cellspacing="0" cellpadding="0" width="95%" align="center"\>
   \<tr\>
    \<td colspan="2"\>
	\<% If FSuNameExists Or DBuNameExists Then 
	    Response.Write("\<b\>Sorry, username " & user & " is already taken.\</b\>")
	   Else
	    Response.Write("The username you enter will also be the name of your root folder. All fields are required.")
	   End If
	%\>
	\</td\>
   \</tr\>
   \<tr\>
    \<td\>
	\<% If FSuNameExists Or DBuNameExists Then
	    Response.Write("\<font color='red'\>\<b\>Username:\</b\>\</font\>")
	   Else
	    Response.Write("Username:")
	   End If
	 %\>
	  \</td\>\<td\>\<input type="text" size="25" name="flder"\>\</td\>
   \</tr\>
   \<tr\>
     \<td\>Password:\</td\>\<td\>\<input type="password" size="25" name="pass"\>\</td\>
   \</tr\>
   \<tr\>
     \<td\>Confirm Password:\</td\>\<td\>\<input type="password" size="25" name="pass2"\>\</td\>
   \</tr\>
   \<tr\>
     \<td\>First Name:\</td\>\<td\>\<input type="text" size="25" name="forename"\>\</td\>
   \</tr\>
   \<tr\>
     \<td\>Surname:\</td\>\<td\>\<input type="text" size="25" name="surname"\>\</td\>
   \</tr\>
   \<tr\>
     \<td\>Email Address:\<br\>\<br\>\</td\>\<td\>\<input type="text" size="25" name="email"\>\<br\>\<br\>\</td\>
   \</tr\>
  \</table\>
  \</fieldset\>
 \</td\>
\</tr\>
\<tr\>
 \<td\>
  \<table border="0" cellspacing="0" cellpadding="0" width="95%" align="center"\>
   \<tr\>
    \<td width="100%" colspan="4" align="right"\>
	\<input type="submit" value="Ok" class="buttons"\>
	&nbsp;&nbsp;&nbsp;
	\<input type="button" value="Cancel" class="buttons" onClick="window.close()"\>
	\</td\>
   \</tr\>
  \</table\>
 \</td\>
\</tr\>
\</table\>
\</form\>
\</body\>
\</html\>
\<% 
conn.Close
Response.Flush
%\>
\-------------------------------------------****

Permalänk: https://www.webforum.nu/p/44543

## #2 — solbulle, 2002-05-25T21:12Z

mail scriptet?

Permalänk: https://www.webforum.nu/p/681987

## #3 — medialabs, 2002-05-25T21:12Z

Mail delen......

Permalänk: https://www.webforum.nu/p/681988

## #4 — medialabs, 2002-05-25T21:15Z

Herrre jevlar, måste ha klistrat in fel kod:
Här kommer den riktiga:
\---------------------------------------------
\<%@ Language=VBScript %\>
\<%
Option Explicit
Response.Expires = 0
Session.Timeout = 120
%\>
\<!--#include file="db.asp"--\>
\<!--#include file="../config.asp"--\>
\<%
Dim isAttempt, failed
isAttempt = Request.QueryString("l")

If isAttempt = "y" Then
  Dim strSQL, RS, email, CdoMail, oMail
  email = Request.Form("email")

  strSQL = "SELECT \* FROM users WHERE email='" & email & "';"
  Set RS = conn.Execute(strSQL)
  If RS.EOF And RS.BOF Then
    failed = True
  Else
    Set CdoMail = Server.CreateObject("CDONTS.NewMail")
    CdoMail.From = forgotPassEmail
    CdoMail.To = email
    CdoMail.Subject = forgotPassSubject
    CdoMail.Body = "Your login details:" & chr(13) & chr(13) & "username: " & RS("user") & chr(13) & "password: " & RS("pass")
    CdoMail.BodyFormat = 1
    CdoMail.MailFormat = 1
    CdoMail.Send	
    Set CdoMail = nothing
	oMail = "y"
  End If
End If
%\>

\<html\>
\<head\>
	\<title\>Login&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\</title\>
\<script language="JavaScript"\>
document.oncontextmenu = function() {return false};
\</script\>
\<link rel="stylesheet" href="web-sn_popup.css" type="text/css"\>
\</head\>
\<body\>
\<form name="emailfrm" action="forgotpass.asp?l=y" method="post"\>
\<table border="0" cellspacing="5" cellpadding="4" width="95%" align="center"\>
\<tr\>
 \<td\>\<fieldset\>\<legend\>
    \<% If failed Then
	    Response.Write("\<font color=""red""\>\<b\>Email Address Not Found\</b\>\</font\>")
	   Else
	    Response.Write("Enter Email Address")
	   End If
	%\>
	\</legend\>\<br\>
  \<table border="0" cellspacing="0" cellpadding="0" width="95%" align="center"\>
   \<tr\>
    \<td colspan="2"\>
	\<% If oMail = "y" Then %\>
	An email has been sent to you. Once you have your details, click \<a href="login.asp"\>here to 
	return to the login screen.\<br\>\<br\>\</td\>
	\</tr\>
  \</table\>
	\<% Else %\>
	Please enter the email address you registered with. 
	An email will then be sent containing your login details.\<br\>\<br\>\</td\>
	\</tr\>
   \<tr\>
     \<td\>Email:\<br\>\<br\>\</td\>\<td\>\<input type="text" size="25" name="email"\>\<br\>\<br\>\</td\>
   \</tr\>
  \</table\>
	\<% End If %\>
  \</fieldset\>
 \</td\>
\</tr\>
\<tr\>
 \<td\>
  \<table border="0" cellspacing="0" cellpadding="0" width="95%" align="center"\>
   \<tr\>
    \<td width="100%" colspan="4" align="right"\>
	\<input type="submit" value="Ok" class="buttons"\>
	&nbsp;&nbsp;&nbsp;
	\<input type="button" value="Cancel" class="buttons" onClick="window.close()"\>
	\</td\>
   \</tr\>
  \</table\>
 \</td\>
\</tr\>
\<tr\>\<td\>\<a href="login.asp"\>Return to login screen\</a\>\</td\>\</tr\>
\</table\>
\</form\>
\</body\>
\</html\>

Permalänk: https://www.webforum.nu/p/681990

## #5 — medialabs, 2002-05-25T21:54Z

Så jag försökte i alla fall....

Men lyckades nästan.......den vill inte skicka ivag mailet bara.....

\----------------------------
\<%@ Language=VBScript %\>
\<%
Option Explicit
Response.Expires = 0
Session.Timeout = 120
%\>
\<!--#include file="db.asp"--\>
\<!--#include file="../config.asp"--\>
\<%
Dim isAttempt, failed
isAttempt = Request.QueryString("l")

If isAttempt = "y" Then
  Dim strSQL, RS, email, CdoMail, oMail
  email = Request.Form("email")

  strSQL = "SELECT \* FROM users WHERE email='" & email & "';"
  Set RS = conn.Execute(strSQL)
  If RS.EOF And RS.BOF Then
    failed = True
  Else

Dim mySmartMail 	
Set mySmartMail = Server.CreateObject("aspSmartMail.SmartMail")

mySmartMail.Server = "mail.medialabs.nu" 
mySmartMail.SenderName = "noreply@medialabs.nu"
mySmartMail.Recipients.Add "email"
mySmartMail.Subject  = "forgotPassSubject"
mySmartMail.Body = "Your login details:" & chr(13) & chr(13) & "username: " & RS("user") & chr(13) & "password: " & RS("pass")

mySmartMail.ContentType = "text/html" 
 mySmartMail.Charset = "iso-8859-1"	
 mySmartMail.SendMail 

	End If
End If
%\>

\<html\>
\<head\>
	\<title\>Login&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\</title\>
\<script language="JavaScript"\>
document.oncontextmenu = function() {return false};
\</script\>
\<link rel="stylesheet" href="web-sn_popup.css" type="text/css"\>
\</head\>
\<body\>
\<form name="emailfrm" action="forgotpass.asp?l=y" method="post"\>
\<table border="0" cellspacing="5" cellpadding="4" width="95%" align="center"\>
\<tr\>
 \<td\>\<fieldset\>\<legend\>
    \<% If failed Then
	    Response.Write("\<font color=""red""\>\<b\>Email Address Not Found\</b\>\</font\>")
	   Else
	    Response.Write("Enter Email Address")
	   End If
	%\>
	\</legend\>\<br\>
  \<table border="0" cellspacing="0" cellpadding="0" width="95%" align="center"\>
   \<tr\>
    \<td colspan="2"\>
	\<% If oMail = "y" Then %\>
	An email has been sent to you. Once you have your details, click \<a href="login.asp"\>here to 
	return to the login screen.\<br\>\<br\>\</td\>
	\</tr\>
  \</table\>
	\<% Else %\>
	Please enter the email address you registered with. 
	An email will then be sent containing your login details.\<br\>\<br\>\</td\>
	\</tr\>
   \<tr\>
     \<td\>Email:\<br\>\<br\>\</td\>\<td\>\<input type="text" size="25" name="email"\>\<br\>\<br\>\</td\>
   \</tr\>
  \</table\>
	\<% End If %\>
  \</fieldset\>
 \</td\>
\</tr\>
\<tr\>
 \<td\>
  \<table border="0" cellspacing="0" cellpadding="0" width="95%" align="center"\>
   \<tr\>
    \<td width="100%" colspan="4" align="right"\>
	\<input type="submit" value="Ok" class="buttons"\>
	&nbsp;&nbsp;&nbsp;
	\<input type="button" value="Cancel" class="buttons" onClick="window.close()"\>
	\</td\>
   \</tr\>
  \</table\>
 \</td\>
\</tr\>
\<tr\>\<td\>\<a href="login.asp"\>Return to login screen\</a\>\</td\>\</tr\>
\</table\>
\</form\>
\</body\>
\</html\>

\---------------------------

Permalänk: https://www.webforum.nu/p/682000

## #6 — medialabs, 2002-05-25T22:37Z

^^

Permalänk: https://www.webforum.nu/p/682034

## #7 — trexter.com, 2002-05-26T07:05Z

MediaLabs, du tycker inte att du begär lite väl mycket?
Förresten, hur går det med designen din?  :e

Permalänk: https://www.webforum.nu/p/682091

## #8 — medialabs, 2002-05-26T08:25Z

? jag frågar om nån sku¨lle kunna vara lite snäll och bara skriva om skicka delen. Det är inget som jag kan för man måste visst ändra här också:

If isAttempt = "y" Then 
Dim strSQL, RS, email, CdoMail, oMail 
email = Request.Form("email") 

strSQL = "SELECT \* FROM users WHERE email='" & email & "';" 
Set RS = conn.Execute(strSQL) 
If RS.EOF And RS.BOF Then 
failed = True 
Else 

\--------------------------

men är det för svårt får jag fortsätta vidare.....

Permalänk: https://www.webforum.nu/p/682094

## #9 — @nders, 2002-05-26T08:36Z

Ta bort citationstecknen i denna rad:

```
mySmartMail.Recipients.Add "email"
```

Det är inte strängen "email" du ska använda, utan värdet i variabeln email.

I övrigt, vad är problemet med den kodbiten du nyss postade?

Mvh,

Permalänk: https://www.webforum.nu/p/682099

## #10 — medialabs, 2002-05-26T09:03Z

tack, nu funkar den som den ska...

Permalänk: https://www.webforum.nu/p/682107

---

Tråden på webben: https://www.webforum.nu/amne/asp/44543-akut-problem-help-needed-nu
