%
'*************************************************************************
' ASP Scripting:
' Filename: create_user_status_page.asp
' Written by: Wilbert Madarang
' Date: Mar 8, 2003
'*************************************************************************
' Description: Reports the Status of Creating a user - Whether
' Successful or Unsuccessful
'*************************************************************************
' Revision History:
'*************************************************************************
%>
<%
'*************************************************************************
' FUNCTION: printCreateUserStatus
' DESCRIPTION: This function is used to print the User Status.
' PARAMETERS:
' RETURNS:
'*************************************************************************
Function printCreateUserStatus
Dim strStatus
'ay111205 Added to tell if the customer has a valid Refer Code
Call retrieveSessionUserData()
strStatus = Request("status")
strErrorCode = Request( "error_code" )
If strStatus = "successful" Then
Response.Write "
" & vbCrLf
Response.Write "  Your user account is successfully created."
If bConfirmedReferCodeExists = True And strReferCode <> "" Then
Response.Write "  As a token of our appreciation, we will be sending a discount coupon code to your registered email account. Thank you for visiting www.charister.com."
End If
Response.Write "
  Please click here to be returned to the home page.
" & vbCrLf
Response.Write "  Your user account has NOT been successfully created.
" & vbCrLf
Response.Write "  If you continue to encounter difficulties, please click here to contact us by email.
" & vbCrLf
Response.Write "  Please click here to be returned to the home page. " & vbCrLf
Response.Write "
" & vbCrLf
Response.Write "
" & vbCrLf
End If
strBodyHead = "Dear " & strFirstname & "," & vbCrLf & vbCrLf & "Thank you for your interest at www.charister.com." & vbCrLf & vbCrLf
strBody = strBodyHead
If bConfirmedReferCodeExists = True And strReferCode <> "" Then
strCouponCode = getCouponCode(strReferCode)
strCouponExpiry = getCouponExpiry(strReferCode)
strBody = strBody & "As a token of our appreciation, please use " & strCouponCode & " as the coupon code for your next purchase. This coupon code is valid until " & strCouponExpiry & "." & vbCrLf & vbCrLf
End If
strBody = strBody & "Yours Truly," & vbCrLf & "Charister Home Fashion Inc" & vbCrLf & vbCrLf
strTo = strEmail
strFrom = CHARISTER_EMAIL
strSubject = "Registration Confirmation"
Call SendEmail(strTo, strFrom, strSubject, strBody)
'Send Email to Charister
strFrom = strTo
' strFrom = CHARISTER_EMAIL
strTo = CHARISTER_EMAIL
' strTo = "xxx@yahoo.com"
strSubject = "Registration Confirmation"
Call SendEmail(strTo, strFrom, strSubject, strBody)
End Function
Function SendEmail(strTo, strFrom, strSubject, strBody)
Dim objSendMail
'Send the email to inform Canalite
Set objSendMail = CreateObject("CDONTS.NewMail")
objSendMail.To = strTo
objSendMail.From = strFrom
objSendMail.Subject = strSubject
objSendMail.Body = strBody
objSendMail.Send
Set objSendMail = Nothing
End Function
Function getCouponCode( strReferCode )
Dim strSQL, rs
Dim bSuccess
If strReferCode = "" Then
bSuccess = true
Else
'Prepare SQL statement
strSQL = "SELECT * FROM TReferCode WHERE ReferCode='" & strReferCode & "'"
'Execute Query
Call openDataConnection
Set rs = dataConnection.Execute( strSQL )
Call closeDataConnection
'Obtain Information
If NOT (rs.EOF AND rs.BOF) Then
If DateDiff("d", Date(), DateValue(rs.Fields( "ExpiryDate" ))) >= 0 Then
strCouponCode = rs.Fields("CouponCode")
End If
End If
Set rs = Nothing
End If
getCouponCode = strCouponCode
End Function
Function getCouponExpiry( strReferCode )
Dim strSQL, rs
Dim bSuccess
If strReferCode = "" Then
bSuccess = true
Else
'Prepare SQL statement
strSQL = "SELECT * FROM TReferCode WHERE ReferCode='" & strReferCode & "'"
'Execute Query
Call openDataConnection
Set rs = dataConnection.Execute( strSQL )
Call closeDataConnection
'Obtain Information
If NOT (rs.EOF AND rs.BOF) Then
If DateDiff("d", Date(), DateValue(rs.Fields( "ExpiryDate" ))) >= 0 Then
strCouponExpiry = rs.Fields("CouponExpiry")
End If
End If
Set rs = Nothing
End If
getCouponExpiry = strCouponExpiry
End Function
%>