www.gusucode.com > 全球营销软件站整站源码4月最新数据 4.0源码程序 > 801wyxqf\adminadmin\sys\admin_vote.asp

    <!--#include file="../../conn.asp"-->
<!--#include file="../inc/setup.asp"-->
<!--#include file="../inc/const.asp"-->
<!--#include file="../inc/check.asp"-->
<%
Admin_header
'=====================================================================
' 软件名称:801w软件代理系统
' 当前版本:801wAsp 801w cn 801w com
' 文件名称:admin_main.asp
' 更新日期:2010-2-16
' 官方网站:801w代理系统(www.801w.cn www.801w.com) QQ:274667447
'=====================================================================
' Copyright 2003-2010 801w.cn - All Rights Reserved.
' 801wasp is a trademark of 801w.cn
'=====================================================================
%>
<table class="table1" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<td class="tableline linetitle" width="100" align="left">投票管理</td>
		<td class="tableline" width="*" align="right"><a href="admin_setting.asp">基本设置</a>
			 - <a href="admin_vote.asp">投票管理</a>
			 - <a href="admin_vote.asp?action=add">添加投票</a>
			 - <a href="admin_link.asp">友情连接管理</a>
			 - <a href="admin_channel.asp">频道管理</a>
			 - <a href="admin_maillist.asp?action=mail">发送邮件</a>
			 - <a href="admin_lockip.asp">IP限制</a>
		</td>
	</tr>
</table>
<%
Dim maxperpage,totalrec,Pcount,pagelinks,pagenow,count
Dim Action,VoteArry,SQLQuery,voteidlist

Action = LCase(Request("action"))
If Not ChkAdmin("Vote") Then
	Call Transfer_error()
End If
Select Case Trim(Action)
Case "add"
	Call addVote()
Case "edit"
	Call editVote()
Case "del"
	Call delVote()
Case "savenew"
	Call savenew()
Case "savedit"
	Call savedit()
Case Else
	Call showmain()
End Select
If FoundErr = True Then
	ReturnError(ErrMsg)
End If
Admin_footer
SaveLogInfo(AdminName)
NewAsp.PageEnd

Sub showmain()
	voteidlist=NewAsp.CheckIDlist(Request("selVoteid"))
	Dim i,iCount,lCount
	iCount=2:lCount=2
	maxperpage = 30 '###每页显示数
	count=NewAsp.ChkNumeric(Request("count"))
	pagenow=NewAsp.ChkNumeric(Request("page"))
	If pagenow=0 Then pagenow=1
	If voteidlist<>"0" And ""<>voteidlist Then
		Select Case LCase(Trim(Request("stype")))
			Case "del"
				Call delVote()
			Case "islock"
				Call isLock()
			Case "nolock"
				Call noLock()
			Case "radio"
				Call setRadio()
			Case "checkbox"
				Call setCheckbox()
			Case Else
				Response.Write "无效参数!"
				Response.End
		End Select
	End If
%>
<form name="selform" method="post" action="">
<table id="tablehovered" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
<tr>
	<th width="5%" nowrap>选择</th>
	<th width="60%">投票主题</th>
	<th width="10%">投 票 数</th>
	<th width="10%">编辑投票</th>
	<th width="10%">投票类型</th>
	<th width="5%">状 态</th>
</tr>
<tr>
	<td class="tablerow1" colspan="6" align="left" id="showNextPage">&nbsp;</td>
</tr>
<%
	Call showVotelist()
	If IsArray(VoteArry) Then
		For i=0 To Ubound(VoteArry,2)
			If Not Response.IsClientConnected Then Response.End
			If (i mod 2) = 0 Then
				iCount=2:lCount=1
			Else
				iCount=1:lCount=2
			End If
%>
<tr align="center">
	<td class="tablerow<%=iCount%> hovered"><input type="checkbox" name="selVoteid" value="<%=VoteArry(0,i)%>"></td>
	<td class="tablerow<%=iCount%> hovered" align="left"><a href="../../vote/vote.htm" title="查看投票" target="_blank"><%=Server.HTMLEncode(VoteArry(1,i))%></a></td>
	<td class="tablerow<%=iCount%> hovered"><font color="red"><%=VoteArry(3,i)%></font></td>
	<td class="tablerow<%=iCount%> hovered"><a href="?action=edit&id=<%=VoteArry(0,i)%>"><u>编辑投票</u></a></td>
	<td class="tablerow<%=iCount%> hovered">
	<%
			If CLng(VoteArry(2,i)) = 0 Then
				Response.Write "单选"
			Else
				Response.Write "<font color=""red"">多选</font>"
			End If
	%>
	</td>
	<td class="tablerow<%=iCount%> hovered">
	<%
			If CLng(VoteArry(4,i)) = 1 Then
				Response.Write "<font color=""red"">锁定</font>"
			Else
				Response.Write "<font color=""blue"">正常</font>"
			End If
	%>
	</td>
