ForumLinkAdmin.java
上传用户:yuyunping
上传日期:2013-03-21
资源大小:1844k
文件大小:3k
源码类别:

Java书籍

开发平台:

Java

  1. package net.acai.forum.admin;
  2. /**
  3.  * Title:        清清网络
  4.  * Description:
  5.  * Copyright:    Copyright (c) 2002
  6.  * Company:      www.SuperSpace.com
  7.  * @author:       SuperSpace
  8.  * @version 1.0
  9.  */
  10. import net.acai.forum.*;
  11. import net.acai.database.*;
  12. import javax.servlet.http.*;
  13. import java.sql.*;
  14. import net.acai.util.*;
  15. public class ForumLinkAdmin{
  16. public ForumLinkAdmin(){}
  17. public static void saveNew(HttpServletRequest request) throws Exception{
  18. String url=ParamUtil.getString(request,"url");
  19. String readme=ParamUtil.getString(request,"readme");
  20. String name=ParamUtil.getString(request,"name");
  21. if(url==null||readme==null||name==null)
  22. throw new Exception("请输入完整联盟论坛信息。");
  23. DBConnect dbc=new DBConnect("insert into bbs.bbslink(boardname,readme,url) values(?,?,?)");
  24. dbc.setBytes(1,(new String(name.getBytes("ISO-8859-1"),"GBK")).getBytes());
  25. dbc.setBytes(2,(new String(readme.getBytes("ISO-8859-1"),"GBK")).getBytes());
  26. dbc.setBytes(3,(new String(url.getBytes("ISO-8859-1"),"GBK")).getBytes());
  27. dbc.executeUpdate();
  28. dbc.close();
  29. }
  30. public static void saveEdit(HttpServletRequest request) throws Exception{
  31. int forumLinkID;
  32. try{
  33. forumLinkID=ParamUtil.getInt(request,"id");
  34. }
  35. catch(Exception e){
  36. throw new Exception("请您选择论坛的ID.");
  37. }
  38. DBConnect dbc=new DBConnect("update bbs.bbslink set boardname=?,readme=?,url=? where id="+forumLinkID);
  39. dbc.setBytes(1,(new String(ParamUtil.getString(request,"name","").getBytes("ISO-8859-1"),"GBK")).getBytes());
  40. dbc.setBytes(2,(new String(ParamUtil.getString(request,"readme","").getBytes("ISO-8859-1"),"GBK")).getBytes());
  41. dbc.setBytes(3,(new String(ParamUtil.getString(request,"url","").getBytes("ISO-8859-1"),"GBK")).getBytes());
  42. dbc.executeUpdate();
  43. dbc.close();
  44. }
  45. public static void del(HttpServletRequest request) throws Exception{
  46. int forumLinkID;
  47. try{
  48. forumLinkID=ParamUtil.getInt(request,"id");
  49. }
  50. catch(Exception e){
  51. throw new Exception("请您选择论坛的ID.");
  52. }
  53. DBConnect dbc=new DBConnect("delete from bbs.bbslink where id="+forumLinkID);
  54. dbc.executeUpdate();
  55. dbc.close();
  56. }
  57. public static void updateOrders(HttpServletRequest request) throws Exception{
  58. int newforumLinkID;
  59. int forumLinkID;
  60. try{
  61. newforumLinkID=ParamUtil.getInt(request,"newid");
  62. forumLinkID=ParamUtil.getInt(request,"id");
  63. }
  64. catch(Exception e){
  65. throw new Exception("请您选择论坛的ID.");
  66. }
  67. DBConnect dbc=new DBConnect("update bbs.bbslink set id="+newforumLinkID+" where id="+forumLinkID);
  68. dbc.executeUpdate();
  69. dbc.close();
  70. }
  71. }