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

📄 adminassort.asp

📁 问吧程序 问吧程序 问吧程序 问吧程序
💻 ASP
字号:
<%if session("admin")="" then
response.write"你没有登陆或是非法用户!<meta http-equiv=refresh content='1;url=../index.asp'>"
response.End()
end if%>
<!--#include file=conn.asp-->
<link href=../style.css rel=stylesheet type=text/css>
<form method=post action=adminassort.asp>
<table width="80%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#99CC00">
  <tr>
    <td height="30" align="center" bgcolor="eeeeee"><font style="font-size:14px">删除、修改分类</font></td>
  </tr>
  <tr>
    <td align="center" bgcolor="#FFFFFF">
	<%if request("del")="删除" then
	if request("topic")="" then
	response.write"分类不能为空!<meta http-equiv=refresh content='1;url=adminassort.asp'>"
	response.End()
	else
	topic=request("topic")
	'删除该主题相关问题和答复
	rs2.open"select * from question where topic='"&topic&"'",conn,1,3
	while not rs2.eof
	rs3.open"select * from reply where replyid="&rs2("id"),conn,1,3
	while not rs3.eof
	'修改解决数和回复数、积分
	rs4.open"select * from person where name='"&rs3("replyer")&"'",conn,1,3
	if rs3("isdeal")=1 then
	rs4("replynum")=rs4("replynum")-1
	rs4("helpnum")=rs4("helpnum")-1
	rs4("jifen")=rs4("jifen")-11
	temp=rs4("jifen")-11
	else
	rs4("replynum")=rs4("replynum")-1
	rs4("jifen")=rs4("jifen")-1
	temp=rs4("jifen")-1
	end if
	if temp<1000 then
		  rs4("touxian")="小孩子"
	      elseif temp>=1000 and temp<3000 then
		  rs4("touxian")="小朋友"
		  elseif temp>=3000 and temp<6000 then
		  rs4("touxian")="小学生"
		  elseif temp>=6000 and temp<10000 then
		  rs4("touxian")="中学生"
		  elseif temp>=10000 and temp<15000 then
		  rs4("touxian")="大学生"
		  elseif temp>=15000 and temp<21000 then
		  rs4("touxian")="硕士生"
		  elseif temp>=21000 and temp<28000 then
		  rs4("touxian")="博士生"
		  elseif temp>=28000 and temp<36000 then
		  rs4("touxian")="博士后"
		  elseif temp>=36000 then
		  rs4("touxian")="科学家"
		  end if
	rs4.update
	rs4.close
	'
	rs3.delete
	rs3.movenext
	wend
	rs3.close
	'修改发表问题数和积分
	rs4.open"select * from person where name='"&rs2("sender")&"'",conn,1,3
	rs4("asknum")=rs4("asknum")-1
	rs4("jifen")=rs4("jifen")+1
	temp=rs4("jifen")+1
	if temp<1000 then
		  rs4("touxian")="小孩子"
	      elseif temp>=1000 and temp<3000 then
		  rs4("touxian")="小朋友"
		  elseif temp>=3000 and temp<6000 then
		  rs4("touxian")="小学生"
		  elseif temp>=6000 and temp<10000 then
		  rs4("touxian")="中学生"
		  elseif temp>=10000 and temp<15000 then
		  rs4("touxian")="大学生"
		  elseif temp>=15000 and temp<21000 then
		  rs4("touxian")="硕士生"
		  elseif temp>=21000 and temp<28000 then
		  rs4("touxian")="博士生"
		  elseif temp>=28000 and temp<36000 then
		  rs4("touxian")="博士后"
		  elseif temp>=36000 then
		  rs4("touxian")="科学家"
		  end if
	rs4.update
	rs4.close
	'
	rs2.delete
	rs2.movenext
	wend
	rs2.close
	'
	rs.open"select * from assort where topic='"&topic&"'",conn,1,3
	rs.delete
	rs.close
	response.write"分类删除成功!<meta http-equiv=refresh content='1;url=adminassort.asp'>"
	response.End()
	end if
	end if%>
	<%if request("up2")="修改" then

	if request("topic")="" then
	response.write"分类名称不能为空!<a href=javascript:history.back()>返回</a>"
	response.End()
	else
	rs.open"select * from assort where id<>"&cint(request("id")),conn,1,1
	while not rs.eof
	if request("topic")=rs("topic") then
	response.write"分类名称已经存在!<a href=javascript:history.back()>返回</a>"
	response.End()
	end if
	rs.movenext
	wend
	rs.close
	'更新问题中的topic字段
	rs.open"select * from assort where id="&cint(request("id")),conn,1,1
	oldtopic=rs("topic")
	rs.close
	rs.open"select * from question where topic='"&oldtopic&"'",conn,1,3
	while not rs.eof
	rs("topic")=request("topic")
	rs.update
	rs.movenext
	wend
	rs.close
	
	'response.write cint(request.("id"))
	'response.End()
	
	rs.open"select * from assort where id="&cint(request("id")),conn,1,3
	rs("topic")=request("topic")
	rs.update
	rs.close
	response.write"分类修改成功!<meta http-equiv=refresh content='1;url=adminassort.asp'>"
	response.End()
	end if
	end if%>
	<%if request("up")="修改" then
	if request("topic")="" then
	response.write"分类不能为空!<meta http-equiv=refresh content='1;url=adminassort.asp'>"
	response.End()
	else
	rs.open"select * from assort where topic='"&request("topic")&"'",conn,1,1
	id=rs("id")%>
	<form method=post action=adminassort.asp>
	<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align=center>
	<!--此处问题在于通过url传id参数会出错,具体原因还不知道-->
	<input type=hidden name="id" value=<%=rs("id")%>>
	分类名称:<input type=text size=12 name="topic" value=<%=request("topic")%> ><input type=submit name="up2" value="修改"></td>
  </tr>
</table></form>

      <%rs.close
	response.End()
	end if
	end if%>
	分类:
      <select name="topic">
	    <%rs.open"select * from assort",conn,1,1
	  while not rs.eof%>
	    <option value=<%=rs("topic")%>><%=rs("topic")%></option>
	    <%rs.movenext
	  wend
	  rs.close%>
      </select>
      <br>
      <input name="del" type="submit" id="del" value="删除">
      <input name="up" type="submit" id="up" value="修改">
      </td>
      </tr>
      </table>
      </form>
	  <form method=post action=adminassort.asp>
<table width="80%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#99CC00">
  <tr>
    <td height="30" align="center" bgcolor="eeeeee"><font style="font-size:14px">添加分类</font></td>
  </tr>
  <tr>
    <td align="center" bgcolor="#FFFFFF">
	<%if request("add")="添加" then
	if request("topic")="" then
	response.write"分类名称不能为空!<meta http-equiv=refresh content='1;url=adminassort.asp'>"
	response.End()
	else
	rs.open"select * from assort where topic='"&request("topic")&"'",conn,1,1
	if not rs.eof then
	rs.close
	response.write"该分类名称已经存在!<meta http-equiv=refresh content='1;url=adminassort.asp'>"
	response.End()
	else
	rs.close
	rs.open"select * from assort",conn,1,3
	rs.addnew
	rs("topic")=request("topic")
	rs.update
	rs.close
	response.write"分类添加成功!<meta http-equiv=refresh content='1;url=adminassort.asp'>"
	response.End()
	end if
	end if
	end if%>
	分类名称:
    <input name="topic" type="text" size=12><input name="add" type="submit" value="添加"></td>
  </tr>
</table></form>

⌨️ 快捷键说明

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