%@ Language=VBScript %>
<% Updated = Request.QueryString("Updated") %>
<% PageTitle = "SiteManager - List Applications" %>
<% PageID=602 %>
<% Header %>
<% Menu PageID %>
<%' Main body of page goes here ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ %>
<% ApplicationList %>
<%' End Of Main body ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ %>
<% Footer %>
<% Sub ApplicationList %>
<%= FormatDateTime(Date,1) %>
<%
OpenConnection1
mresult=""
Set rs = Server.CreateObject("ADODB.Recordset")
If Request.QueryString("AA")<>"" then
Sel="SELECT * FROM Applications WHERE ApplicationID=" & Request.QueryString("AA")
rs.Open Sel,DB,1,3
If Not rs.EOF then
mresult=Approve(Cint(Request.QueryString("AA")))
End If
rs.Close
End If
If Request.QueryString("DA")<>"" then
del="SELECT * FROM Applications WHERE ApplicationID=" & Request.QueryString("DA")
rs.Open del,DB,1,3
If Not rs.EOF then
rs.Delete
End If
rs.Close
End If
Sel = "SELECT ApplicationID, txtFname, txtLname, txtCompany, txtViewed FROM Applications ORDER BY txtViewed,txtLname"
rs.Open Sel, DB, 1, 3
If Not rs.EOF then%>
Customer Account Applications:
|
<%While Not rs.EOF
flag=""
If rs("txtViewed")="NO" then%>
| " title="Click here to view the details of this Application" style="{text-decoration:none; color:#FF0000}">*New* |
<%=rs("txtLname")&", "&rs("txtFname")%> <%=rs("txtCompany")%> |
<%Else%>
" title="Click here to view the details of this Application"> |
<%=rs("txtLname")&", "&rs("txtFname")%> <%=rs("txtCompany")%> |
<%End If
rs.MoveNext
Wend
Else%>
There are currently no Applications in the database.
|
<%End If%>
<%End Sub %>
<%Function Approve(AppID)
Sel="SELECT * FROM Applications WHERE ApplicationID=" & AppID
Set ap=Server.CreateObject("ADODB.Recordset")
ap.Open Sel,DB,1,3
If ap.EOF then Response.Redirect("Application_List.asp")
tempemail=ap("txtEmail")
ul=Instr(1,tempemail,"@")
username=Left(tempemail,ul-1)& ap("ApplicationID")
pass=cstr(date)
pl=Len(pass)
password=""
For x=1 to pl
If IsNumeric(mid(pass,x,1)) then password=password&mid(pass,x,1)
Next
Set cus=Server.CreateObject("ADODB.Recordset")
Sel="SELECT * FROM Customers"
cus.Open Sel,DB,1,3
cus.AddNew
cus("txtFname")=ap("txtFname")
cus("txtLname")=ap("txtLname")
cus("txtCompany")=ap("txtCompany")
cus("txtBusiness")=ap("txtBusiness")
cus("nEmployees")=ap("nEmployees")
cus("txtTitle")=ap("txtTitle")
cus("txtEmail")=ap("txtEmail")
cus("txtPhone")=ap("txtPhone")
cus("txtFax")=ap("txtFax")
cus("txtURL")=ap("txtURL")
cus("txtAddress")=ap("txtAddress")
cus("txtCity")=ap("txtCity")
cus("txtProvince")=ap("txtProvince")
cus("nCountry")=ap("nCountry")
cus("txtPostal")=ap("txtPostal")
cus("txtSAddress")=ap("txtSAddress")
cus("txtSCity")=ap("txtSCity")
cus("txtSProvince")=ap("txtSProvince")
cus("txtSPostal")=ap("txtSPostal")
cus("nSCountry")=ap("nSCountry")
cus("txtComments")=ap("txtComments")
cus("txtUserName")= username
cus("txtPassword")= password
cus("datApprove")=Date
cus.Update
cus.Close
txtName=ap("txtFname") & " " & ap("txtLname")
txtEmail=ap("txtEmail")
ap.Delete
ap.Close
Message="Your application for a Customer Account with Wades Bindery has been approved."
Message=Message & vbCRLF
Message=Message & "Please use the Username and Password below to log in to the 'Supply Order' area" & vbCRLF & "of the Wades Bindery Website."
Message=Message & vbCRLF
Message=Message & vbCRLF
Message=Message & "Username: " & username
Message=Message & vbCRLF
Message=Message & "Password: " & password
Message=Message & vbCRLF
Message=Message & vbCRLF
Message=Message & "Thank-you for your interest in our On-Line ordering system. We look forward to serving you in the future."
Message=Message & vbCRLF
Message=Message & vbCRLF
Message=Message & "Customer Accounts"
Message=Message & vbCRLF
Message=Message & "Wades Bindery"
Set ASPMail = Server.CreateObject("SMTPsvg.Mailer")
'ASPMail.QMessage = true
'ASPMail.ContentType = "text/html"
ASPMail.FromName ="Wades Bindery (Customer Accounts)"
ASPMail.FromAddress = "info@wadesbindery.com"
ASPMail.RemoteHost = "209.47.206.2"
ASPMail.AddRecipient txtName,txtEmail
'ASPMail.AddCC rs("tEmail"), rs("tEmail")
'ASPMail.AddBCC "steve@digitized.com", "steve@digitized.com" ' Send CC to applicant
ASPMail.Subject = "Customer Account"
ASPMail.BodyText = Message
If not ASPMail.SendMail Then
Approve=False
Else
Approve=True
End If
End Function%>