?? tovote.asp
字號(hào):
<%@ Language=VBScript %>
<%
'判斷用戶是否具有合法的身份第一次鏈接到此頁面
if not isempty(Request.QueryString("QuestionID")) and not isempty(Request.QueryString("VoterID")) then
TheMessage="請(qǐng)?jiān)谙旅孢M(jìn)行投票"
'連接系統(tǒng)數(shù)據(jù)庫
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") &"'")
'驗(yàn)證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"))
'用戶進(jìn)行了投票
elseif not isempty(Request.Form("Vote")) then
'連接系統(tǒng)數(shù)據(jù)庫
set conn = server.createobject ("adodb.connection")
conn.open "ASPData", "sa", "yourpassword"
'查詢出投票問題的具體內(nèi)容
set RSQuestion = conn.Execute("Select SenderName, Subject, Question, VoterNumber from " _
& "VotingQuestions where QuestionID = " & Request.Form("QuestionID"))
'更新投票問題的投票結(jié)果
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 = "您發(fā)布的投票現(xiàn)在有了新結(jié)果了! 下面是最新的結(jié)果: " & chr(13)
EmailMessage = EmailMessage & "投票問題ID: " & Request.Form("QuestionID") & chr(13)
EmailMessage = EmailMessage & "投票問題題目: " & RSQuestion("Subject") & chr(13)
EmailMessage = EmailMessage & "投票問題內(nèi)容: " & RSQuestion("Question") & chr(13)
EmailMessage = EmailMessage & "總共應(yīng)投票人數(shù): " & RSQuestion("VoterNumber") & chr(13)
EmailMessage = EmailMessage & "現(xiàn)已投票人數(shù) " & 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"), _
"最新的投票結(jié)果",cstr(EmailMessage)
set objmail = nothing
Response.Redirect "Voting.asp"
else
Response.Redirect "Voting.asp"
end if
%>
<HTML>
<HEAD>
<TITLE>公司內(nèi)部意見箱-提交意見建議</TITLE>
<META NAME="Generator" CONTENT="NetObjects Fusion 2.0.2 for Windows">
</HEAD>
<body>
<table width=800 border=0 bgcolor=#164DA8 cellspacing=1 cellpadding=2 align=center>
<tr bgcolor=white><td valign=center ><img src="../ASPLogo3.jpg" width=796 height=100></td></tr>
</table>
<table width="800" border="0" bordercolor="#164DA8" align="center" cellpadding="0" cellspacing="0">
<tr><td height="13"><img src=".././image/banner2.jpg" width="800" height="12"></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">公司內(nèi)部辦公信息管理系統(tǒng)->內(nèi)部信息交流系統(tǒng)->進(jìn)行投票 [當(dāng)前用戶-<% response.write Session("Name") %>]
</font></td></tr>
<tr bgcolor=white >
<td align=left><a href=".././html/home.asp"><font color="#104DAD">返回內(nèi)網(wǎng)主頁</font></a></td>
<td align=center> <font color="#104DAD" ><% response.write TheMessage %></FONT></td>
<td align=right><a href=javascript:parent.close();><font color="#104DAD">退出投票頁面</font></a></td>
<table width="800" border="0" bordercolor="#164DA8" align="center" cellpadding="0" cellspacing="0">
<tr><td height="13"><img src=".././image/banner2.jpg" width="800" height="12"></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>本次投票詳細(xì)信息</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>投票問題的內(nèi)容</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>投票選項(xiàng)</td><td>
<SELECT NAME="VoteResponse" >
<OPTION VALUE="Yes" SELECTED>    是    </OPTION>
<OPTION VALUE="No">    否    </OPTION>
<OPTION VALUE="Unknown">  說不清  </OPTION></SELECT>
</td></tr>
<tr bgcolor=white><td colspan=2 align=center>請(qǐng)注意,您只能有一次投票機(jī)會(huì)。</td></tr>
<tr bgcolor=white><td colspan=2 align=center><INPUT TYPE="submit" NAME="Vote" VALUE="進(jìn)行投票" style="border: 1px solid #3466BB; background-color: #B6CAEB; color: #3466BB"></td></tr>
</form>
</table>
</td></tr></table>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -