<%@ Language=VBScript%> <% '****************************** '****admin email settings****** '******Cully Radvillas********* '**********CS460*************** '****last updated 5/10/06****** '********user interface for the email system '********from this page the user can: '********turn the nomination and voting notification on and off '********shows if nomination and voting notification is on or off '********turn the individual nomination notification on and off '********shows if individual nomination notification is on or off '********send mass email to all users '****************************** '***declareing variables for email Dim Recordset1 DIM Connection1, connectionMT, connectionMF, connectionNT, connectionNF DIM strSQL1, strSQLMT, strSQLMF, strSQLNT, strSQLNF dim sConnString1 dim fs,f '***variables for message file dim ss, s '***variables for subject file Dim message, system, nom, sendmsg, subject '***form value storage variables '*************setting database connections************* set connectionMT = server.CreateObject("ADODB.connection") set connectionMF = server.CreateObject("ADODB.connection") set connectionNT = server.CreateObject("ADODB.connection") set connectionNF = server.CreateObject("ADODB.connection") set Connection1 = server.CreateObject("ADODB.connection") set Recordset1 = server.CreateObject("ADODB.recordset") set fs=Server.CreateObject("Scripting.FileSystemObject") set f=fs.OpenTextFile("Admin_message.txt",2,true) set ss=Server.CreateObject("Scripting.FileSystemObject") set s=ss.OpenTextFile("Admin_subject.txt",2,true) '*********set variables for email buttons nom = Request.Form("nom")' nom email on/off system = Request.Form("System")' mass email on/off '*********string for database access sConnString1 = "PROVIDER=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("../database/dbNVS.mdb") '*********** html for email page ************* Response.Buffer = True%> NVS Admin - E-Mail Options <% Title = "E-Mail Options" %>

<% '*******test for NOM/VOTE button pressed********* '****************************************** If system = "ON" Then 'response.write "
NOM/VOTE ON"'*******for testing '*************sql to turn NOM/VOTE(MASS EMAIL) on strSQLMT = "UPDATE ADMIN_SETTINGS SET MASS_EMAIL = TRUE;" connectionMT.Open sConnString1 connectionMT.Execute(strSQLMT) connectionMT.Close End if if system = "OFF" THEN 'response.write "
NOM/VOTE OFF"'******for testing '*************sql to turn NOM/VOTE (mass email) off strSQLMF = "UPDATE ADMIN_SETTINGS SET MASS_EMAIL = FALSE;" connectionMF.Open sConnString1 connectionMF.Execute(strSQLMF) connectionMF.Close END IF '********************************************* %>

The Nomination and Voting Notification System <% '**********output status of mass email********* '************************************************ '*****sql for to querry admin settings table****** strSQL1 = "SELECT * FROM ADMIN_SETTINGS;" Connection1.Open sConnString1 Recordset1.Open strSQL1, Connection1 if (Recordset1("MASS_EMAIL").VALUE=false)then Response.Write "is off" else Response.Write "is on" end if Recordset1.Close Connection1.close '******************************************* %>

<% '**test for NOM EMAIL button pressed******* '****************************************** IF nom = "ON" THEN 'response.write "
NOM ON"'for testing '*************sql to turn nom email on strSQLNT = "UPDATE ADMIN_SETTINGS SET NOM_EMAIL = TRUE;" connectionNT.Open sConnString1 connectionNT.Execute(strSQLNT) connectionNT.Close End IF If nom = "OFF" THEN 'response.write "
NOM OFF"'for testing '*************sql to turn nom email off strSQLNF = "UPDATE ADMIN_SETTINGS SET NOM_EMAIL = FALSE;" connectionNF.Open sConnString1 connectionNF.Execute(strSQLNF) connectionNF.Close END IF '**************************************** %>

 
The Individual Nomination E-Mail System <% '**********output status of nom email********* '************************************************ '*****sql for to querry admin settings table****** strSQL1 = "SELECT * FROM ADMIN_SETTINGS;" Connection1.Open sConnString1 Recordset1.Open strSQL1, Connection1 if (Recordset1("NOM_EMAIL").VALUE=false)then Response.Write "is off" else Response.Write "is on" end if Recordset1.Close Connection1.close '******************************************* %>
Mass E-mail:

Subject:

Message:

 

<% '*********set variable with form value sendmsg = Request.Form("sendmsg") '*******when send button is pressed send email if (sendmsg= "Send")then 'Response.write "sent"'for testing '******** put values of text boxes into variables message = Request.Form("message") subject = Request.Form("subject") '********message box*********** IF (message = "") then '********write standard message to file when no input f.write ("***no input***") else '****if there is a valid messege in the text box '****write real messege to file f.write (message) end if '*******subject box************ if (subject ="") then '********write standard message to file when no input s.write ("***no subject***") else '****if there is a valid messege in the subjectline '****write real messege to file s.write (subject) end if '****************************************************** '***display message box when fields are left blank***** if (subject="")then '*********check for subject Response.write "" end if if (message ="")then '********check for message Response.write "" end if '*********call emailer if both fields are populated**** if ((message <>"")and (subject<>""))then Response.Redirect("x_admin_email.asp") end if end if %>