</tr>
<%
		Next
	End If
%>
<tr>
	<td class="tablerow<%=lCount%>" colspan="6">
	<input class="button" type="button" name="chkall" value="全选" onClick="CheckAll(this.form)"><input class="button" type="button" name="chksel" value="反选" onClick="ContraSel(this.form)">
	<input type="radio" name="stype" value="del" title="批量删除选中的投票">批量删除
	<input type="radio" name="stype" value="isLock" title="批量锁定投票" checked>锁定
	<input type="radio" name="stype" value="noLock" title="批量解除锁定">解锁
	<input type="radio" name="stype" value="radio" title="批量设置单选投票">设置单选
	<input type="radio" name="stype" value="checkbox" title="批量设置多选投票">设置多选
	<input class="button" type="submit" name="submit_button" value="执行操作" onclick="{if(confirm('您确定执行此操作吗?')){return true;}return false;}">
	<input class="button" type="button" name="new_button" value="增加新投票" onclick="location.href='admin_vote.asp?action=add';"></td>
</tr>
<tr>
	<td class="tablerow<%=iCount%>" colspan="6" id="NextPageText"><var class="morePage"><%=showlistpage(pagenow,Pcount,maxperpage,totalrec,pagelinks)%></var></td>
</tr>
</table>
</form>
<script type="text/javascript">
document.getElementById("showNextPage").innerHTML = document.getElementById("NextPageText").innerHTML;
</script>
<%
	VoteArry=Null
End Sub

Sub showVotelist()
	Dim Rs,SQL,showmode
	
	If Len(Request("showmode")&"")>0 Then
		showmode=NewAsp.ChkNumeric(Request("showmode"))
		If showmode=1 Then
			SQLQuery="WHERE VoteType=1"
		Else
			SQLQuery="WHERE VoteType=0"
		End If
	Else
		SQLQuery=""
	End If
	
	If count=0 Then
		totalrec=NewAsp.Execute("SELECT COUNT(*) FROM [NC_Vote] "&SQLQuery)(0)
	Else
		totalrec=count
	End If
	Pcount = CLng(totalrec / maxperpage)
	If Pcount < totalrec / maxperpage Then Pcount = Pcount + 1
	If pagenow>Pcount Then pagenow=1
	pagelinks="?showmode="&Request("showmode")&"&count="&totalrec&"&"
	Set Rs=NewAsp.CreateAXObject("ADODB.Recordset")
	SQL = "SELECT id,topic,VoteType,VoteNum,isLock FROM [NC_Vote] "&SQLQuery&" ORDER BY id DESC"
	Rs.Open SQL,Conn,1,1
	If pagenow >1 Then
		Rs.Move (pagenow-1) * maxperpage
	End If
	If Not (Rs.BOF And Rs.EOF) Then
		VoteArry=Rs.GetRows(maxperpage)
	Else
		VoteArry=Null
	End If
	Rs.close()
	Set Rs=Nothing
End Sub

Sub addVote()
%>
<form name="myform" method="post" action="?action=savenew">
<table border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
<tr>
	<th colspan="2">增加投票</th>
</tr>
<tr>
	<td class="tablerow1" width="25%" align="right"><b>投票类型:</b></td>
	<td class="tablerow1" width="75%">
		<input title="设置单选投票" type="radio" name="VoteType" value="0" checked> 单选&nbsp;&nbsp;
		<input title="设置多选投票" type="radio" name="VoteType" value="1"> 多选
	</td>
</tr>
<tr>
	<td class="tablerow2" align="right"><b>投票主题:</b></td>
	<td class="tablerow2"><input type="text" name="topic" size="60" value="我的投票"></td>
</tr>
<tr>
	<td class="tablerow1" align="right"><b>投票选项一:</b></td>
	<td class="tablerow1"><input type="text" name="Choose_1" size="20">
	投票数:<input type="text" name="ChooseNum_1" size="10" value="0"></td>
