📄 survey_show.asp
字号:
<!--#include file="Include/Config2.asp"-->
<!--#include file="Template.asp"-->
<%
'----------------------------------------------------------
'页面功能:问卷显示和保存页,本站核心文件。
'最后修改时间:2007-11-23
'作者:legal http://www.ilegal.cn
'备注:
'----------------------------------------------------------
'显示网页keywords和description
call Check_Site_State()
'----------------------------------------------------------
'读取问卷常用变量---start
'----------------------------------------------------------
dim Survey_id,Action,Survey_content,i,Question_type
dim Survey_question,Question_answer,j
Question_type=""
Survey_id=request.QueryString("Survey_id")
Action=request.QueryString("Action")
call CheckNum(Survey_id)
sql="select * from [Survey] where Survey_id="&Survey_id
rs.open sql,conn,1,3
if rs.eof then
call ShowAlert("参数错误","")
else
Survey_content=rs("Survey_content")
Survey_name=rs("Survey_name")
Survey_description=rs("Survey_description")
Survey_ipRepeat=rs("Survey_ipRepeat")
Survey_jdtz=rs("Survey_jdtz")
Survey_back=rs("Survey_back")
Survey_needUserInfo=rs("Survey_needUserInfo")
Survey_template=rs("Survey_templet")
end if
rs.close
'----------------------------------------------------------
'读取问卷常用变量---over
'----------------------------------------------------------
'----------------------------------------------------------
'检验问卷开放、审核、密码、IP限制等---start
'----------------------------------------------------------
dim surveyQuestionList:surveyQuestionList=""
dim canShow:canShow=true'是否可以显示问卷的标示
sql="select * from [Survey] where Survey_id="&Survey_id
rs.open sql,conn,1,3
if rs.eof then
Call ShowAlert("参数错误","")
end if
if rs("Survey_isAuditing")="False" then
call ShowAlert("问卷未通过审核","")
end if
if rs("Survey_isOpen")="False" then
ComeUrl=lcase(trim(request.ServerVariables("HTTP_REFERER")))
if ComeUrl="" then
call ShowAlert("参数错误","")
else
cUrl=trim("http://" & Request.ServerVariables("SERVER_NAME"))
if mid(ComeUrl,len(cUrl)+1,1)=":" then
cUrl=cUrl & ":" & Request.ServerVariables("SERVER_PORT")
end if
cUrl=lcase(cUrl & request.ServerVariables("SCRIPT_NAME"))
if lcase(left(ComeUrl,instrrev(ComeUrl,"/")))<>lcase(left(cUrl,instrrev(cUrl,"/"))) then
call ShowAlert("参数错误","")
end if
end if
end if
if rs("Survey_password")<>"" then
if rs("Survey_password")<>session("pass") then
canShow=false
surveyQuestionList=surveyQuestionList&"<div id=""passwordBox"">"
surveyQuestionList=surveyQuestionList& "<div class=""title"">"
surveyQuestionList=surveyQuestionList& "输入访问密码"
surveyQuestionList=surveyQuestionList& "</div>"
surveyQuestionList=surveyQuestionList& "<div class=""content"">"
surveyQuestionList=surveyQuestionList& "<form name=""form1"" action=""?Survey_id="&Survey_id&"&Action=sub_check_pass"" method=""post"">"
surveyQuestionList=surveyQuestionList& "<input type=""password"" name=""pass""/> "
surveyQuestionList=surveyQuestionList& "<input type=""submit"" name=""submit1"" value=""进入""/>"
surveyQuestionList=surveyQuestionList& "</form>"
surveyQuestionList=surveyQuestionList& "</div>"
surveyQuestionList=surveyQuestionList& "</div>"
end if
end if
if rs("Survey_ipLimitKind")<>"" then
dim UserIp:UserIp=request.servervariables("http_x_forwarded_for")
if UserIp="" then
UserIp=request.servervariables("remote_addr")
end if
dim allow:allow=false
ipStart=split(rs("Survey_ipStart"),",")
ipEnd=split(rs("Survey_ipEnd"),",")
select case rs("Survey_ipLimitKind")
case "bai"
for i=0 to ubound(ipStart)
if cIp(UserIp)>=cIp(ipStart(i)) and cIp(UserIp)<=cIp(ipEnd(i)) then
allow=true
exit for
end if
next
case "hei"
for i=0 to ubound(ipStart)
if cIp(UserIp)<cIp(ipStart(i)) or cIp(UserIp)>cIp(ipEnd(i)) then
allow=true
exit for
end if
next
case else
allow=true
end select
if allow=false then
call ShowAlert("您所在IP不允许您访问,谢谢配合!","Index.asp")
end if
end if
rs.close
'----------------------------------------------------------
'检验问卷(是否审核、是否为私有问卷、是否设置密码、是否在ip范围内)over
'----------------------------------------------------------
if canShow=true then'假如检验问卷通过,则显示问卷内容,如果不通过,则显示密码输入框(提示错误)
'----------------------------------------------------------
'显示问卷,将结果赋值给surveyQuestionList,模板操作---over
'----------------------------------------------------------
if Survey_jdtz="True" then
'有截断跳转的问卷按一步一步显示
if Survey_content<>"" then
Survey_question=split(Survey_content,",")
surveyQuestionList=surveyQuestionList & "<div class=""center"">"
surveyQuestionList=surveyQuestionList & "<div class=""name"">"
surveyQuestionList=surveyQuestionList & Survey_name
surveyQuestionList=surveyQuestionList & "</div>"
surveyQuestionList=surveyQuestionList & "<div id=""descript"">"
surveyQuestionList=surveyQuestionList & Survey_description
surveyQuestionList=surveyQuestionList & "<br/>"
surveyQuestionList=surveyQuestionList & "</div>"
surveyQuestionList=surveyQuestionList & "<div id=""Question_Tdtz_show"">"
surveyQuestionList=surveyQuestionList & "<form id=""QuestionForm"" action=""Survey_Show_Jdtz.asp?Survey_id="&Survey_id&"&Action=Show_Question"" method=""post"" onsubmit=""to_submit();"">"
surveyQuestionList=surveyQuestionList & "<input name=""Question_id"" type=""hidden"" value=""0""/>"
surveyQuestionList=surveyQuestionList & "<input name=""Question_view_num"" type=""hidden"" value=""0""/>"
surveyQuestionList=surveyQuestionList & "<input name=""button_submit"" type=""submit"" value=""点击开始问卷""/>"
surveyQuestionList=surveyQuestionList & "</form>"
surveyQuestionList=surveyQuestionList & "</div>"'end of Question_Tdtz_show
surveyQuestionList=surveyQuestionList & "<div class=""button"">"
surveyQuestionList=surveyQuestionList & "</div>"
surveyQuestionList=surveyQuestionList & "<div class=""backindex"">"
surveyQuestionList=surveyQuestionList & "<a href=""Index.asp"" target=""_self""> 返回首页</a>"
surveyQuestionList=surveyQuestionList & "</div>"
surveyQuestionList=surveyQuestionList & "</div>"'end of center
conn.execute("update [Survey] set Survey_hits=Survey_hits+1 where Survey_id="&Survey_id)
else
surveyQuestionList=surveyQuestionList & "本问卷下暂时没有问题,请等待管理员添加"
end if
'---------------------------------------------------
else
'无截断跳转的问卷按一次性全部显示
surveyQuestionList=surveyQuestionList & "<div class=""center"">"
surveyQuestionList=surveyQuestionList & "<form id=""form_survey"" name=""form1"" action=""?Survey_id="&Survey_id&"&Action=survey_save"" method=""post"" onsubmit=""survey_submit();"">"
surveyQuestionList=surveyQuestionList & "<div class=""name"">"
surveyQuestionList=surveyQuestionList & Survey_name
surveyQuestionList=surveyQuestionList & "</div>"
surveyQuestionList=surveyQuestionList & "<div class=""Question_list"">"
if Survey_needUserInfo=true then'假如问卷要求输入用户信息,则显示用户信息
surveyQuestionList=surveyQuestionList & "姓名:<input name=""user_name""> "
surveyQuestionList=surveyQuestionList & "电子邮件:<input name=""user_email"">"
end if
if Survey_content<>"" then
Survey_question=split(Survey_content,",")
surveyQuestionList=surveyQuestionList & "<ul type=""1"">"
for i=0 to ubound(Survey_question)
sql="select * from [Question] where Question_id="&Survey_question(i)
rs.open sql,conn,1,1
if not rs.eof then
select case rs("Question_type")
case "1"
surveyQuestionList=surveyQuestionList & "<li>"&rs("Question_content")&"</li>"
surveyQuestionList=surveyQuestionList & "<ul type=""1"">"
if not rs("Question_answer")="" then
if Question_type<>"" then'将题目类型存在变量中,统一POST
Question_type=Question_type&","&rs("Question_type")
else
Question_type=rs("Question_type")
end if
Question_answer=split(rs("Question_answer"),"&")
Question_img=split(rs("Question_img"),"&")
for j=0 to ubound(Question_answer)
surveyQuestionList=surveyQuestionList & "<li><input type=""radio"" name=""answer"&Survey_question(i)&""" value="""&j&""">"&Question_answer(j)&"</li>"
if Question_img(j)<>"null" then
surveyQuestionList=surveyQuestionList & "<img src="""&Question_img(j)&""">"
end if
next
else
surveyQuestionList=surveyQuestionList & "该题目下无选项"'出现此情况,刚可以认为问卷无效,一定是出现异常。
end if
surveyQuestionList=surveyQuestionList & "</ul><br/>"
case "2"
surveyQuestionList=surveyQuestionList & "<li>"&rs("Question_content")&"</li>"
surveyQuestionList=surveyQuestionList & "<ul type=""1"">"
if not rs("Question_answer")="" then
if Question_type<>"" then '将题目类型存在变量中,统一POST
Question_type=Question_type&","&rs("Question_type")
else
Question_type=rs("Question_type")
end if
Question_answer=split(rs("Question_answer"),"&")
Question_img=split(rs("Question_img"),"&")
for j=0 to ubound(Question_answer)
surveyQuestionList=surveyQuestionList & "<li><input type=""checkbox"" name=""answer"&Survey_question(i)&""" value="""&j&""">"&Question_answer(j)&"</li>"
if Question_img(j)<>"null" then
surveyQuestionList=surveyQuestionList & "<img src="""&Question_img(j)&""">"
end if
next
else
surveyQuestionList=surveyQuestionList & "该题目下无选项"'出现此情况,刚可以认为问卷无效,一定是出现异常。
end if
surveyQuestionList=surveyQuestionList & "</ul><br/>"
case "3"
surveyQuestionList=surveyQuestionList & "<li>"&rs("Question_content")&"</li>"
surveyQuestionList=surveyQuestionList & "<ul type=""1"">"
if not rs("Question_answer")="" then
if Question_type<>"" then'将题目类型存在变量中,统一POST
Question_type=Question_type&","&rs("Question_type")
else
Question_type=rs("Question_type")
end if
Question_answer=split(rs("Question_answer"),"&")
Question_img=split(rs("Question_img"),"&")
for j=0 to (ubound(Question_answer)-1)
surveyQuestionList=surveyQuestionList & "<li><input type=""radio"" name=""answer"&Survey_question(i)&""" value="""&j&""">"&Question_answer(j)&"</li>"
if Question_img(j)<>"null" then
surveyQuestionList=surveyQuestionList & "<img src="""&Question_img(j)&""">"
end if
next'输出最后一个文本类型的
surveyQuestionList=surveyQuestionList & "<li><input type=""radio"" name=""answer"&Survey_question(i)&""" value="""&ubound(Question_answer)&""">"&Question_answer(ubound(Question_answer))&"<input type=""text"" name=""answer"&Survey_question(i)&"_2""></li>"
else
surveyQuestionList=surveyQuestionList & "该题目下无选项"'出现此情况,刚可以认为问卷无效,一定是出现异常。
end if
surveyQuestionList=surveyQuestionList & "</ul><br/>"
case "4"
surveyQuestionList=surveyQuestionList & "<li>"&rs("Question_content")&"</li>"
surveyQuestionList=surveyQuestionList & "<ul type=""1"">"
if not rs("Question_answer")="" then
if Question_type<>"" then '将题目类型存在变量中,统一POST
Question_type=Question_type&","&rs("Question_type")
else
Question_type=rs("Question_type")
end if
Question_answer=split(rs("Question_answer"),"&")
Question_img=split(rs("Question_img"),"&")
for j=0 to (ubound(Question_answer)-1)
surveyQuestionList=surveyQuestionList & "<li><input type=""checkbox"" name=""answer"&Survey_question(i)&""" value="""&j&""">"&Question_answer(j)&"</li>"
if Question_img(j)<>"null" then
surveyQuestionList=surveyQuestionList & "<img src="""&Question_img(j)&""">"
end if
next'输出最后一个文本类型的
surveyQuestionList=surveyQuestionList & "<li><input type=""checkbox"" name=""answer"&Survey_question(i)&""" value="""&ubound(Question_answer)&""">"&Question_answer(ubound(Question_answer))&"<input type=""text"" name=""answer"&Survey_question(i)&"_2""></li>"
else
surveyQuestionList=surveyQuestionList & "该题目下无选项"'出现此情况,刚可以认为问卷无效,一定是出现异常。
end if
surveyQuestionList=surveyQuestionList & "</ul><br/>"
case "5"
surveyQuestionList=surveyQuestionList & "<li>"&rs("Question_content")&"</li><br>"
surveyQuestionList=surveyQuestionList & "回答:<br/>"
surveyQuestionList=surveyQuestionList & "<textarea name=""answer"&Survey_question(i)&""" cols=""45"" rows=""5""></textarea><br/>"
if Question_type<>"" then '将题目类型存在变量中,统一POST
Question_type=Question_type&","&rs("Question_type")
else
Question_type=rs("Question_type")
end if
case else
end select
end if
rs.close
next
surveyQuestionList=surveyQuestionList & "</ul>"
surveyQuestionList=surveyQuestionList & "<input type=""hidden"" value="""&Question_type&""" name=""Question_type"">"
surveyQuestionList=surveyQuestionList & "</div>"'end of question_list
surveyQuestionList=surveyQuestionList & "<div class=""button"">"
surveyQuestionList=surveyQuestionList & "<input type=""submit"" value=""提交问卷"" name=""submit1"">"
surveyQuestionList=surveyQuestionList & "<input type=""reset"" value=""重新填写"" name=""reset1"">"
surveyQuestionList=surveyQuestionList & "</div>"
surveyQuestionList=surveyQuestionList & "<div class=""backindex"">"
surveyQuestionList=surveyQuestionList & "<a href=""Index.asp"" target=""_self""> 返回首页</a>"
surveyQuestionList=surveyQuestionList & "</div>"
surveyQuestionList=surveyQuestionList & "</form>"
surveyQuestionList=surveyQuestionList & "</div>"'end of center
conn.execute("update [Survey] set Survey_hits=Survey_hits+1 where Survey_id="&Survey_id)
else
surveyQuestionList=surveyQuestionList & "本问卷下暂时没有问题,请等待管理员添加"
end if
'---------------------------------------------------
end if
'----------------------------------------------------------
'显示问卷,将结果赋值给surveyQuestionList,模板操作---over
'----------------------------------------------------------
end if
'----------------------------------------------------------
'模板操作开始
'----------------------------------------------------------
if Survey_template<>0 then
sql="select * from [Templet] where Templet_column=3 and Templet_id=" & Survey_template
else
sql="select * from [Templet] where Templet_default=true and Templet_column=3"
end if
rs.open sql,conn,1,1
if rs.eof then
rs.close
sql="select * from [Templet] where Templet_default=true and Templet_column=3"
rs.open sql,conn,1,1
end if
if rs.eof then
Call ShowAlert("模板读取错误,请联系网站管理员","")
end if
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -