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

📄 showvote.asp

📁 本文件为利用ASP开发的管理信息系统项目,文件名为校友录,按照说明"校友录系统_数据表创建方法"来进行数据表的创建.
💻 ASP
字号:
<%@ Language=VBScript %>
<%if not session("user_session_id")=Session.SessionID then%>
<SCRIPT LANGUAGE=javascript>
 parent.window.location.href="default.asp"
</SCRIPT>
<%end if%>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<title>校友录-投票调查</title>
<LINK href="style/style.css" type=text/css rel=stylesheet>
<style TYPE="text/css"> 
<!-- 
 .popcomments 
{ 
position : absolute; width:130;
visibility : hidden; 
border: 1 solid #000001
} 
.in 
{
BORDER-RIGHT: rgb(127,127,127) 1px solid;
BORDER-TOP: rgb(127,127,127) 1px solid;
 FONT-SIZE: 9pt; 
 BORDER-LEFT: rgb(127,127,127) 1px solid; 
 BORDER-BOTTOM: rgb(127,127,127) 1px solid;
 BACKGROUND-COLOR: #ffffff
}
//--> 
</style> 
</HEAD>
<%
sname=session("ecid") 
%>
<BODY leftMargin=0 topMargin=0 onkeydown="javascript:if(event.keyCode==13 && event.ctrlKey && forumcheck()){window.document.form1.submit();}">
<script>
function openScript(url, width, height){
	var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=no' );
}
function check(){
if(window.document.form1.content.value=='')
{
alert('请留言!');
window.document.form1.content.focus();
return false;
}
document.form1.submit()
}

</script>
<%
If Request.Form ("b1")<>"" and Request.QueryString ("action")="vote" Then

voteid=Cint(Request.Form ("voteid"))
sql="select ecid from voteuser where ecid='"&Request.Cookies ("ecid")&"' and id="&voteid
Set voteuserrst=cn.execute (sql)
if not voteuserrst.eof Then     '已经投票过的,不能在投票
 Response.Write "<script>"
 Response.Write "alert('对不起,您已经对该调查投过票,你不能再次对它投票!!');"&vbcrlf
 Response.Write "window.location.href='showvote.asp?id="&voteid&"';"
 Response.Write "</script>"
 Response.End 
end if
voteuserrst.close
set voteuserrst=nothing
sql="insert into voteuser (id,ecid) values("&voteid&",'"&Request.Cookies ("ecid")&"')"
cn.execute (sql)
 
 itemnum= Request.Form ("item")
 sql="update vote set intitem"&itemnum&"=intitem"&itemnum&"+1 where id="&voteid

 cn.execute (sql)
 
 Response.Redirect  "showvote.asp?id="&voteid
 Response.End 
End If

If Request.Form ("content")<>""  Then
 function sort(data)
  sort=Replace(data,"'","''")
 end function
 dim content
 voteid=Cint(Request.Form ("voteid"))
 content=Trim(Request.Form ("content"))
 content=Replace(content,"<","&lt;")
 content=Replace(content,">","&gt;")
 content=Sort(Replace(content,VBCrlf,"<br>"))
 
 sql="update vote set forumnum=forumnum+1,lastedforumtime='"&now()&"',lastedforumuser='"
 sql=sql&Request.Cookies ("sname")&"',lastedforumcontent='"&content&"' where id="& voteid
 cn.execute (sql)
 
 sql="insert into voteforum (username,voteid,content,pubtime) values('"
 sql=sql&sname&"',"&voteid&",'"&content&"','"&now()&"')"
 cn.execute (sql)
 
  Response.Redirect  "showvote.asp?id="&voteid&"&curpage=50"
   Response.End 