</tr>
<tr>
	<td class="tablerow2" align="right"><b>投票选项二:</b></td>
	<td class="tablerow2"><input type="text" name="Choose_2" size="20">
	投票数:<input type="text" name="ChooseNum_2" size="10" value="0"></td>
</tr>
<tr>
	<td class="tablerow1" align="right"><b>投票选项三:</b></td>
	<td class="tablerow1"><input type="text" name="Choose_3" size="20">
	投票数:<input type="text" name="ChooseNum_3" size="10" value="0"></td>
</tr>
<tr>
	<td class="tablerow2" align="right"><b>投票选项四:</b></td>
	<td class="tablerow2"><input type="text" name="Choose_4" size="20">
	投票数:<input type="text" name="ChooseNum_4" size="10" value="0"></td>
</tr>
<tr>
	<td class="tablerow1" align="right"><b>投票选项五:</b></td>
	<td class="tablerow1"><input type="text" name="Choose_5" size="20">
	投票数:<input type="text" name="ChooseNum_5" size="10" value="0"></td>
</tr>
<tr>
	<td class="tablerow2" align="right"><b>背景颜色:</b></td>
	<td class="tablerow2"><input type="text" name="bgcolor" size="10" value="FFFFFF">
	如:FFFFFF 不用加“<font color="#FF3300">#</font>”
	</td>
</tr>
<tr>
	<td class="tablerow1" align="right"><b>字体颜色:</b></td>
	<td class="tablerow1"><input type="text" name="FontColor" size="10" value="000000">
	如:000000 不用加“<font color="#FF3300">#</font>”</td>
</tr>
<tr>
	<td class="tablerow2" align="right"><b>字体大小:</b></td>
	<td class="tablerow2"><input type="text" name="FontSize" size="10" value="12">
	单位px 如:这是12px <span style="font-size:14px">这是14px</span>,只输入数字</td>
</tr>
<tr>
	<td class="tablerow1" align="right"><b>总投票数:</b></td>
	<td class="tablerow1"><input type="text" name="VoteNum" size="10" value="0"></td>
</tr>
<tr>
	<td class="tablerow2" align="right"><b>是否锁定:</b></td>
	<td class="tablerow2">
		<input type="radio" name="isLock" value="0" checked> 否&nbsp;&nbsp;
		<input type="radio" name="isLock" value="1"> 是
	</td>
</tr>
<tr>
	<td class="tablerow1" align="right"><b>&nbsp;</b></td>
	<td class="tablerow1"><input type="reset" name="reset_button" value="清 除" class="button">&nbsp;&nbsp;<input type="submit" name="submit_button" value="保存设置" class="button"></td>
</tr>
</table>
</form>
<%
End Sub

Sub editVote()
	Dim Rs,SQL
	SQL="SELECT * FROM [NC_Vote] WHERE id=" & NewAsp.ChkNumeric(Request("id"))
	Set Rs = NewAsp.Execute(SQL)
	If Rs.BOF And Rs.EOF Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>错误的系统参数!</li>"
		Set Rs = Nothing
		Exit Sub
	End If
%>
<form name="myform" method="post" action="?action=savedit">
<input type="hidden" name="id" value="<%=Rs("id")%>">
<table border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
<tr>
	<th colspan="2">添加友情连接</th>
</tr>
<tr>
	<td class="tablerow1" width="25%" align="right"><b>投票类型:</b></td>
	<td class="tablerow1" width="75%">
		<input title="设置单选投票" type="radio" name="VoteType" value="0"<%If Rs("VoteType")=0 Then Response.Write " checked"%>> 单选&nbsp;&nbsp;
		<input title="设置多选投票" type="radio" name="VoteType" value="1"<%If Rs("VoteType")=1 Then Response.Write " checked"%>> 多选
	</td>
</tr>
<tr>
	<td class="tablerow2" align="right"><b>投票主题:</b></td>
	<td class="tablerow2"><input type="text" name="topic" size="60" value="<%=Server.HTMLEncode(Rs("topic")&"")%>"></td>
</tr>
<tr>
	<td class="tablerow1" align="right"><b>投票选项一:</b></td>
	<td class="tablerow1"><input type="text" name="Choose_1" size="20" value="<%=Server.HTMLEncode(Rs("Choose_1")&"")%>">
	投票数:<input type="text" name="ChooseNum_1" size="10" value="<%=Rs("ChooseNum_1")%>"></td>
