⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tovote.asp

📁 企业内部办公管理信息系统 (一个用ASP开发的基于B/S方式的毕业设计)
💻 ASP
字号:
<%@ Language=VBScript %>
<%
'判断用户是否具有合法的身份第一次链接到此页面
if not isempty(Request.QueryString("QuestionID")) and not isempty(Request.QueryString("VoterID")) then
TheMessage="请在下面进行投票"
'连接系统数据库
set conn = server.createobject ("adodb.connection")
conn.open "ASPData", "sa", "yourpassword"
set RSVerify = conn.Execute("Select vote from VotingVotes " _
& "where QuestionID = " & Request.QueryString("QuestionID") _
& " and VoterID ='" & Request.QueryString("VoterID") &"'")
'验证QuestionID和VoterID的组合是否合法
if RSVerify.EOF then
Response.Redirect "../Login.asp"
elseif not isnull(RSVerify("Vote")) then
Response.Redirect "../Login.asp"
end if				
set RSQuestion = conn.Execute("Select SenderName, Subject, Question from VotingQuestions " _
& "where QuestionID = " & Request.QueryString("QuestionID"))
'用户进行了投票
elseif not isempty(Request.Form("Vote")) then
'连接系统数据库
set conn = server.createobject ("adodb.connection")
conn.open "ASPData", "sa", "yourpassword"
'查询出投票问题的具体内容
set RSQuestion = conn.Execute("Select SenderName, Subject, Question, VoterNumber from " _
& "VotingQuestions where QuestionID = " & Request.Form("QuestionID"))
'更新投票问题的投票结果
conn.Execute "update VotingVotes set Vote = '" & Request.Form("VoteResponse") _
& "' where QuestionID = " & Request.Form("QuestionID") & " and VoterID = '" _
& Request.Form("VoterID") &"'"
Response.write "update VotingVotes set Vote = '" & Request.Form("VoteResponse") _
& "' where QuestionID = " & Request.Form("QuestionID") & " and VoterID = '" _
& Request.Form("VoterID") &"'"
set RSVoteSender=conn.Execute("select SenderName from VotingQuestions " _
& "where QuestionID="&Request.Form("QuestionID"))
set RSResultsTo = conn.Execute("select EmailAddress from PSLogins where Name='" _
& RSVoteSender("SenderName") & "'")
set RSYesVotes = conn.Execute("SELECT COUNT(VoterID) AS VoteYes FROM VotingVotes " _
& "WHERE QuestionID = " & Request.Form("QuestionID") & " AND Vote = 'Yes'")
set RSNoVotes = conn.Execute("SELECT COUNT(VoterID) AS VoteNo FROM VotingVotes " _
& "WHERE QuestionID = " & Request.Form("QuestionID") & " AND Vote = 'No'")
set RSUnknownVotes = conn.Execute("SELECT COUNT(VoterID) AS VoteUnknown FROM VotingVotes " _
& "WHERE QuestionID = " & Request.Form("QuestionID") & " AND Vote = 'Unknown'")
HaveVote=RSYesVotes("VoteYes")+ RSNoVotes("VoteNo")+ RSUnknownVotes("VoteUnknown")
EmailMessage = "您发布的投票现在有了新结果了! 下面是最新的结果: " & chr(13)
EmailMessage = EmailMessage & "投票问题ID: " & Request.Form("QuestionID") & chr(13)
EmailMessage = EmailMessage & "投票问题题目: " & RSQuestion("Subject") & chr(13)
EmailMessage = EmailMessage & "投票问题内容: " & RSQuestion("Question") & chr(13)
EmailMessage = EmailMessage & "总共应投票人数: " & RSQuestion("VoterNumber") & chr(13)
EmailMessage = EmailMessage & "现已投票人数 " & CStr(HaveVote) & chr(13)
EmailMessage = EmailMessage & "是: " & RSYesVotes("VoteYes") & chr(13)
EmailMessage = EmailMessage & "否: " & RSNoVotes("VoteNo") & chr(13)
EmailMessage = EmailMessage & "说不清: " & RSUnknownVotes("VoteUnknown") & chr(13)
	
set objMail = CreateObject("CDONTS.NewMail")
objMail.Send Session("EmailAddress"), RSResultsTo("EmailAddress"), _
"最新的投票结果",cstr(EmailMessage)
set objmail = nothing
Response.Redirect "Voting.asp"

else
Response.Redirect "Voting.asp"
end if
%>



<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">&nbsp;</td>
  </tr>
</table>
<br>

<table width=800 border=0 bgcolor=#164DA8 cellspacing=1 cellpadding=2 align=center>
<tr><td colspan=3>
<font color=white><P ALIGN="CENTER">公司内部办公信息管理系统->内部信息交流系统->进行投票&nbsp[当前用户-<% response.write Session("Name") %>]
</font></td></tr>
<font size="2"><tr bgcolor=white ></font> 
<td  align=left><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=javascript:parent.close();><font color="#104DAD">退出投票页面</font></a></font></td>
<table width="800" border="0" bordercolor="#164DA8" align="center" cellpadding="0" cellspacing="0">
<tr>
    <td height="13">&nbsp;</td>
  </tr></table>
<br>


<TABLE CELLPADDING=1 CELLSPACING=2 BORDER=1 bordercolor="#164DA8" WIDTH=800 align=center>   
<TR VALIGN="center" ALIGN="center">
<TD WIDTH=35% bgcolor=#B5C7EF>
<img src="../image/MessageBoard1.jpg"></td>
<td valign=top>
<table width=100% border=0 bgcolor=#B5C7EF cellspacing=1 cellpadding=2>
<form action="ToVote.asp"  method=post>
  
  <INPUT TYPE=HIDDEN NAME="QuestionID" VALUE = "<% response.write Request.QueryString("QuestionID") %>">
  <INPUT TYPE=Hidden NAME="VoterID" VALUE = "<% response.write Request.QueryString("VoterID") %>">
  
  <tr><td colspan=2 height=30 align=center>本次投票详细信息</td></tr>
<tr bgcolor=white><td width=35% height=30>投票问题ID</td><td><% response.write Request.QueryString("QuestionID") %></td></tr>
<tr bgcolor=white><td height=30>举办投票者姓名</td><td><% response.write RSQuestion("SenderName") %></td></tr>
<tr bgcolor=white><td height=30>投票者ID</td><td><% response.write Request.QueryString("VoterID") %></td></tr>
<tr bgcolor=white><td height=30>投票问题的内容</td><td>
<table bgcolor=black width=100% cellspacing=1 cellpadding=2>
<tr bgcolor=white><td><% response.write RSQuestion("Question") %></td></td></table>
</td></tr>
<tr bgcolor=white><td height=30>投票选项</td><td>
<SELECT NAME="VoteResponse" >
<OPTION VALUE="Yes" SELECTED>&nbsp&nbsp&nbsp 是 &nbsp&nbsp&nbsp</OPTION>
<OPTION VALUE="No">&nbsp&nbsp&nbsp 否 &nbsp&nbsp&nbsp</OPTION>
<OPTION VALUE="Unknown">&nbsp&nbsp说不清&nbsp&nbsp</OPTION></SELECT>
</td></tr>
<tr bgcolor=white><td colspan=2 align=center>请注意,您只能有一次投票机会。</td></tr>
<tr bgcolor=white><td colspan=2 align=center><INPUT TYPE="submit" NAME="Vote" VALUE="进行投票"  style="border: 1px solid #3466BB; background-color: #B6CAEB; color: #3466BB"></td></tr>
</form>
</table>
</td></tr></table>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -