vendredi 9 janvier 2015

Error on IF ELSE STATEMENT what did i do wrong?

I believe my IF ELSE STATEMENT are all unorder. Please help me. I'm new to classic asp. What i'm trying to do is: User enter the email if is incorrect in our database will show not match in our database else will generate a 6 or 7 random string and print random strings and store into the hash password database



<!--#include file="include_login_header2.asp" -->
<%
DIM strEmail
strEmail = Request.Form("Set_email")
'' strPassword = Request.Form("Set_Password")
'strConPassword = Request.Form("Confirm_Set_Password")
IF strEmail <> "" THEN
'IF strPassword <> strConPassword THEN
'Response.Write "Your New Password and Confirm Password doesn't match, Please click back on your browser to ree"

%>



<%
DIM mySQL, objRS, rs
Set objRS = CreateObject("ADODB.Connection")
objRS.Open "Provider=MSDASQL.1;Password=xxx;Persist Security Info=True;User ID=xxx;Data Source=xxx"
mySQL = "SELECT email_addr, xxx FROM medacist_user WHERE email_addr = '" & strEmail & "'"
Set rs = objRS.Execute(mySQL)

'' DIM objPS, psSQL, ps
'' Set objPS = CreateObject("ADODB.Connection")
'' objPS.Open "Provider=MSDASQL.1;Password=xxx;Persist Security Info=True;User ID=xxx;Data Source=xxx"
'' psSQL = "UPDATE medacist_user SET xxx= md5('"& strPassword &"') WHERE email_addr = '"& strEmail &"'"
'' Set ps = objPS.Execute(psSQL)

IF rs.EOF THEN
Response.Write "<div align='center'>Sorry, that email does not exist. Please click back on your browser and enter a different email.</div>"

ELSE


function RandomString()

Randomize()

dim CharacterSetArray
CharacterSetArray = Array(_
Array(6, "abcdefghijklmnopqrstuvwxyz"), _
Array(1, "0123456789"), _
Array(1, "!@#$+-*&?:") _
)

dim i
dim j
dim Count
dim Chars
dim Index
dim Temp

for i = 0 to UBound(CharacterSetArray)

Count = CharacterSetArray(i)(0)
Chars = CharacterSetArray(i)(1)

for j = 1 to Count

Index = Int(Rnd() * Len(Chars)) + 1
Temp = Temp & Mid(Chars, Index, 1)

next

next

dim TempCopy

do until Len(Temp) = 0

Index = Int(Rnd() * Len(Temp)) + 1
TempCopy = TempCopy & Mid(Temp, Index, 1)
Temp = Mid(Temp, 1, Index - 1) & Mid(Temp, Index + 1)

loop

RandomString = TempCopy

end function

IF strEmail <> "" THEN

Set cdoConfig = CreateObject("CDO.Configuration")

With cdoConfig.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "10.1.1.186" 'Ongoing sever SMTP required \\'
'' .Item(cdoSMTPAuthenticate) = 1'
'' .Item(cdoSendUsername) ="<enter_username>"
' ' .Item(cdoSendPassword) ="<enter_password>"''
.Update
End With

Set cdoMessage = CreateObject("CDO.Message")

With cdoMessage
Set .Configuration = cdoConfig
.From = "support@rxauditor.com"
.To = strEmail
.Subject = "Forgotten Password IP TextBody"
.HTMLBody = "Here is your temp password: '"& RandomString &"' <br> Please click below link to reset your password: <br> <a href='http://ift.tt/1BUTUm3'>Click this link to reset your password</a>"
.Send
End With

Set cdoMessage = Nothing
Set cdoConfig = Nothing

' ' ps = objPS.Execute(psSQL)
'' Response.Write "<div align='center'>Password has been successful updated in our database. Please relog into Medacist with your new password!</div>"

'' IF(String(Session("Set_Username")).replace("undefined","")==""){

'' Response.Write("Password Changed. <a href=\"client_data.asp\">Click here</a> to continue");
'' }
'' Response.End();

END IF

objRS.Close
Set objRS = Nothing

'' objPS.Close
'' Set objPS = Nothing

%>

<%
ELSE
Response.Write "Please click back on your browser and enter your email."
END IF
%>

Aucun commentaire:

Enregistrer un commentaire