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

📄 survey_show.asp

📁 用ASP设计的一个网上问卷系统,用于网上调查问卷系统的实现
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<!--#include file="../Include/Config.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'是否可以显示问卷的标示
'----------------------------------------------------------
'检验问卷(是否审核、是否为私有问卷、是否设置密码、是否在ip范围内)over
'----------------------------------------------------------

if canShow=true then'假如检验问卷通过,则显示问卷内容,如果不通过,则显示密码输入框(提示错误)
'----------------------------------------------------------
'显示问卷,将结果赋值给surveyQuestionList,模板操作---over
'----------------------------------------------------------
'无截断跳转的问卷按一次性全部显示
	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"">&nbsp;&nbsp;"
	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 & "回答:"
	surveyQuestionList=surveyQuestionList & "<input type=""text"" name=""answer"&Survey_question(i)&"""><br/><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 & "</div>"
	surveyQuestionList=surveyQuestionList & "<div class=""backindex"">"
'	surveyQuestionList=surveyQuestionList & "<a href=""Index.asp"" target=""_self"">&nbsp;返回首页</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
	'---------------------------------------------------

'----------------------------------------------------------
'显示问卷,将结果赋值给surveyQuestionList,模板操作---over
'----------------------------------------------------------
end if



'----------------------------------------------------------
'模板操作开始
'----------------------------------------------------------
if Survey_template<>0 then
sql="select * from [Templet] where Templet_column=9 and Templet_id=" & Survey_template
else
sql="select * from [Templet] where Templet_default=true and Templet_column=9"
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=9"
rs.open sql,conn,1,1
end if
if rs.eof then
Call ShowAlert("模板读取错误,请联系网站管理员","")
end if
Templet_content=rs("Templet_content")
rs.close
while cint(InStr(Templet_content,"{$Templet("))>0
	Templet_str=mid(Templet_content,cint(InStr(Templet_content,"{$Templet("))+2,cint(InStr(Templet_content,")Templet$}"))-cint(InStr(Templet_content,"{$Templet("))-2)    
	Templet_content=replace(Templet_content,"{$"&Templet_str&")Templet$}",Templet_change(replace(Templet_str,"Templet(","")))
wend
Templet_content=replace(Templet_content,"{$keywords$}",keywords)
Templet_content=replace(Templet_content,"{$descrip$}",descrip)
Templet_content=replace(Templet_content,"{$siteName$}",siteName)
Templet_content=replace(Templet_content,"{$Survey_name$}",Survey_name)
Templet_content=replace(Templet_content,"{$surveyQuestionList$}",surveyQuestionList)
while cint(InStr(Templet_content,"{$"))>0
Templet_content_func_all=mid(Templet_content,instr(Templet_content,"{$")+2,instr(Templet_content,"$}")-instr(Templet_content,"{$")-2)
Templet_content_func=split(Templet_content_func_all,"(")
Templet_content_func(1)=replace(Templet_content_func(1),")","")
Templet_content_para=split(Templet_content_func(1),",")
Select Case Templet_content_func(0)
	Case "FlashRing"
	    Templet_content=replace(Templet_content,"{$"&Templet_content_func_all&"$}",FlashRing(Templet_content_para(0),Templet_content_para(1),Templet_content_para(2),Templet_content_para(3)))
Case "Get_Survey_Paihang"
	    Templet_content=replace(Templet_content,"{$"&Templet_content_func_all&"$}",Get_Survey_Paihang(Templet_content_para(0),Templet_content_para(1),Templet_content_para(2),Templet_content_para(3)))
	Case "FriendLink"	
	    Templet_content=replace(Templet_content,"{$"&Templet_content_func_all&"$}",FriendLink(Templet_content_para(0),Templet_content_para(1),Templet_content_para(2),Templet_content_para(3),Templet_content_para(4)))
	Case "New_Survey_List"
	    Templet_content=replace(Templet_content,"{$"&Templet_content_func_all&"$}",New_Survey_List(Templet_content_para(0),Templet_content_para(1),Templet_content_para(2),Templet_content_para(3)))
	Case else
		Templet_content=replace(Templet_content,"{$"&Templet_content_func_all&"$}","")
End Select

wend
I1 Templet_content
'----------------------------------------------------------
'模板操作结束
'----------------------------------------------------------


select case Action
    case "survey_save" call survey_save
    case "sub_check_pass" call sub_check_pass
end select
'----------------------------------------------------------
'验证用户提交的密码---start
'----------------------------------------------------------
sub sub_check_pass
dim survey_pass:survey_pass=md5(request.Form("pass"),16)
sql="select * from [Survey] where Survey_id="&Survey_id
rs.open sql,conn,1,3
if rs.eof then
call ShowAlert("参数错误","")
else
	if rs("Survey_password")=survey_pass then
		session("pass")=survey_pass
		Call ShowAlert("密码正确","Survey_Show.asp?Survey_id="&Survey_id&"")

⌨️ 快捷键说明

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