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

📄 showcontent.java

📁 一个运行成功的论坛
💻 JAVA
字号:
package mybbs;
import java.util.*;
import java.sql.*;
import javax.servlet.http.HttpSession;

public class ShowContent {
  public ShowContent() {
  }
  HttpSession session=null;
  private int postid=0;
  private int j=0;
  private int istopic=1;
  private int groupid=0;
  private String  title;
  public  Vector ListContent(String forumid,String topicid,HttpSession session) throws Exception{
    this.session=session;

    Vector VCon=new Vector();
    DBConn conn=new DBConn();
    ResultSet rs=null;
    int power=0;
    String forum="";
    String userid="";
    if(session.getAttribute("userpower")!=null){
     power=Integer.parseInt((String)session.getAttribute("userpower"));
     }
    if(session.getAttribute("forum")!=null){
     forum=(String)session.getAttribute("forum");
     }
    if(session.getAttribute("userid")!=null){
      userid=(String)session.getAttribute("userid");
     }


    String sql="SELECT posts.*,bbsuser.* FROM posts,bbsuser WHERE posts.isdel=0 AND posts.forumid="
                  +forumid+" AND posts.topic_id="+topicid
                  +" AND posts.author_id=bbsuser.id ORDER BY posts.id ASC";

    rs=conn.query(sql);
    int i=1;
    while(rs.next())
    {
     StringBuffer buffer=new StringBuffer();
     if (rs.getInt("istopic") > 0) {
        j = rs.getInt("posts.islock");
        title=rs.getString("title");
        postid = rs.getInt("posts.id");
        groupid = rs.getInt("posts.groupid");
        istopic=rs.getInt("istopic");
      }

   /*-------------------------------------------------------------------*/
      buffer.append("<TABLE align=center cellSpacing=0 cellPadding=1 width=\"98%\" border=0>");
      buffer.append("<TBODY><TR>");
        if(i==1)
        buffer.append("<TD width=\"18%\" background=images/part1_38.gif height=28>");
        else
        buffer.append("<TD width=\"18%\" bgcolor=\"#f4f8e0\" height=28>");
        //改一下颜色
      if(rs.getInt("online")==1)
        buffer.append("&nbsp;&nbsp;<FONT color=red>作 者:"+rs.getString("bbsuser.nickname")+"</FONT>");
      else
        buffer.append("&nbsp;&nbsp;作 者:"+rs.getString("bbsuser.nickname"));
      buffer.append("</TD>");
      if(i==1)
      buffer.append(" <TD width=\"58%\" background=images/part1_38.gif>");
      else
      buffer.append(" <TD width=\"58%\" bgcolor=\"#f4f8e0\">");
      if(i==1){
        buffer.append("<FONT color=red>[楼主]</FONT>");
      }
      else{
        buffer.append("<FONT color=red>["+i+"楼]</FONT>");
      }
      buffer.append("&nbsp;&nbsp;主题:"+rs.getString("title")+"</TD>");
      if(i==1)
        buffer.append("<TD width=\"20%\" background=images/part1_38.gif>");
      else
        buffer.append("<TD width=\"20%\" bgcolor=\"#f4f8e0\">");
      buffer.append("<B>Posted:</B>"+rs.getString("post_time").substring(0,16));
      buffer.append("</TD></TR></TBODY></TABLE>");


      buffer.append("<TABLE align=center cellSpacing=0 cellPadding=1 width=\"98%\" border=0>");
      buffer.append("<TBODY><TR>");
      buffer.append(" <TD vAlign=top width=\"18%\" bgColor=#f4d8f2 rowSpan=2>");
      buffer.append("&nbsp;&nbsp;<IMG width=130 height=130 src=\""+rs.getString("face")+"\" />");
      buffer.append("<BR>&nbsp;&nbsp;等级:"+rs.getString("usergrade"));
      buffer.append("<BR>&nbsp;&nbsp;文章:"+rs.getString("totalpost"));
      buffer.append("<BR>&nbsp;&nbsp;积分:"+rs.getString("userscore"));
      buffer.append("<BR>&nbsp;&nbsp;加入时间:"+rs.getString("reg_time").substring(0,10));
      buffer.append("<BR>&nbsp;&nbsp;最后登陆:"+rs.getString("bbsuser.last_time").substring(0,10));
      buffer.append("<BR></TD>");

      buffer.append("<TD width=\"77%\" vAlign=center align=center bgColor=#f4f8fb >");
      //buffer.append("&nbsp;&nbsp;&nbsp;&nbsp;");

      buffer.append("<TABLE width=90% cellSpacing=0 cellPadding=0 border=0>");
      buffer.append("<TBODY> <TR><TD width=14><IMG height=8 src='images/top_l.gif' width=14></TD>");
      buffer.append("<TD background='images/top_c.gif'></TD>");
      buffer.append("<TD width=16><IMG height=8 src='images/top_r.gif' width=16></TD>");
      buffer.append("</TR>");
      buffer.append("<TR><TD vAlign=top width=14 background='images/center_l.gif'></TD>");
      buffer.append("<TD style='LINE-HEIGHT: 14pt' bgColor=#fffff1>");
      buffer.append(rs.getString("content")+"</TD>");
      buffer.append("<TD vAlign=top width=16 background='images/center_r.gif'>");
      buffer.append(" <IMG height=8 src='' width=16></TD></TR>");
      buffer.append("<TR> <TD vAlign=top width=14><IMG height=42 src='images/foot_l1.gif' width=14></TD>");
      buffer.append("<TD background='images/foot_c.gif'><IMG height=42 src='images/foot_l3.gif' width=36></TD>");
      buffer.append("<TD align=right width=16><IMG height=42 src='images/foot_r.gif' width=16></TD>");
      buffer.append("</TR></TBODY></TABLE><BR>");

      buffer.append("</TD></TR>");
      buffer.append("<TR><TD width=\"77%\" vAlign=bottom bgColor=#f4f8fb > ");
      buffer.append("<IMG src='images/sigline.gif' align=absBottom><BR>");
      buffer.append("&nbsp;&nbsp;&nbsp;"+rs.getString("signature")+"<BR>");

      buffer.append("</TD></TR></TBODY></TABLE>");

      buffer.append("<TABLE align=center cellSpacing=0 cellPadding=1 width=\"98%\" border=0>");
      buffer.append("<TBODY> <TR>");
      buffer.append("<TD width=\"18%\" height=25 bgcolor=\"#6699FF\" >");
      buffer.append("&nbsp;&nbsp;<IMG src='images/pc.gif'>");
      if(power>10||forum.equals(forumid)){
        buffer.append(rs.getString("post_ip"));
      }
      buffer.append("</TD>");
      buffer.append("<TD width=\"58%\" bgcolor=\"#8BB7F1\" >");
      buffer.append("<A href='user_info.do?userid="+rs.getString("bbsuser.id")+"'>");
      buffer.append("<IMG alt=查看作者资料 src='images/profile.gif' ></A>&nbsp;");
      buffer.append("<A href='"+rs.getString("weblog")+"'>");
      buffer.append("<IMG alt=博客 src='images/weblog.gif' ></A>&nbsp;");
      buffer.append("<A href='search.do?nickname="+rs.getString("nickname")+"'>");
      buffer.append("<IMG alt=搜索与之相关贴子 src='images/search.gif' ></A>&nbsp;");
      buffer.append("<A href='mailto:"+rs.getString("email")+"'>");
      buffer.append("<IMG alt=发电子邮件 src=\"images/emailto.gif\" ></A>&nbsp;");
      buffer.append("<IMG alt="+rs.getString("skype")+" src=\"images/skype.gif\" >&nbsp;");
      buffer.append(" </TD>");
      buffer.append("<TD align=right width=\"20%\" bgcolor=\"#8BB7F1\">");
      if(power>10||forum.equals(forumid))
      {
        buffer.append("<A href='adminAction.do?motion=2&postid="+rs.getString("posts.id")+"&forumsid="+forumid+"'>");
        buffer.append("<IMG alt=删除这个帖子 src='images/quote.gif' align=absMiddle></A>");
       }
      if(power>10||userid.equals(rs.getString("bbsuser.id")))
      {
        buffer.append("<A href='post.do?postid=" + rs.getString("posts.id") +
                      "&action=4'>");
        buffer.append("<IMG alt=编辑这个帖子 src='images/edit.gif' ></A>&nbsp;&nbsp;");
      }
      buffer.append("&nbsp;&nbsp;<A  href='javascript:scroll(0,0)'><IMG alt=顶端 src='images/top.gif'></A>");
      buffer.append("</TD></TR></TBODY></TABLE>");

      VCon.add(buffer);
      buffer=null;

      i++;
   /*-------------------------------------------------------------------*/
    }

    rs.close();
    conn.DBclose();
    return VCon;
}
public  int getPostid(){
  return postid;
}
public  int getGroupid(){
  return groupid;
}
public  int getIstopic(){
  return istopic;
}


 public  int getIslock(){
   return j;
 }
 public String getTitle(){
   return title;
 }

}

⌨️ 快捷键说明

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