</tr>
<tr>
	<td class="tablerow2" align="right"><b>投票选项二:</b></td>
	<td class="tablerow2"><input type="text" name="Choose_2" size="20" value="<%=Server.HTMLEncode(Rs("Choose_2")&"")%>">
	投票数:<input type="text" name="ChooseNum_2" size="10" value="<%=Rs("ChooseNum_2")%>"></td>
</tr>
<tr>
	<td class="tablerow1" align="right"><b>投票选项三:</b></td>
	<td class="tablerow1"><input type="text" name="Choose_3" size="20" value="<%=Server.HTMLEncode(Rs("Choose_3")&"")%>">
	投票数:<input type="text" name="ChooseNum_3" size="10" value="<%=Rs("ChooseNum_3")%>"></td>
</tr>
<tr>
	<td class="tablerow2" align="right"><b>投票选项四:</b></td>
	<td class="tablerow2"><input type="text" name="Choose_4" size="20" value="<%=Server.HTMLEncode(Rs("Choose_4")&"")%>">
	投票数:<input type="text" name="ChooseNum_4" size="10" value="<%=Rs("ChooseNum_4")%>"></td>
</tr>
<tr>
	<td class="tablerow1" align="right"><b>投票选项五:</b></td>
	<td class="tablerow1"><input type="text" name="Choose_5" size="20" value="<%=Server.HTMLEncode(Rs("Choose_5")&"")%>">
	投票数:<input type="text" name="ChooseNum_5" size="10" value="<%=Rs("ChooseNum_5")%>"></td>
</tr>
<tr>
	<td class="tablerow2" align="right"><b>背景颜色:</b></td>
	<td class="tablerow2"><input type="text" name="bgcolor" size="10" value="<%=Rs("bgcolor")%>">
	如:FFFFFF 不用加“<font color="#FF3300">#</font>”
	</td>
</tr>
<tr>
	<td class="tablerow1" align="right"><b>字体颜色:</b></td>
	<td class="tablerow1"><input type="text" name="FontColor" size="10" value="<%=Rs("FontColor")%>">
	如:000000 不用加“<font color="#FF3300">#</font>”</td>
</tr>
<tr>
	<td class="tablerow2" align="right"><b>字体大小:</b></td>
	<td class="tablerow2"><input type="text" name="FontSize" size="10" value="<%=Rs("FontSize")%>">
	单位px 如:这是12px <span style="font-size:14px">这是14px</span>,只输入数字</td>
</tr>
<tr>
	<td class="tablerow1" align="right"><b>总投票数:</b></td>
	<td class="tablerow1"><input type="text" name="VoteNum" size="10" value="<%=Rs("VoteNum")%>"></td>
</tr>
<tr>
	<td class="tablerow2" align="right"><b>是否锁定:</b></td>
	<td class="tablerow2">
		<input type="radio" name="isLock" value="0"<%If Rs("isLock")=0 Then Response.Write " checked"%>> 否&nbsp;&nbsp;
		<input type="radio" name="isLock" value="1"<%If Rs("isLock")=1 Then Response.Write " checked"%>> 是
	</td>
</tr>
<tr>
	<td class="tablerow1" align="right"><b>&nbsp;</b></td>
	<td class="tablerow1"><input type="reset" name="reset_button" value="清 除" class="button">&nbsp;&nbsp;<input type="submit" name="submit_button" value="保存设置" class="button"></td>
</tr>
</table>
</form>
<%
	Rs.Close:Set Rs=Nothing
End Sub

