Omskrivning af schripts til jmail
HejI et loginsystem som jeg benytter virker min glemt password funktion ikke, da min server ikke understøtter OBJMAIL. Er der nogle der vil hjælpe med at omskrive det til Jmail.
Brugeren taster sin mailadresse ind i en boks, hvorefter schriptet ser om adressen er i databasen. Se eksempelet på http://www.kfum-js.dk/log_in.html
Koden er:
<%Response.Buffer=TRUE%>
<%
'here is the connection string
Set conn = server.createobject("adodb.connection")
'this connection uses JET 4 it is the prefered method of connecting to an access database
DSNtemp = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("/slog/login.mdb")
'if you cant use JET then comment out the line above and uncomment the line below
'DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("/slog/login.mdb")
conn.Open DSNtemp
'here we are getting the info from the lost password form
uid = Request.Form("T1")
SQL = "Select * From users Where uid = '" & uid & "'"
Set RS = Conn.Execute(SQL)
'HERE WE CHECK TO MAKE SURE THE USERS EMAIL EXISTS, IF IT DOES, WE EMAIL IT
If NOT RS.EOF Then
Dim mytxt
'HERE YOU CAN ASSIGN ANY TEXT YOU LIKE TO GO IN THE EMAIL WITH THE PASSWORD, LEAVE IT IN THE QUOTES!!!
mytxt = "Here is your password:"
Dim ObjMail
Set ObjMail = Server.CreateObject("CDONTS.NewMail")
' if the email address exists then the info is sent here
ObjMail.To = RS("uid")
'############################### CHANGE THE EMAIL BELOW TO YOUR ADMIN EMAIL
'############################### leave it in the quotes!!!!!
Objmail.From = "admin@youradmin.com"
ObjMail.Subject = "Lost Password"
'HERE IS THE BODY SENDING PASSWORD
ObjMail.Body = mytxt & vbcrlf&_
RS("pwd")
ObjMail.Send
Set ObjMail = Nothing
x = "Your Password Will Be Sent To The Email Address You Are Registered With"
Else
'IF THE EMAIL DOES NOT EXIST WE TELL THE BELOW
x = "Sorry The Email Address You Entered Does Not Exist"
End If
%>
<html>
<head>
<title>Lost Password</title>
</head>
<body>
<center><%=x%></center>
</body>
</html>