End If
%>
<!--#include file="inc/TOP.ASP" -->
<table width=500 border=0 align="center" cellpadding=0 cellspacing=0>
  <tr>
    <td valign=top width=100 rowspan="5">  </td>
    <td height="13" colspan="2">
      <%
    dim id,voterst,totalvote,item1,item2,item3,item4,intitem1,intitem2,intitem3,intitem4
    id=Request("id")
    if not isnumeric(id) Then Response.Redirect "vote.asp":Response.End 
    id=Cint(id)
    sql="update vote set clicknum=clicknum+1 where id="&id
    session("cn").execute (sql)
    sql="select vote.*,ec.sname from vote,ec where id="&id&" and ec.studentid=vote.voteuser"
    Set voterst=Server.CreateObject ("ADODB.Recordset")
    voterst.Open sql,session("cn")
    if voterst.EOF Then Response.Redirect "vote.asp":Response.End  
    totalvote=voterst("intitem1")+voterst("intitem2")+voterst("intitem3")+voterst("intitem4")
    item1=voterst("item1")
    item2=voterst("item2")
    item3=voterst("item3")
    item4=voterst("item4")
    
    intitem1=voterst("intitem1")
    intitem2=voterst("intitem2")
    intitem3=voterst("intitem3")
    intitem4=voterst("intitem4")

     %>
    </td>
    <td height="13" align="center">&nbsp;</td>
  </tr>
  <tr> 
    <td height="13" colspan="2">
    <font size="2">
    <a href="javascript:;" onClick="javascript:openScript('newvote.asp',400,400)">
    <font size="3"><b> 
      发布新调查投票</b></font></a></font></td>
    <td height="13" align="center">
    <a href="vote.asp"><font size="3"></font></a></td>
  </tr>
  <tr> 
    <td height="30" width="78">
    <font size="2">调查标题:</font></td>
    <td height="30" width="328">
    <font size="2"><%=voterst("title")%></font></td>
    <td height="30" width="124">
    <font size="2">总票数:<%=totalvote%>票</font></td>
  </tr>
  <tr> 
    <td height="30" colspan="3">
    <font size="2"><%=voterst("content")%></font></td>
  </tr>
  <tr align="center"> 
    <td height="571" valign=top colspan="3"> 
    <form name="form2" method="post" action="showvote.asp?action=vote">
        <input type=hidden name=voteid value=<%=id%>>
        <table width="60%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000099">
          <%
        if not item1="" then
        dim width
        if intitem1=0 then 
          width=0
        else
         width=(intitem1/totalvote)*200
        end if
        
        %>
          <tr bgcolor="#FFFFFF"> 
            <td height="17">
             <input type="radio" name="item" value="1" checked> 
              <%=item1%></td>
           
            <td width="111" height="17" valign=top>得票数:<%=intitem1%>票</td>
          </tr>
          <%
          end if
          if not item2="" then
			 if intitem2=0 then 
				width=0
			 else
				width=(intitem2/totalvote) *200
             end if
          %>
          <tr bgcolor="#FFFFFF"> 
            <td height="17"> 
            <input type="radio" name="item" value="2"> <%=item2%></td>
           
            <td width="111" height="17" valign=top>得票数:<%=intitem2%>票</td>
          </tr>
          <%
          end if
           if not item3="" then
			 if intitem3=0 then 
				width=0
			 else
				width=(intitem3/totalvote) *200
             end if%>
          <tr bgcolor="#FFFFFF"> 
            <td height="17"> 
            <input type="radio" name="item" value="3"> <%=item3%></td>
            
            <td width="111" height="17" valign=top>得票数:<%=intitem3%>票</td>
          </tr>
          <%end if
          if not item4="" then
			 if intitem4=0 then 
				width=0
			 else
				width=(intitem4/totalvote) *200
             end if%>
          <tr bgcolor="#FFFFFF"> 
            <td height="17"> 
            <input type="radio" name="item" value="4"> <%=item4%></td>
           
            <td width="111" height="17" valign=top>得票数:<%=intitem4%>票</td>
          </tr>
          <%end if
          if not item5="" then
			 if intitem5=0 then 
				width=0
			 else
				width=(intitem5/totalvote) *200
             end if%>
          <tr bgcolor="#FFFFFF"> 
            <td height="17">
             <input type="radio" name="item" value="5" class=in> <%=item5%></td>
            
            <td width="111" height="17" valign=top>得票数:<%=intitem5%>票</td>
          </tr>
          <%end if
         
           %>
          <tr bgcolor="#FFFFFF"> 
            <td height="17" align="center"> 
            <input type="submit" name="b1" value="投票" class=in> </td>
            
            <td width="111" height="17" align="center">
            <a href="delvote.asp?id=<%=id%>"  onClick="return confirm('删除这个调查主题和所有关于该主题的帖子确认吗?')">
            删除</a></td>
          </tr>
        </table>
      </form>
      <%
       voterst.Close 
       set voterst=nothing
      sql="select voteforum.*,ec.sname,ec.pic from voteforum,ec where voteid="&id&" and ec.studentid=voteforum.username  order by pubtime asc"  
      Set voteforumrst=Server.CreateObject ("ADODB.Recordset")
      voteforumrst.Open sql,session("cn"),1
      if voteforumrst.EOF Then 
      else 
      const pagesize=6
      voteforumrst.PageSize =pagesize
      curpage=Request("curpage")
      if curpage="" or not isnumeric(curpage) Then 
	        curpage=1
      end if
      curpage=Cint(curpage)
     if curpage>voteforumrst.PageCount  Then 
	 curpage=voteforumrst.PageCount
     end if      
      voteforumrst.AbsolutePage =curpage
      %>
      <table  cellspacing=0 bordercolordark=#006699 
      cellpadding=0 width=100% bordercolorlight=#99ccff border=0>
        <tr > 
          <td align="right" > 
            <%if curpage<>1 then%>
            <A  href="showvote.asp?curpage=1&id=<%=id%>" title="转到最前页">
            <font face="webdings" color="#0033FF">9</font></A> 
            <%else%>
            <font face="webdings" color=red title="目前是首页" class=good>9</font> 
            <%end if%>
            <%for i=1 to voteforumrst.PageCount %>
            <%if curpage<>i then%>
            <a href="showvote.asp?curpage=<%=i%>&id=<%=id%>" title="转到第<%=i%>页"><%=i%></a> 
            <%else%>
            <font class=good color=red title="当前是第<%=i%>页"><b><%=i%></b></font> 
            <%end if%>
            <%next%>
            <%if curpage<>voteforumrst.PageCount then%>
            <a href="showvote.asp?curpage=<%=voteforumrst.PageCount%>&id=<%=id%>" title="转到最末页">
            <font face="Webdings">  :</font></a> 
            <%else%>
            <font face="Webdings" color=red class=good title="目前是最末页"> :</font> 
            <%end if%>
          </td>
        </tr>
      </table>
      <% 
      i=0
      while not voteforumrst.EOF and i<pagesize
      i=i+1
      %>
      <table  cellspacing=1 bordercolordark=#006699 cellpadding=2 width=100%
 bordercolorlight=#99ccff border=0 bgcolor="#339933">
        <tr bgcolor="#FFFFFF"> 
          <td width="88" align="center">留言人:</td>
          <td width="75" align="center"><b>
          <a href="javascript:openScript('profile.asp?name=<%=voteforumrst("username")%>',420,320)">
          <%=voteforumrst("sname")%></a></b></td>
          <td width="94" align="center">学&nbsp;号:</td>
          <td width="211" align="center"><b><%=voteforumrst("username")%></b></td>
        </tr>
        <tr height="34" bgcolor="#FFFFFF"> 
          <td  width="88" align="center">头&nbsp;像:</td>
          <td  width="75">
          <a href="javascript:openScript('profile.asp?name=<%=voteforumrst("username")%>',420,320)">
          <img src=img/<%=voteforumrst("pic")%>.bmp border=0></a></td>
          <td width="94" align="center">留言时间:</td>
          <td width="211" align="center"><%=voteforumrst("pubtime")%></td>
        </tr>
        <tr height="34" bgcolor="#FFFFFF"> 
          <td colspan="8"><%=voteforumrst("content")%></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td>&nbsp;</td>
        </tr>
      </table>
      <%
      voteforumrst.MoveNext 
      wend
      %>
      <table  cellspacing=0 bordercolordark=#006699 cellpadding=0 
      width=100% bordercolorlight=#99ccff border=0>
        <tr > 
          <td align="right" > 
            <%if curpage<>1 then%>
            <A  href="showvote.asp?curpage=1&id=<%=id%>" title="转到最前页">
            <font face="webdings" color="#0033FF">9</font></A> 
            <%else%>
            <font face="webdings" color=red title="目前是首页" class=good>9</font> 
            <%end if%>
            <%for i=1 to voteforumrst.PageCount %>
            <%if curpage<>i then%>
            <a href="showvote.asp?curpage=<%=i%>&id=<%=id%>" title="转到第<%=i%>页"><%=i%></a> 
            <%else%>
            <font class=good color=red title="当前是第<%=i%>页"><b><%=i%></b></font> 
            <%end if%>
            <%next%>
            <%if curpage<>voteforumrst.PageCount then%>
            <a href="showvote.asp?curpage=<%=voteforumrst.PageCount%>&id=<%=id%>" title="转到最末页">
            <font face="Webdings"> 
            :</font></a> 
            <%else%>
            <font face="Webdings" color=red class=good title="目前是最末页"> :</font> 
            <%end if%>
          </td>
        </tr>
      </table>
      <%
       voteforumrst.Close 
       set voteforumrst=nothing      
       end if
       %>
      <form name="form1" method="post" action="showvote.asp?action=forum" 
      onsubmit="javascript:if(this.content.value==''){alert('请留言!');return false;}">
        <input type=hidden name=voteid value=<%=id%>>
        <input type=hidden name=curpage value=<%=curpage%>>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr align="center"> 
            <td colspan="2">请留言</td>
          </tr>
          <tr align="center"> 
            <td colspan="2"> 
            <textarea name="content" cols="70" rows="8" class=in></textarea> 
            </td>
          </tr>
         
          <tr> 
            <td colspan="2">&nbsp;</td>
          </tr>
        </table>
        <input type="button" name="b2" value="提交" 
        onclick="javascript:check()" class=in>
         </form></td>
  </tr>
</table>
<hr width=600 color=green size=1 align="center">
<P>&nbsp;</P>

</BODY>
</HTML>

⌨️ 快捷键说明

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