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

📄 newvote.asp

📁 BBS论坛的开发和设计
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="admin/BBSConfig.asp"-->
<!--#include file="INC/online.asp"-->
<!--#include file="INC/ShowMsg.asp"-->
<!--#include file="INC/header.asp"-->
<!--#include file="INC/Board_Config.asp"-->
<%
'****************************************************************
'*  joinboard BBS Ver2.3.0/友盟论坛 Ver2.3.0
'*
'*  版权所有: JoinBoard V2.3
'*
'*  程序制作: 友盟工作室
'*           
'*  主页地址: http://joinboard.com    友盟论坛
'*
'*  论坛地址: http://bbs.joinboard.com/、http://youmeng.com
'*	                 
'****************************************************************
'*  Powered by: JoinBoard V2.3
'* Copyright 2003-2004.  - All Rights Reserved.
'*  JoinBoard is a trademark of YouMeng Studio.
'****************************************************************

BoardID = trim(request.QueryString("BoardID"))
if Not(IsNumeric(BoardID)) or BoardID = "0" then
	response.Write("<META HTTP-EQUIV='REFRESH' CONTENT='0; URL="&BBSHomeUrl&"'>")
	response.End()
End if
Board_info BoardID
Board_Config = Application(JBBMasterCookies&"Board_Config"&BoardID)
title = Board_Config(2)
if Board_Config(6)=true then styleid = Board_Config(5)
%>
<!--#include file="INC/style.asp"-->
<!--#include file = "INC/CODE.ASP"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="keywords" content="joinboard,forum,bbs,youmeng,友盟论坛">
<title><%=BBS_Config(0)&" - "& Board_Config(2) &" - 发布新投票"%></title>
<link href="<%=Css_path%>" rel="stylesheet" type="text/css">
<script language="javascript">
<!--
function validate(theform) {
	if (theform.title.value=="" ) {
		alert("标题不可为空.");
		theform.title.focus();
		return false; }
	if (theform.pollcon.value=="" ) {
		alert("请输入投票项目.");
		theform.pollcon.focus();
		return false; }
	if (theform.txtcontent.value=="" ) {
		alert("投票说明不可为空.");
		theform.txtcontent.focus();
		return false; }
	if (theform.title.value.length > 50) {
		alert("标题不可超过50字,当前为"+ theform.title.value.length +"字");
		theform.title.focus();
		return false;}
	if (theform.txtcontent.value.length><%=Board_Config(23)%>) {
   		alert("本版块投票说明不可超过<%=Board_Config(23)%>字,当前为"+ theform.txtcontent.value.length +"字");
    	theform.txtcontent.focus();
    	return (false); }
	else { return true; }
}

function insertstr(str)
{document.myform.txtcontent.value=document.myform.txtcontent.value+str;}
//-->
</script>
</head>
<body leftmargin="0" topmargin="0">
<%
Call onlineuser()
call top()

response.Write "<table border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"" class=""path-table"">"
response.Write "<tr><td>"
response.Write "<img src="""& BBS_Skin(3) &"JBB_bullet.gif"">&nbsp;<a href="""&BBSHomeUrl&""">"& BBS_Config(0) &"</a>&nbsp;<img src="""& BBS_Skin(3) &"JBB_bullet.gif"">&nbsp;<a href=""board.asp?BoardID="& BoardID &""">"& Board_Config(2) &"</a>&nbsp;<img src="""& BBS_Skin(3) &"JBB_bullet.gif"">&nbsp;发布新投票"
response.Write "</td></tr></table>"

if Board_Config(17) = True or Board_Config(18) = True then
	if usergroup <= 4 then 
		enter = true
	End if 
else
	enter = true
End if
'-----------------------------------------------
if user_group(16) <> true or enter <> true then
	loginform "对不起,您不可以发布新投票或者您还没有登录,点击 <a href=""javascript:history.back()"">这里</a> 返回"
	Call Bottom()
	response.End
End if
'-----------------------------------------
if DateDiff("s",Session("LastPostTime"),now()) < Board_Config(22) then
	ShowMsg "为防止有人恶意灌水, 管理员设置此版块两次发帖必须有一定的间隔时间, <br>请您等 "& Board_Config(22) - DateDiff("s",Session("LastPostTime"),now()) &" 秒后再发帖,点击 <a href=""javascript:history.back()"">这里</a> 返回"
	Call Bottom()
	response.End()
End if
'-----------------------------------------
action = Trim(Request.QueryString("action"))
select case action
	Case "add"
		Call add()
	Case else
		Call newvote()
End select
'----------------------------------
Sub newvote()	
%>
<br>
<table border="0" align="center" cellpadding="3" cellspacing="1" class="table">
  <form name="myform" method="post" action="?action=add&BoardID=<%=BoardID%>" onSubmit="return validate(this)">
    <tr class="table-title"> 
      <td height="28" colspan="2"> <div align="center">发布新投票</div></td>
    </tr>
    <tr class="table-dark"> 
      <td width="24%"> <div align="right">图标:</div></td>
      <td width="76%"> <input type="radio" value="0" name="icon" checked>
        No&nbsp; <input type="radio" value="1" name="icon"> <img src="images/posticon/icon1.gif" width="15" height="15">&nbsp; 
        <input type="radio" value="2" name="icon"> <img src="images/posticon/icon2.gif" width="15" height="15">&nbsp; 
        <input type="radio" value="3" name="icon"> <img src="images/posticon/icon3.gif" width="15" height="15">&nbsp; 
        <input type="radio" value="4" name="icon"> <img src="images/posticon/icon4.gif">&nbsp; 
        <input type="radio" value="5" name="icon"> <img src="images/posticon/icon5.gif">&nbsp; 
        <input type="radio" value="6" name="icon"> <img src="images/posticon/icon6.gif">&nbsp; 
        <input type="radio" value="7" name="icon"> <img src="images/posticon/icon7.gif">&nbsp; 
        <br> <input type="radio" value="8" name="icon"> <img src="images/posticon/icon8.gif">&nbsp; 
        <input type="radio" value="9" name="icon"> <img src="images/posticon/icon9.gif">&nbsp; 
        <input type="radio" value="10" name="icon"> <img src="images/posticon/icon10.gif">&nbsp; 
        <input type="radio" value="11" name="icon"> <img src="images/posticon/icon11.gif">&nbsp; 
        <input type="radio" value="12" name="icon"> <img src="images/posticon/icon12.gif">&nbsp; 
        <input type="radio" value="13" name="icon"> <img src="images/posticon/icon13.gif">&nbsp; 
        <input type="radio" value="14" name="icon"> <img src="images/posticon/icon14.gif">&nbsp; 
        <input type="radio" value="15" name="icon"> <img src="images/posticon/icon15.gif">&nbsp; 
      </td>
    </tr>
    <tr class="table-dark"> 
      <td> <div align="right">标题:</div></td>
      <td> <select name="select" class="input2" onChange="javascript:document.myform.title.value=myform.title.value+this.value;document.myform.title.focus();">
          <option selected value="">选择话题</option>
          <option value=[原创]>[原创]</option>
          <option value=[转帖]>[转帖]</option>
          <option value=[灌水]>[灌水]</option>
          <option value=[讨论]>[讨论]</option>
          <option value=[求助]>[求助]</option>
          <option value=[推荐]>[推荐]</option>
          <option value=[公告]>[公告]</option>
          <option value=[注意]>[注意]</option>
          <option value=[贴图]>[贴图]</option>
          <option value=[建议]>[建议]</option>
          <option value=[下载]>[下载]</option>
          <option value=[分享]>[分享]</option>
        </select> <input name="title" type="text" class="input2" id="title" size="53" maxlength="50"></td>
    </tr>
    <tr class="table-dark"> 
      <td valign="top"> <div align="right"><br>
          投票项目:<br>
          <br>
        </div></td>
      <td><textarea name="pollcon" cols="60" rows="10" class="input2" id="pollcon"></textarea> 
        <br>
        每行一个投票项目, 投票选项不得超过10个<br> </td>
    </tr>
    <tr class="table-dark"> 
      <td valign="top" class="table-dark"> 
        <div align="right"><br>
          投票说明: </div></td>
      <td><textarea name="txtcontent" cols="60" rows="6" class="input2" id="txtcontent"></textarea></td>
    </tr>
    <tr class="table-dark"> 
      <td><div align="right">投票结束时间:</div></td>
      <td> <select name="timeout" id="timeout">
          <option value="30">60天后</option>
          <option value="30" selected>30天后</option>
          <option value="15">15天后</option>
          <option value="7">7天后</option>
          <option value="0">无时间限制</option>
        </select> </td>
    </tr>
    <tr class="table-dark">
      <td><div align="right">投票类型:</div></td>
      <td><input name="votetype" type="radio" value="0" checked>
        单选 
        <input type="radio" name="votetype" value="1">
        多选</td>
    </tr>
    <tr class="table-dark"> 
      <td> <div align="right">查看本贴需要积分:</div></td>
      <td><input name="rating" type="text" id="rating" value="0" size="5" maxlength="5"> 
      </td>
    </tr>
    <tr class="table-dark"> 
      <td> <div align="right">表情符号:</div></td>
      <td><!--#include file = "INC/emot.asp"--></td>
    </tr>
    <tr class="table-dark"> 
      <td> <div align="right">选项:</div></td>
      <td> <input name="showsignature" type="checkbox" id="showsignature" value="1" checked>
        使用我的个性签名</td>
    </tr>
    <tr class="table-dark"> 
      <td height="28" colspan="2"> <div align="center"> 
          <input type="submit" name="Submit" value="  提 交  ">
          &nbsp; 
          <input type="reset" name="Submit2" value="重置">
        </div></td>
    </tr>
  </form>
