📄 voting.asp
字号:
<%@ Language=VBScript %>
<%
'判断用户是否登录
if isempty(Session("ID")) then
Response.Redirect "../login.asp"
end if
'连接系统数据库
set conn = server.createobject ("adodb.connection")
conn.open "ASPData", "sa", "yourpassword"
'开始发布投票
if not IsEmpty(Request.Form("Send")) then
'投票发布的范围
if Request.Form("SendTo") = "All" then
set RSEmails = conn.Execute("select ID, Name, EmailAddress from PSLogins")
set RSVoterNumber = conn.Execute("SELECT COUNT(ID) AS VoterNumber FROM PSLogins ")
elseif Request.Form("SendTo") = "Department" then
set RSEmails = conn.Execute("select ID, Name, EmailAddress from PSLogins where Department = '" _
& Request.Form("DepartmentName") & "'")
set RSVoterNumber = conn.Execute("SELECT COUNT(ID) AS VoterNumber FROM PSLogins " _
& "where Department = '" & Request.Form("DepartmentName") & "'")
else
set RSEmails = conn.Execute("select ID, Name, EmailAddress from PSLogins where Position = '" _
& Request.Form("PositionName") & "'")
set RSVoterNumber = conn.Execute("SELECT COUNT(ID) AS VoterNumber FROM PSLogins " _
& "where Position = '" & Request.Form("PositionName") & "'")
end if
CurrentDateTime = Now()
conn.Execute "Insert Into VotingQuestions (SenderName, Subject, Question, WhenSent, VoterNumber) " _
& "values (" _
& "'" & Session("Name") & "', " _
& "'" & Request.Form("Subject") & "', " _
& "'" & Request.Form("SuggestionText") & "', " _
& "'" & CurrentDateTime & "', " _
& "'" & RSVoterNumber("VoterNumber") & "')"
set RSQuestionID = conn.Execute("select QuestionID from VotingQuestions " _
& "where WhenSent = #" & CurrentDateTime & "#")
do Until RSEmails.eof
'构造电子邮件内容
EmailMessage = Session("Name") & "发起了一轮投票:" & chr(13)
EmailMessage = EmailMessage & "投票的问题题目是:" & Request.Form("Subject") & chr(13)
EmailMessage = EmailMessage & "投票的问题内容是:" & Request.Form("SuggestionText") & chr(13)
EmailMessage = EmailMessage & "要想投票,请点击下面的链接(请注意,如果您已经投过票," _
& "您将无法看到链接): "
EmailMessage = EmailMessage & "http://166.111.56.212/Messageboard/ToVote.asp?"
EmailMessage = EmailMessage & "QuestionID=" & RSQuestionID("QuestionID")
EmailMessage = EmailMessage & "&VoterID=" & RSEmails("ID") & chr(13)
'发送投票通知的电子邮件
set objMail = CreateObject("CDONTS.NewMail")
objMail.Send Session("EmailAddress"),RSEmails("EmailAddress"), _
cstr(Request.Form("Subject")),cstr(EmailMessage)
set objmail = nothing
conn.Execute "insert into VotingVotes (QuestionID, VoterID, VoterName) " _
& "values (" & RSQuestionID("QuestionID") & ", '" & RSEmails("ID") & "', '" & RSEmails("Name") &"')"
RSEmails.MoveNext
loop
TheMessage = "投票信息已发出!"
else
TheMessage = "请在下面填写投票内容"
end if
set RSDepartments = conn.Execute("select * from Departments where DepartmentName <>'All' " _
& "order by DepartmentName")
set PSPositions = conn.Execute("select PositionName from Positions order by PositionID")
%>
<HTML>
<HEAD>
<TITLE>公司内部意见箱-提交意见建议</TITLE>
<META NAME="Generator" CONTENT="NetObjects Fusion 2.0.2 for Windows">
</HEAD>
<body>
<table width=800 border=0 align=center cellpadding=2 cellspacing=1 bordercolor="#996633" bgcolor=#164DA8>
<tr bgcolor=white>
<td valign=center bgcolor="#0066CC" > <div align="center"><font color="#CCCCCC" size="7" face="华文隶书"><strong>公司内部办公信息管理系统</strong></font></div></td>
</tr>
</table>
<table width="800" border="0" bordercolor="#164DA8" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="13"> </td>
</tr>
</table>
<font size="2"><br>
</font>
<table width=800 border=0 bgcolor=#164DA8 cellspacing=1 cellpadding=2 align=center>
<tr>
<td colspan=3> <font color=white>
<P ALIGN="CENTER"><font size="2">公司内部办公信息管理系统->内部信息交流系统->投票站 [当前用户-
<% response.write Session("Name") %>
] </font></font></td>
</tr>
<tr bgcolor=white >
<td><font size="2"><a href=".././html/home.asp"><font color="#104DAD">返回内网主页</font></a></font></td>
<td align=center> <font color="#104DAD" size="2" >
<% response.write TheMessage %>
</FONT></td>
<td align=right><font size="2"><a href="Communication.asp"><font color="#104DAD">返回上一级网页</font></a></font></td>
</tr>
</table>
<table width="800" border="0" bordercolor="#164DA8" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10" colspan="4" valign="top" bgcolor="#FFFFFF"> <table width="100%" border="0" height="13" cellspacing="0" cellpadding="0" mm_noconvert="TRUE">
<tr>
<td height="13"> </td>
</tr>
</table></td>
</tr>
</table>
<font size="2"><br>
</font>
<TABLE CELLPADDING=1 CELLSPACING=2 BORDER=1 bordercolor="#164DA8" WIDTH=800 align=center>
<TR VALIGN="center" ALIGN="center">
<TD WIDTH=35% bgcolor=#B5C7EF> </td>
<td> <FORM ACTION="Voting.asp" METHOD=POST>
<table width=100% border=1>
<tr height=30>
<td><font size="2">请选择您发布投票的范围</font></td>
<td> <table width=100% border=1>
<tr>
<td><font size="2">
<INPUT TYPE="radio" CHECKED NAME="SendTo" VALUE="All" >
全体投票</font></td>
<td><font size="2">
<INPUT TYPE="radio" NAME="SendTo" VALUE="Department" >
部门投票</font></td>
<td><font size="2">
<INPUT TYPE="radio" NAME="SendTo" VALUE="Position" >
职位投票</font></td>
</tr>
<tr>
<td> </td>
<td align=center> <font size="2">
<SELECT NAME="DepartmentName" >
<%
Do Until RSDepartments.EOF
%>
<OPTION VALUE="<% Response.Write RSDepartments("DepartmentName") %>">
<% Response.Write RSDepartments("DepartmentName") %>
</OPTION>
<%
RSDepartments.Movenext
loop
%>
</SELECT>
</font></td>
<td align=center> <font size="2">
<SELECT NAME="PositionName" >
<%
Do Until PSPositions.EOF
%>
<OPTION VALUE="<% Response.Write PSPositions("PositionName") %>">
<% Response.Write PSPositions("PositionName") %>
</OPTION>
<%
PSPositions.MoveNext
Loop
%>
</SELECT>
</font></td>
</tr>
</table></td>
</tr>
<td><font size="2">请选择您要进行投票的标题</font></td>
<td><font size="2">
<INPUT TYPE="text" NAME="Subject" VALUE="" SIZE=30 MAXLENGTH=30 >
</font></td>
</tr>
<td><font size="2">请选择您要进行投票的内容</font></td>
<td> <font size="2">
<TEXTAREA NAME="SuggestionText" ROWS=6 COLS=40 ></TEXTAREA
>
</font></td>
</tr>
<tr>
<td colspan=2 align=center> <font size="2">
<input type=submit name=send value="开始投票" style="border: 1px solid #3466BB; background-color: #B6CAEB; color: #3466BB">
</font></td>
</tr>
</table>
</form></td>
</tr>
</table>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -