?? votingbooth.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") &"'")
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'")
HaveVote=RSYesVotes("VoteYes")+RSNoVotes("VoteNO")
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 & "Yes: " & RSYesVotes("VoteYes") & chr(13)
EmailMEssage = EmailMessage & "No: " & RSNoVotes("VoteNo") & 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"> </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">公司內部辦公信息管理系統->內部信息交流系統->進行投票 [當前用戶-<% 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"> </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="VotingBooth.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>投票者姓名</td><td><% response.write Request.QueryString("VoterName") %></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>    Yes    </OPTION>
<OPTION VALUE="No">    No    </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 + -