Sub savenew()
	Dim Rs,SQL
	'保存新的投票
	If Trim(Request.Form("topic")) = "" Then
		Founderr = True
		ErrMsg = ErrMsg + "<li>投票主题不能为空!</li>"
		Exit Sub
	End If
	If Founderr = False Then
		Set Rs=NewAsp.CreateAXObject("ADODB.Recordset")
		SQL="SELECT * FROM NC_Vote WHERE (id is null)"
		Rs.Open SQL, Conn, 1, 3
		Rs.addnew
		Rs("Topic") = Trim(Request.Form("Topic"))
		Rs("Choose_1") = Trim(Request.Form("Choose_1"))
		Rs("Choose_2") = Trim(Request.Form("Choose_2"))
		Rs("Choose_3") = Trim(Request.Form("Choose_3"))
		Rs("Choose_4") = Trim(Request.Form("Choose_4"))
		Rs("Choose_5") = Trim(Request.Form("Choose_5"))
		Rs("ChooseNum_1") = NewAsp.ChkNumeric(Request.Form("ChooseNum_1"))
		Rs("ChooseNum_2") = NewAsp.ChkNumeric(Request.Form("ChooseNum_2"))
		Rs("ChooseNum_3") = NewAsp.ChkNumeric(Request.Form("ChooseNum_3"))
		Rs("ChooseNum_4") = NewAsp.ChkNumeric(Request.Form("ChooseNum_4"))
		Rs("ChooseNum_5") = NewAsp.ChkNumeric(Request.Form("ChooseNum_5"))
		Rs("isLock") = NewAsp.ChkNumeric(Request.Form("isLock"))
		Rs("bgcolor") = Trim(Request.Form("bgcolor"))
		Rs("FontColor") = Trim(Request.Form("FontColor"))
		Rs("FontSize") = Trim(Request.Form("FontSize"))
		Rs("VoteTime") = Now()
		Rs("VoteNum") = NewAsp.ChkNumeric(Request.Form("VoteNum"))
		Rs("VoteType") = NewAsp.ChkNumeric(Request.Form("VoteType"))
		Rs("ChannelID") = 0
		Rs.Update
		Rs.Close
		Set Rs = Nothing
		Succeed ("<li>添加" & Request.Form("topic") & "成功!</li>")
	End If
End Sub

Sub savedit()
	Dim Rs,SQL
	'修改投票
	If Trim(Request.Form("topic")) = "" Then
		Founderr = True
		ErrMsg = ErrMsg + "<li>投票主题不能为空!</li>"
		Exit Sub
	End If
	If Founderr = False Then
		Set Rs = Server.CreateObject("ADODB.Recordset")
		SQL = "SELECT * FROM NC_Vote WHERE id=" & NewAsp.ChkNumeric(Request.Form("id"))
		Rs.Open SQL, Conn, 1, 3
		Rs("Topic") = Trim(Request.Form("Topic"))
		Rs("Choose_1") = Trim(Request.Form("Choose_1"))
		Rs("Choose_2") = Trim(Request.Form("Choose_2"))
		Rs("Choose_3") = Trim(Request.Form("Choose_3"))
		Rs("Choose_4") = Trim(Request.Form("Choose_4"))
		Rs("Choose_5") = Trim(Request.Form("Choose_5"))
		Rs("ChooseNum_1") = NewAsp.ChkNumeric(Request.Form("ChooseNum_1"))
		Rs("ChooseNum_2") = NewAsp.ChkNumeric(Request.Form("ChooseNum_2"))
		Rs("ChooseNum_3") = NewAsp.ChkNumeric(Request.Form("ChooseNum_3"))
		Rs("ChooseNum_4") = NewAsp.ChkNumeric(Request.Form("ChooseNum_4"))
		Rs("ChooseNum_5") = NewAsp.ChkNumeric(Request.Form("ChooseNum_5"))
		Rs("isLock") = NewAsp.ChkNumeric(Request.Form("isLock"))
		Rs("bgcolor") = Trim(Request.Form("bgcolor"))
		Rs("FontColor") = Trim(Request.Form("FontColor"))
		Rs("FontSize") = Trim(Request.Form("FontSize"))
		Rs("VoteNum") = NewAsp.ChkNumeric(Request.Form("VoteNum"))
		Rs("VoteType") = NewAsp.ChkNumeric(Request.Form("VoteType"))
		'Rs("ChannelID") = 0
		Rs.Update
		Rs.Close
		Set Rs = Nothing
		Succeed ("<li>修改" & Request.Form("topic") & "成功!</li>")
	End If
End Sub

Sub delVote()
	'删除投票
	NewAsp.Execute ("DELETE FROM NC_Vote WHERE id in (" & voteidlist & ")")
End Sub

Sub isLock()
	'锁定投票
	NewAsp.Execute ("UPDATE NC_Vote SET isLock=1 WHERE id in (" & voteidlist & ")")
End Sub ' islock

Sub noLock()
	'解除锁定
	NewAsp.Execute ("UPDATE NC_Vote SET isLock=0 WHERE id in (" & voteidlist & ")")
End Sub

Sub setRadio()
	'设置单选投票
	NewAsp.Execute ("UPDATE NC_Vote SET VoteType=0 WHERE id in (" & voteidlist & ")")
End Sub

Sub setCheckbox()
	'设置多选投票
	NewAsp.Execute ("UPDATE NC_Vote set VoteType=1 WHERE id in (" & voteidlist & ")")
End Sub
%>