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

📄 setresearch.asp

📁 程序介绍: 1、内嵌式投票系统
💻 ASP
字号:
<%
''''''''''''''''''''''''''''''''''''''''''''
'
'  TXSite / 通用网站系统
'
'  版本    :v1.8.20
'
'  制作人  :milp(milp@21cn.com)
'
'  版权所有:源码之家(http://www.21tx.com)
'
'  主页地址:http://www.21tx.com
'            http://www.bestnets.net
'            http://www.soucn.com
'
'  技术支持:http://www.21tx.com/bbs
'
''''''''''''''''''''''''''''''''''''''''''''
'程序创建时间:20:40 2001-8-6
'程序完成时间:21:20 2001-8-6
'最后修改时间:21:51 2001-8-7
if session("adminflag")="" then Response.Redirect "default.asp"
dim action,x,id,name,rno,isUse
dim research(16)
action=request("action")

const thisprog="setresearch.asp"
dim sqlfenye,txtitle
txtitle=request("searchtxt")
if txtitle<>"" then
  sqlfenye="select * from research where name like '%"&trim(txtitle)&"%' order by id desc"
else
  sqlfenye="select * from research order by id desc"
end if
Sub deleteid(id)
  conn.execute "delete from research where id="&cstr(id)
End sub
%>
<!--#include file=base.asp-->
<!--#include file="subs.asp"-->
<%
if session("adminflag")>2 then Call PrintMsg(NotAdmin)

if action="" then action="add"
if action="saveadd" or action="savemod" then
  Call saveresearch
elseif action="fenye" then
  Call fenye
elseif action="mod" then
  Call modresearch
else
  Call addresearch
end if
%>
<!--#include file=end.asp-->

<%Sub modresearch()
rSub.open "select * from research where id="&request("id"),conn,1,1
if rSub.bof and rSub.eof then Call PringMsg("操作错误!")
id=rSub("id")
name=rSub("name")
rno=rSub("rno")
isUse=rSub("isUse")
for x=0 to 15
  research(x)=rSub("res"&x&"")
next
rSub.close
Call addresearch
End Sub%>

<%Sub addresearch()%>
<br><p align=center><font color=red><b><%=request("msg")%></b></font></p>
<form method="post" action="<%=thisprog%>?action=save<%=action%>&id=<%=id%>">
  <table width="90%" border="0" cellspacing="2" cellpadding="2" align="center">
    <tr> 
      <td align=center>调查管理<br><br>
共有调查选项数:<select name="rno">
<%
if rno="" then
  rno=4
  rname="初始值"
else
  rname="已被选"
end if
for xx=1 to 8
if xx=rno then
   selo="selected"
else
   selo=""
end if
  response.write "<option "&selo&" value="&xx&">"&xx&"</option>"
next
%>
</select>
<%if isUse<>"" then%>
是否有效:<input type="checkbox" name="isUse" value="<%=isUse%>" <%if isUse then response.write "checked"%>>
<%else%>
是否有效:<input type="checkbox" name="isUse" checked>
<%end if%><br>
调查名称:<input type="text" name="name" size="50" maxlength="100" value=<%=name%>>
</td>
    </tr>
    <tr> 
       <td align="center"> 
        选项1: <input type="text" name="research8" value="<%=research(8)%>">
        <%=rname%>:<input type="text" name="research0" value="<%=research(0)%>"><br>
        选项2: <input type="text" name="research9" value="<%=research(9)%>"> 
        <%=rname%>:<input type="text" name="research1" value="<%=research(1)%>"><br>
        选项3: <input type="text" name="research10" value="<%=research(10)%>">
        <%=rname%>:<input type="text" name="research2" value="<%=research(2)%>"><br>
        选项4: <input type="text" name="research11" value="<%=research(11)%>"> 
        <%=rname%>:<input type="text" name="research3" value="<%=research(3)%>"><br>
        选项5: <input type="text" name="research12" value="<%=research(12)%>">
        <%=rname%>:<input type="text" name="research4" value="<%=research(4)%>"><br>
        选项6: <input type="text" name="research13" value="<%=research(13)%>"> 
        <%=rname%>:<input type="text" name="research5" value="<%=research(5)%>"><br>
        选项7: <input type="text" name="research14" value="<%=research(14)%>">
        <%=rname%>:<input type="text" name="research6" value="<%=research(6)%>"><br>
        选项8: <input type="text" name="research15" value="<%=research(15)%>"> 
        <%=rname%>:<input type="text" name="research7" value="<%=research(7)%>"><br>
         </td>
    </tr>
    <tr> 
      <td align="center" height="34"> 
        <input type="submit" value=" 送 出 ">
        <input type="reset" value=" 重 置 ">
       </td>
    </tr>
  </table>
</form>
<p>说明:<br>调查系统最多可有 8 个调查选项<br>每次操作前请选择调查选项数<br>超过调查选项数的选项都将被忽略。
<br>初始值为空自动置为0
<%End Sub

Sub saveresearch
name=trim(request.form("name"))
rno=trim(request.form("rno"))
isUse=trim(request.form("isUse"))
if name="" then 
OutMsg=OutMsg+"<br>"+"<li>错误提示:请输入调查名称!"
founderr=true
end if
for x=0 to rno-1
  research(x)=trim(request.form("research"&x&""))
  research(x+8)=trim(request.form("research"&x+8&""))
  if research(x+8)="" then 
  OutMsg=OutMsg+"<br>"+"<li>错误提示:请输入选项"&x+1&"!"
  founderr=true
end if
next
if founderr=true then Call PrintMsg(OutMsg)

if action="saveadd" then
  rSub.open "select * from research where id is null",conn,1,3
  rSub.AddNew
elseif action="savemod" then
  rSub.open "select * from research where id="&request("id"),conn,1,3
end if
rSub("name")=name
rSub("rno")=rno
if isUse="" then
  rSub("isUse")=False
else
  rSub("isUse")=True
end if

for x=0 to rno-1
  rSub("res"&x+8&"")=research(x+8)
  if research(x)="" then
    rSub("res"&x&"")=1
  else
    rSub("res"&x&"")=research(x)
  end if
next

rSub.Update
id=rSub("id")
rSub.Close
response.redirect ""&thisprog&"?action=mod&id="&id&"&msg=操作成功!"
End Sub%>

⌨️ 快捷键说明

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