% Option Explicit %>
<%
'Set the response buffer to true
Response.Buffer = True
'Dimension variables
Dim rsMailingListSetup 'Recorset holding all the username in the database
Dim strMode 'holds the mode of the page, set to true if changes are to be made to the database
Dim strUsername 'Holds the admin username
Dim strPassword 'Holds the admin password
'If the session variable is False or does not exsist then redirect the user to the unauthorised user page
If Session("blnIsUserGood") = False or IsNull(Session("blnIsUserGood")) = True then
'Redirect to unathorised user page
Response.Redirect"unauthorised_user_page.htm"
End If
'Read in the details from the form
strUsername = Request.Form("username")
strPassword = Request.Form("password")
strMailComponent = Request.Form("component")
strMailServer = Request.Form("mailServer")
strWebSiteName = Request.Form("siteName")
strWebsiteAddress = Request.Form("URL")
strWebsiteEmailAddress = Request.Form("email")
strTestEmailAddress = Request.Form("testEmail")
strWelcomeMessage = Request.Form("welcome")
strWelcomeFormat = Request.Form("format")
strMode = Request.Form("mode")
'Intialise the ADO recordset object
Set rsMailingListSetup = Server.CreateObject("ADODB.Recordset")
'Initalise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblConfiguration.* From tblConfiguration;"
'Set the cursor type property of the record set to Dynamic so we can navigate through the record set
rsMailingListSetup.CursorType = 2
'Set the Lock Type for the records so that the record set is only locked when it is updated
rsMailingListSetup.LockType = 3
'Query the database
rsMailingListSetup.Open strSQL, strCon
'If the user is changing the email setup then update the database
If strMode = "change" Then
'If there is a welcome message then covert the line breaks to
if required
If strWelcomeMessage <> "" AND strWelcomeFormat = "htmlBR" Then
strWelcomeMessage = Replace(strWelcomeMessage, vbCrLf, "
", 1, -1, 1)
strWelcomeFormat = "HTML"
End If
'Update the recordset
rsMailingListSetup.Fields("Username") = strUsername
rsMailingListSetup.Fields("Password") = strPassword
rsMailingListSetup.Fields("mail_component") = strMailComponent
rsMailingListSetup.Fields("mail_server") = strMailServer
rsMailingListSetup.Fields("website_name") = strWebSiteName
rsMailingListSetup.Fields("website_address") = strWebsiteAddress
rsMailingListSetup.Fields("website_email_address") = strWebsiteEmailAddress
rsMailingListSetup.Fields("test_email_address") = strTestEmailAddress
rsMailingListSetup.Fields("welcome_message") = strWelcomeMessage
rsMailingListSetup.Fields("welcome_format") = strWelcomeFormat
'Update the database with the new user's details
rsMailingListSetup.Update
'Re-run the query to read in the updated recordset from the database
rsMailingListSetup.Requery
End If
'Read in the deatils from the database
If NOT rsMailingListSetup.EOF Then
'Read in the e-mail setup from the database
strUsername = rsMailingListSetup("Username")
strPassword = rsMailingListSetup("Password")
strMailComponent = rsMailingListSetup("mail_component")
strMailServer = rsMailingListSetup("mail_server")
strWebSiteName = rsMailingListSetup("website_name")
strWebsiteAddress = rsMailingListSetup("website_address")
strWebsiteEmailAddress = rsMailingListSetup("website_email_address")
strTestEmailAddress = rsMailingListSetup("test_email_address")
strWelcomeMessage = rsMailingListSetup("welcome_message")
strWelcomeFormat = rsMailingListSetup("welcome_format")
End If
'Reset Server Objects
Set adoCon = Nothing
Set strCon = Nothing
Set rsMailingListSetup = Nothing
%>
| Important - Please Read |
| To be able to use the e-mail notification you need to have CDOSYS, the CDONTS e-mail component, the W3 JMail component, or Persists AspEmail component installed on the web server. Windows Win2k and XP Pro users - CDOSYS comes installed on Win2k and XP Pro. |