?? 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 + -