webForumDet fria alternativet

AKUT PROBLEM! Help needed nu

9 svar · 371 visningar · startad av medialabs

medialabsMedlem sedan mars 20023 686 inlägg
#1

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                           
                                    </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">
   
<input type="button" value="Cancel" class="buttons" onClick="window.close()">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
<%
conn.Close
Response.Flush
%>
-------------------------------------------
***

solbulleMedlem sedan mars 20015 287 inlägg
#2

mail scriptet?

medialabsMedlem sedan mars 20023 686 inlägg
#3

Mail delen......

medialabsMedlem sedan mars 20023 686 inlägg
#4

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                           
                                    </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">
   
<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>

medialabsMedlem sedan mars 20023 686 inlägg
#5

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                           
                                    </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">
   
<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>

---------------------------

medialabsMedlem sedan mars 20023 686 inlägg
#6

^^

trexter.comMedlem sedan apr. 20021 203 inlägg
#7

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

medialabsMedlem sedan mars 20023 686 inlägg
#8

? 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.....

@ndersMedlem sedan juni 200032 969 inlägg
#9

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,

medialabsMedlem sedan mars 20023 686 inlägg
#10

tack, nu funkar den som den ska...

144 ms totalt · 3 externa anrop · v20260731065814-full.30151723
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
141 ms — hämta tråd, inlägg och bilagor (db)