<% actionTaken = trim(Request.Form("actionTaken")) if actionTaken = "" then actionTaken = "unapproved" end if if actionTaken = "approved" then sqlQuery = "select * from tbl_IEEE_User u, tbl_IEEE_School s" sqlQuery = sqlQuery & " where u.USSCID = s.SCID and u.USID in " sqlQuery= sqlQuery & "(select AUUSID from tbl_IEEE_approved_user) order by s.SCNAME,u.USLNAME" set RSdata = conn.execute(sqlQuery) Response.Write "

Approved Users

" else if actionTaken="unapproved" then sqlQuery ="select * from tbl_IEEE_User u, tbl_IEEE_school s where u.USSCID = s.SCID and u.USID not in " sqlQuery= sqlQuery & "(select AUUSID from tbl_IEEE_approved_user) order by s.SCNAME, u.USLNAME" set RSdata = conn.execute(sqlQuery) Response.Write "

Unapproved Users

" else if actionTaken="approveUser" then userToBeUpdated = cint(Request.Form("userToBeUpdated")) sqlQuery ="insert into tbl_IEEE_approved_user(AUUSID,AUADMIN) values ("&userToBeUpdated&",0)" conn.execute(sqlQuery) ' **** GET THE ADMIN MAIL and password and send email to the approved user sqlQuery = "select * from variable_table where description = 'admin_mail'" set RSBuffer= conn.Execute(sqlquery) if RSBuffer.EOF = false then adminMail = trim(RSBuffer("value")) end if sqlQuery = "select * from tbl_IEEE_user where USID="&userToBeUpdated set RSbuffer = conn.execute(sqlQuery) userMail = trim(RSbuffer("USEMAIL")) userUname = trim(RSbuffer("USUSERNAME")) userPassword = trim(RSbuffer("USPASSWORD")) 'Response.Write adminMail & "
" Set Mail = Server.CreateObject("IPWorksASP.SMTP") Mail.MailServer = "mailhub.iastate.edu" Mail.From = adminMail 'Response.Write "From : " & Mail.From & "
" Mail.Subject = "[IEEE Survey] Registration Approval" bodyText= "Your registration to IEEE survey page has been approved."&vbCrLf&"Your username is:"&vbCrLf bodyText = bodyText & userUName & vbCrLf &"and your password is:"&vbCrlF&userPassword&vbCrLf bodyText = bodyText & "Please login to www.powerlearn.org/survey/surveyLogin.asp ." Mail.MessageText = bodyText Mail.SendTo = userMail Mail.Send 'show unapproved users sqlQuery ="select * from tbl_IEEE_User u, tbl_IEEE_school s where u.USSCID = s.SCID and u.USID not in " sqlQuery= sqlQuery & "(select AUUSID from tbl_IEEE_approved_user) order by s.SCNAME,u.USLNAME" set RSdata = conn.execute(sqlQuery) Response.Write "

Unapproved Users

" else if actionTaken="disapproveUser" then userToBeUpdated = cint(Request.Form("userToBeUpdated")) sqlQuery ="delete from tbl_IEEE_approved_user where AUUSID="&userToBeUpdated conn.execute(sqlQuery) 'show approved users sqlQuery = "select * from tbl_IEEE_User u, tbl_IEEE_School s" sqlQuery = sqlQuery & " where u.USSCID = s.SCID and u.USID in " sqlQuery= sqlQuery & "(select AUUSID from tbl_IEEE_approved_user) order by s.SCNAME,u.USLNAME" set RSdata = conn.execute(sqlQuery) Response.Write "

Approved Users

" else if actionTaken="deleteUser" then userToBeUpdated = cint(Request.Form("userToBeUpdated")) sqlQuery = "Select * from tbl_IEEE_report where REUSID="&userToBeUpdated set RSbuffer = conn.execute(sqlQuery) if RSbuffer.eof= false then 'if the user has filled out the report Response.Write "Error: The user has already filled a report." else 'the user has not filled a report sqlQuery ="delete from tbl_IEEE_approved_user where AUUSID="&userToBeUpdated conn.execute(sqlQuery) sqlQuery = "delete from tbl_IEEE_user where USID="&userToBeUpdated conn.execute(sqlQuery) end if 'show unapproved users sqlQuery ="select * from tbl_IEEE_User u, tbl_IEEE_school s where u.USSCID = s.SCID and u.USID not in " sqlQuery= sqlQuery & "(select AUUSID from tbl_IEEE_approved_user) order by s.SCNAME,u.USLNAME" set RSdata = conn.execute(sqlQuery) Response.Write "

Unapproved Users

" end if end if end if end if end if 'Response.Write "actionTaken:"&actionTaken&"
" if actionTaken ="detail" then userToBeUpdated = cint(Request.Form("userToBeUpdated")) %> <% else %> <% number = 1 do while RSdata.eof = false %> <% number=number+1 Response.Flush RSdata.movenext loop %>
<% if actionTaken="unapproved" or actionTaken="approveUser" or actionTaken="deleteUser" then %> <%else if actionTaken = "approved" or actionTaken ="disapproveUser" then %> <% end if end if %>
No. Name School Detail Approve/Disapprove Survey Submitted?
<%=number%> <% Response.write trim(RSdata("USFNAME"))&" " Response.write trim(RSdata("USMNAME"))&" " Response.write trim(RSdata("USLNAME")) %> <%=trim(RSdata("SCNAME"))%> '" style="FONT-WEIGHT: bold; BORDER-LEFT-COLOR: chocolate; BORDER-BOTTOM-COLOR: chocolate; CURSOR: hand; BORDER-TOP-STYLE: solid; BORDER-TOP-COLOR: chocolate; FONT-FAMILY: ; BORDER-RIGHT-STYLE: solid; BORDER-LEFT-STYLE: solid; BACKGROUND-COLOR: sandybrown; BORDER-RIGHT-COLOR: chocolate; BORDER-BOTTOM-STYLE: solid" width=100> <% if actionTaken = "approved" or actionTaken ="disapproveUser" then %> '" style="FONT-WEIGHT: bold; BORDER-LEFT-COLOR: chocolate; BORDER-BOTTOM-COLOR: chocolate; CURSOR: hand; BORDER-TOP-STYLE: solid; BORDER-TOP-COLOR: chocolate; FONT-FAMILY: ; BORDER-RIGHT-STYLE: solid; BORDER-LEFT-STYLE: solid; BACKGROUND-COLOR: sandybrown; BORDER-RIGHT-COLOR: chocolate; BORDER-BOTTOM-STYLE: solid" width=100> <% else if actionTaken="unapproved" or actionTaken="approveUser" or actionTaken="deleteUser" then %> '" style="FONT-WEIGHT: bold; BORDER-LEFT-COLOR: chocolate; BORDER-BOTTOM-COLOR: chocolate; CURSOR: hand; BORDER-TOP-STYLE: solid; BORDER-TOP-COLOR: chocolate; FONT-FAMILY: ; BORDER-RIGHT-STYLE: solid; BORDER-LEFT-STYLE: solid; BACKGROUND-COLOR: sandybrown; BORDER-RIGHT-COLOR: chocolate; BORDER-BOTTOM-STYLE: solid" width=100> <% end if end if %> <%if actionTaken = "approved" or actionTaken ="disapproveUser" then sqlQuery = "select REFINISH from tbl_IEEE_report where REUSID="&cint(RSdata("USID")) set RSData2 = conn.execute(sqlQuery) if RSData2.eof = false then if RSdata2("REFINISH")= true then Response.Write "X" else Response.Write " " end if end if end if %>
<% end if %>