<% on error resume next Function CheckLogin() on error resume next s_userID = request.form("user_name") Set objCmd = Server.CreateObject("ADODB.Command") objCmd.CommandType = adCmdStoredProc objCmd.CommandText = "usp_RetrievePwd" objcmd.Parameters.append objcmd.createparameter("@Name",advarchar,adParamInput,15,s_UserID) objCmd.ActiveConnection = stConn set rs = objCmd.Execute Set objCmd = Nothing if err <> 0 or (rs.EOF and rs.BOF) then CheckLogin = -1 else strEmail = rs("email") strPwd = rs("LetMeIn") Set Mailer = Server.CreateObject("CDO.Message") Mailer.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 Mailer.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost" Mailer.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 Mailer.Configuration.Fields.Update If IsObject(Mailer) = True Then Mailer.To = strEmail Mailer.From = "leaddog@sos-srf.org" 'Mailer.From = "melamb@magma.ca" Mailer.Subject = "SOS-SRF Password Recovery" Mailer.TextBody = "Your password is " & strPwd Err.Clear Mailer.Send If Err.Number = 0 Then response.write "

Your password has been sent to the email address you used when you registered.

" CheckLogin = 0 Else response.write "

Sorry! An error occured while processing your email message. (" & err.number & ")

" CheckLogin = -2 End If set mailer = nothing end if end if set rs = nothing stConn.close set stConn = nothing End Function %>
<% if request.form("action") = "checkdb" then intResult = Checklogin() ' response.write "

Result of checking login is " & intResult & "

" select case intResult case -1 %>

Username not found. Please try again.

Enter the UserID you used to register:

<% case -2 response.write "

My ISP is unable to send email from my application. Please send an email to maureenlamb@rogers.com.

" end select else %>

Enter the UserID you used to register:

<% end if %>