</table>
<br>
<%
End Sub
'--------------------------------------
Sub add()
	pollcon = trim(request.Form("pollcon"))
	time_out = trim(request.Form("timeout"))
	votetype = trim(request.Form("votetype"))
	pollcon = split(pollcon,chr(10))
	if (ubound(pollcon) < 1) or (ubound(pollcon) > 9) then
		ShowMsg "错误:投票项目最少为2,最多为10,请 <a href=""javascript:history.back()"">点击</a> 这里返回重新输入"
		Call Bottom()
		response.End()
	End if
		select case time_out
			case "60"
				time_out = 60
			case "30"
				time_out = 30
			case "15"
				time_out = 15
			case "7"
				time_out = 7
			case else
				time_out = 0
		end select
		if votetype = "1" then
			votetype = 1
		else
			votetype = 0
		end if
		j = ubound(pollcon)
		strpoll=""
		votes=""
		for i = 0 to j
			if rtrim(pollcon(i)) <> "" then
				strpoll = strpoll & pollcon(i) &"||"
				votes = votes & "0||"
			end if
		next
		strpoll = left(strpoll, len(strpoll) - 2)
		votes = left(votes, len(votes) - 2)
	'response.Write(strpoll&"_"&votes)
	'response.Write(time_out)
	'response.End()
	'------------------------------------------------
	icons = Trim(Request.Form("icon"))
	title = replace(Trim(Request.Form("title")),"'","''")
	content = replace(rTrim(Request.Form("txtcontent")),"'","''")
	title = replace(title,"<script","<script&nbsp;")
	content = replace(content,"<script","<script&nbsp;")
	if len(Content) > Board_Config(23) then
		ShowMsg "投票说明均不可超过 "&Board_Config(23)&" 字,<a href=""javascript:history.back()"">点击这里返回.</a>"
		Call Bottom()
		response.end
	end if
	rating = Trim(Request.Form("rating"))
		if Not(IsNumeric(rating)) then rating = 0
	showsignature = Trim(Request.Form("showsignature"))
		if showsignature = "" then showsignature = 0 else showsignature = 1 End if
	if icons = "" or title = "" or content = "" or strpoll = "" or time_out= "" or votetype = "" then
		Call newvote()
		Call Bottom()
		response.end
	End if
	if userid = "" then userid = 0
	if username = "" then username = "游客"
	'-------------------------保存新投票-----------------------------
	session("LastPostTime") = Now()
	Conn.ExeCute("insert into JBB_poll(times,options,votes,time_out,pollcount,joinpollcount,polltype) values('"& Now() &"','"& strpoll &"','"& votes &"',"& time_out &","& j+1 &",0,"& votetype &")")
	set rs = Conn.ExeCute("select max(pollID) from JBB_poll")
	if Not rs.eof then
		pollID = rs(0)
	End if
	set rs = Nothing
	'-------------------------保存主新主题---------------------------
	Conn.ExeCute("insert into JBB_thread(thread_title,Board_ID,posttime,pollid,postuserid,postusername,lastpost,lastposterid,lastposter,icons,rating) values('"& title &"',"& BoardID &",'"& Now() &"',"& pollid &","& userid &",'"& username &"','"& Now() &"',"& userid &",'"& username &"',"& icons &",'"& rating &"')")
	set rs = Conn.ExeCute("select max(threadID) from JBB_thread")
	if Not rs.eof then
		threadID = rs(0)
	End if
	set rs = Nothing
	Conn.ExeCute("insert into JBB_post(threadid,beginpost,Board_ID,user_name,user_id,posttitle,posttime,postcontent,showsignature,ipaddress,icons) values("& threadID &",1,"& BoardID &",'"& username &"',"& userid &",'"& title &"','"& Now() &"','"& content &"',"& showsignature &",'"& userip &"',"& icons &")")
	Conn.ExeCute("update JBB_Board set lastposter='"& username &"',lastuserid="& userid &",lasttime='"& Now() &"',lastpost='"& title &"',lastpostid="& threadID &",threadcount=threadcount+1 where BoardID="&BoardID)
	if userOnline = true then
		Conn.ExeCute("update JBB_user set Cent=Cent+"& Board_Config(14) &",threadcount=threadcount+1 where userID="&userid)
	End if
	postCount2 = Application(JBBMasterCookies&"postCount")
	postCount2(0) = postCount2(0)+1
	Application.Lock
		Application(JBBMasterCookies&"postCount") = postCount2
		Application(JBBMasterCookies&"Board_Config"&BoardID) = ""
	Application.UnLock
	ShowMsg "感谢您发布新投票,正在转向到新的投票,如果您不想等待,请点击<a href=""showthread.asp?threadid="& threadid &""">这里</a><br>如果您想转到主题列表,请点击<a href=""Board.asp?BoardId="&BoardID&""">这里</a>"
	response.Write("<META HTTP-EQUIV='REFRESH' CONTENT='2; URL=showthread.asp?threadid="& threadid &"'>")
End Sub
'--------------------------------------
Call Bottom()
%>

⌨️ 快捷键说明

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