admin_pset.asp
上传用户:comthink
上传日期:2021-05-06
资源大小:1280k
文件大小:7k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

HTML/CSS

  1. <!--#include file="conn.asp"-->
  2. <!-- #include file="inc/const.asp" -->
  3. <title><%=txl_info(0)%>--管理页面</title>
  4. <!--#include file="inc/admin_css.asp"-->
  5. <meta NAME=GENERATOR Content="Microsoft FrontPage 3.0" CHARSET=GB2312>
  6. <BODY leftmargin="0" bottommargin="0" rightmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor="#DDEEFF">
  7. <%
  8. if not supermaster or session("flag")="" then
  9. Errmsg=Errmsg+"<br>"+"<li>本页面为管理员专用,请<a href=admin_index.asp target=_top>登陆</a>后进入。<br><li>您没有管理本页面的权限。"
  10. call txl_error()
  11. response.end
  12. end if
  13. %>
  14. <table cellpadding="2" cellspacing="1" border="0" width="95%" class="tableBorder" align=center>
  15. <tr>
  16. <th colspan=4 height=23>照片类别管理</th>
  17. </tr>
  18. <tr>
  19. <td width=15% class=txlrow>注意事项</td>
  20. <td width=85% class=txlrow colspan=3 style="line-height: 150%">①点击类别或编辑可以修改照片类别名和类别简介;<br>②类别简介不要超过50个字符;<br>③点击删除,将删除该类别下的所有照片,请谨慎操作。</td>
  21. </tr>
  22. <%
  23. if request("action")="edit" then
  24. call edit()
  25. elseif request("action")="save" then
  26. call save()
  27. elseif request("action")="add" then
  28. call addnew()
  29. elseif request("action")="del" then
  30. call delete()
  31. else
  32. call main()
  33. end if
  34. conn.close
  35. set conn=nothing
  36. sub main()
  37. %>
  38. <tr>
  39. <th colspan=4 align=left height=23>类别列表</th>
  40. </tr>
  41. <tr align=center>
  42. <td class=txlHeaderBackgroundAlternate><B>ID</B></td>
  43. <td class=txlHeaderBackgroundAlternate><B>类别名</B></td>
  44. <td class=txlHeaderBackgroundAlternate><B>编辑</B></td>
  45. <td class=txlHeaderBackgroundAlternate><B>删除</B></td>
  46. </tr>
  47. <%
  48. Set rs= Server.CreateObject("ADODB.Recordset")
  49. select case request("userSearch")
  50. case 1
  51. sql="select * from imgclass where classid="&request("classid")
  52. case else
  53. sql="select * from imgclass order by classid"
  54. end select
  55. rs.open sql,conn,1,1
  56. if rs.eof and rs.bof then
  57. response.write "<tr><td colspan=4 class=txlrow>没有找到相关记录。</td></tr>"
  58. else
  59. do while (not rs.eof)
  60. %>
  61. <tr>
  62. <td height=25 width=15% class=txlrow align=center><%=rs("classid")%></td>
  63. <td width=55% class=txlrow align=center><a href=?action=edit&id=<%=rs("classid")%>><%=rs("classname")%></a></td>
  64. <td width=15% class=txlrow align=center><a href=?action=edit&id=<%=rs("classid")%>><u>编辑</u></a></td>
  65. <td width=15% class=txlrow align=center><a href=?action=del&id=<%=rs("classid")%> onclick="{if(confirm('确定要删除该类别吗?')){return true;}return false;}"><u>删除</u></a></td>
  66. </tr>
  67. <%
  68. rs.movenext
  69. loop
  70. end if
  71. rs.close
  72. set rs=nothing
  73. %>
  74. <FORM METHOD=POST ACTION="?action=add">
  75. <tr>
  76. <th colspan=4 align=left height=23>添加类别</th>
  77. </tr>
  78. <TR>
  79. <td width=15% class=txlrow>类别名称:</td>
  80. <td width=85% class=txlrow colspan=3><input type=text name="classname" size=30 value=""></td>
  81. </TR>
  82. <TR>
  83. <td width=15% class=txlrow>类别简介:<br></td>
  84. <td width=85% class=txlrow colspan=3><textarea cols=50 rows=4 name="classinfo"></textarea> 请不要超过50个字符</td>
  85. </TR>
  86. <tr>
  87. <td width=15% class=txlrow>&nbsp;</td>
  88. <td width=85% class=txlrow colspan=3><input name="submit" type=submit value="添 加"></td>
  89. </tr>
  90. </form>
  91. </table>
  92. <%
  93. end sub
  94. sub edit()
  95. if not isnumeric(request("id")) then
  96. response.write "<p>错误的用户参数。</p>"
  97. response.end
  98. end if
  99. if not founderr then
  100. Set rs= Server.CreateObject("ADODB.Recordset")
  101. sql="select * from imgclass where classid="&request("id")
  102. rs.open sql,conn,1,1
  103. if rs.eof and rs.bof then
  104. response.write "<tr><td colspan=4 class=txlrow>没有找到相关类别。</td></tr>"
  105. response.end
  106. end if
  107. end if
  108. %>
  109. <FORM METHOD=POST ACTION="?action=save">
  110. <input type=hidden name="classid" value="<%=rs("classid")%>">
  111. <tr>
  112. <th colspan=4 align=left height=23>修改类别</th>
  113. </tr>
  114. <TR>
  115. <td width=15% class=txlrow>类别名称:</td>
  116. <td width=85% class=txlrow colspan=3><input type=text name="classname" size=30 value="<%=rs("classname")%>"></td>
  117. </TR>
  118. <TR>
  119. <td width=15% class=txlrow>类别简介:<br></td>
  120. <td width=85% class=txlrow colspan=3><textarea cols=50 rows=4 name="classinfo"><%=rs("classinfo")%></textarea> 请不要超过50个字符</td>
  121. </TR>
  122. <tr>
  123. <td width=15% class=txlrow>&nbsp;</td>
  124. <td width=85% class=txlrow colspan=3><input name="submit" type=submit value="修 改"></td>
  125. </tr>
  126. </form>
  127. </table>
  128. <%
  129. end sub
  130. sub addnew()
  131. response.write "<tr><th colspan=4 height=23 align=left>执行结果</th></tr>"
  132. if request("classname")="" then
  133. response.write "<tr><td colspan=4 class=txlrow>请输入类别名。</td></tr>"
  134. response.end 
  135. end if
  136. if request("classinfo")="" then
  137. response.write "<tr><td colspan=4 class=txlrow>请输入类别简介。</td></tr>"
  138. response.end 
  139. elseif Len(request("classinfo"))>50 then
  140. response.write "<tr><td colspan=4 class=txlrow>类别简介只能在50个字符以内。</td></tr>"
  141. response.end 
  142. end if
  143. set rs=server.createobject("adodb.recordset")
  144. sql="Select * from imgclass"
  145. rs.open sql,conn,1,3
  146. if rs.eof and rs.bof then
  147. errmsg=errmsg+"<br>"+"<li>该用类别不存在。"
  148. founderr=true
  149. else
  150. rs.addnew
  151. rs("classname")=request("classname")
  152. rs("classinfo")=request("classinfo")
  153. rs.update
  154. end if
  155. rs.close
  156. set rs=nothing
  157. response.write "<tr><td colspan=4 class=txlrow>添加类别成功。</td></tr>"
  158. end sub
  159. sub save()
  160. response.write "<tr><th colspan=4 height=23 align=left>执行结果</th></tr>"
  161. if not isnumeric(request("classid")) then
  162. response.write "<tr><td colspan=4 class=txlrow>错误的类别参数。</td></tr>"
  163. response.end 
  164. end if
  165. if request("classname")="" then
  166. response.write "<tr><td colspan=4 class=txlrow>请输入类别名。</td></tr>"
  167. response.end 
  168. end if
  169. if request("classinfo")="" then
  170. response.write "<tr><td colspan=4 class=txlrow>请输入类别简介。</td></tr>"
  171. response.end 
  172. elseif Len(request("classinfo"))>50 then
  173. response.write "<tr><td colspan=4 class=txlrow>类别简介只能在50个字符以内。</td></tr>"
  174. response.end 
  175. end if
  176. set rs=server.createobject("adodb.recordset")
  177. sql="Select * from imgclass where classid="&request("classid")
  178. rs.open sql,conn,1,3
  179. if rs.eof and rs.bof then
  180. errmsg=errmsg+"<br>"+"<li>该用类别不存在。"
  181. founderr=true
  182. else
  183. rs("classname")=request("classname")
  184. rs("classinfo")=request("classinfo")
  185. rs.update
  186. end if
  187. rs.close
  188. set rs=nothing
  189. response.write "<tr><td colspan=4 class=txlrow>操作成功。</td></tr>"
  190. end sub
  191. sub delete()
  192. response.write "<tr><th colspan=4 height=23 align=left>执行结果</th></tr>"
  193. if not isnumeric(request("id")) then
  194. response.write "请指定相关参数。"
  195. response.end
  196. else
  197. conn.execute("update imgclass set picset=2 where classid="&request("id"))
  198. conn.execute("delete from imgclass where  classid="&request("id"))
  199. end if
  200. response.write "<tr><td colspan=4 class=txlrow>删除成功。</td></tr>"
  201. end sub
  202. %>