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

📄 head.jsp

📁 这是一个用JAVA语言编写的BBS论坛程序
💻 JSP
📖 第 1 页 / 共 2 页
字号:
<%
/*
 * Copyright:  Copyright (c) 2004 
 * @author http://hi.baidu.com/lael80*/
%>
<%@ page contentType="text/html; charset=gb2312" errorPage=""%>
<%@ page import="java.util.*"%>
<jsp:useBean id="workDB" scope="page" class="javabean.Conn"/>
<jsp:useBean id="workFC" scope="page" class="javabean.Func"/>
<jsp:useBean id="workCK" scope="page" class="javabean.Cookies"/>
<jsp:useBean id="workMD" scope="page" class="javabean.Md5"/>
<%
if(workDB.queryCount("select count(user_id) from user_info where user_name='"+session.getAttribute("u_name")+"'")==0){
  session.setAttribute("u_name","");
}

String skins="grey";
try{
  if(!workFC.cNULL(String.valueOf(session.getAttribute("u_name")))){
    if(workFC.cNULL(workCK.getCookieValue(request,"user_name"))&&workFC.cNULL(workCK.getCookieValue(request,"user_password"))){
      String Md5pass=workMD.Md5Str(workDB.queryData("select user_password from user_info where user_name='"+workCK.getCookieValue(request,"user_name")+"'"));
      if(workCK.getCookieValue(request,"user_password").equals(Md5pass)){
        session.setAttribute("u_name",workCK.getCookieValue(request,"user_name"));
      }else{
        workCK.setCookieValue(response,"user_name","");
        workCK.setCookieValue(response,"user_password","");
      }
    }else{
      workCK.setCookieValue(response,"user_name","");
      workCK.setCookieValue(response,"user_password","");
    }
  }
  if(!workFC.cNULL(workCK.getCookieValue(request,"skins")))workCK.setCookieValue(response,"skins","grey");
  if(workCK.getCookieValue(request,"skins").equals("blue"))skins="blue";
  if(workCK.getCookieValue(request,"skins").equals("shallow"))skins="shallow";
  if(workCK.getCookieValue(request,"skins").equals("grey"))skins="grey";
  if(workCK.getCookieValue(request,"skins").equals("yellow"))skins="yellow";
}catch(Exception e){}

String tabletop="<table width='96%' border='0' align='center' cellpadding='0' cellspacing='0'><tr height='30' background='skins/"+skins+"/b3.gif'><td background='skins/"+skins+"/b3.gif'><img src='skins/"+skins+"/b2.gif'></td><td background='skins/"+skins+"/b3.gif'><div align='right'><img src='skins/"+skins+"/b4.gif'></div></td></tr><tr><td colspan='2'>";
String tablebottom="</td></tr><tr height='20' background='skins/"+skins+"/b6.gif'><td background='skins/"+skins+"/b6.gif'><img src='skins/"+skins+"/b5.gif'></td><td background='skins/"+skins+"/b6.gif'><div align='right'><img src='skins/"+skins+"/b7.gif'></div></td></tr></table>";

Hashtable hash=new Hashtable();

hash.put("/index.jsp","暴风论坛");
hash.put("/result.jsp","论坛提示");
hash.put("/lostpass.jsp","忘记密码");
hash.put("/register.jsp","用户注册");
hash.put("/search.jsp","论坛搜索");
hash.put("/useredit.jsp","资料修改");
hash.put("/userinfo.jsp","用户资料");
hash.put("/userlist.jsp","用户列表");
hash.put("/userlogin.jsp","用户登录");
hash.put("/help.jsp","论坛帮助");
hash.put("/message.jsp","我的留言");
hash.put("/sendmsg.jsp","发送留言");
hash.put("/directory.jsp","地址簿");
hash.put("/admin.jsp","用户管理");

hash.put("1","网页设计");
hash.put("2","平面设计");
hash.put("3","动漫前沿");
hash.put("4","编程开发");
hash.put("5","电脑网络");
hash.put("6","灌水乐园");
hash.put("7","电视电影");
hash.put("8","贴图专区");
hash.put("9","论坛事务");

String sql="";
String urlpath="",action="";
int forum=0,topic=0,pageid=0,id=0,edit=0;
String servletpath=request.getServletPath();
String guide=(String)hash.get(servletpath);
String doctitle=(String)hash.get(servletpath);

if(servletpath.equals("/topic.jsp")){
  try{
    forum=Integer.parseInt(request.getParameter("forum"));
    if(forum<1||forum>9){
      response.sendRedirect("index.jsp");
      return;
    }     
  }catch(Exception e){
    response.sendRedirect("index.jsp");
    return;
  }
  try{
     pageid=Integer.parseInt(request.getParameter("pageid"));
  }catch(Exception e){pageid=1;}

  String search=request.getParameter("search");
  if(workFC.cNULL(search)){
    sql=" and topic_theme like '%"+workFC.HtmltoStr(search)+"%'";
    urlpath="search="+workFC.UnitoGB(search)+"&";
  }
  workDB.PageInfo("select count(topic_id) from user_topic where topic_forum="+forum+sql,30,pageid);
  if(pageid<1||pageid>workDB.getPageCount())pageid=1;
  doctitle=(String)hash.get(String.valueOf(forum));
  guide="<a href='topic.jsp?forum="+forum+"&pageid="+pageid+"'>"+doctitle+"</a>";
  doctitle="["+(String)hash.get(String.valueOf(forum))+"]"+"---暴风论坛";
} 

if(servletpath.equals("/display.jsp")){
  try{
    forum=Integer.parseInt(request.getParameter("forum"));
    if(forum<1||forum>9){
      response.sendRedirect("index.jsp");
      return;
    }     
  }catch(Exception e){
    response.sendRedirect("index.jsp");
    return;
  }
  try{
     pageid=Integer.parseInt(request.getParameter("pageid"));
  }catch(Exception e){pageid=1;}

  workDB.PageInfo("select count(topic_id) from user_topic where topic_forum="+forum,30,pageid);
  if(pageid<1||pageid>workDB.getPageCount())pageid=1;

  try{
    topic=Integer.parseInt(request.getParameter("topic"));
    if(workDB.queryCount("select count(topic_id) from user_topic where topic_id="+topic+" and topic_forum="+forum)==0){
      response.sendRedirect("topic.jsp?forum="+forum+"&pageid="+pageid);
      return;
    }   
  }catch(Exception e){
    response.sendRedirect("topic.jsp?forum="+forum+"&pageid="+pageid);
    return;
  }
  try{
     id=Integer.parseInt(request.getParameter("id"));
  }catch(Exception e){id=1;}

  workDB.PageInfo("select count(reply_id) from user_reply where reply_forum="+forum+" and topic_id="+topic,10,id);
  if(id<1||id>workDB.getPageCount())id=1;

  String theme=workDB.queryData("select substring(topic_theme,1,20) from user_topic where topic_id="+topic+" and topic_forum="+forum);  
  doctitle=(String)hash.get(String.valueOf(forum));
  guide="<a href='topic.jsp?forum="+forum+"&pageid="+pageid+"'>"+doctitle+"</a>&nbsp;→&nbsp;<a href='display.jsp?forum="+forum+"&topic="+topic+"&pageid="+pageid+"&id=1'>"+theme+"</a>";
  doctitle="["+(String)hash.get(String.valueOf(forum))+"]"+theme+"---暴风论坛";
}

if(servletpath.equals("/post.jsp")){
  try{
    forum=Integer.parseInt(request.getParameter("forum"));
    if(forum<1||forum>9){
      response.sendRedirect("index.jsp");
      return;
    }     
  }catch(Exception e){
    response.sendRedirect("index.jsp");
    return;
  }
  try{
     pageid=Integer.parseInt(request.getParameter("pageid"));
  }catch(Exception e){pageid=1;}
  workDB.PageInfo("select count(topic_id) from user_topic where topic_forum="+forum,30,pageid);
  if(pageid<1||pageid>workDB.getPageCount())pageid=1;

  if(workFC.cNULL(request.getParameter("topic"))){
    try{
      topic=Integer.parseInt(request.getParameter("topic"));
      if(workDB.queryCount("select count(topic_id) from user_topic where topic_id="+topic+" and topic_forum="+forum)==0){
        response.sendRedirect("topic.jsp?forum="+forum+"&pageid="+pageid);
        return;
      }   
    }catch(Exception e){
      response.sendRedirect("topic.jsp?forum="+forum+"&pageid="+pageid);
      return;
    }
  }
  if(workFC.cNULL(request.getParameter("action"))){
    action=request.getParameter("action");
    if(!action.equals("topic")){
      response.sendRedirect("topic.jsp?forum="+forum+"&pageid="+pageid);
      return;
    }
  }
  if(workFC.cNULL(request.getParameter("edit"))){
    try{
       edit=Integer.parseInt(request.getParameter("edit"));
       if(edit==0){
         response.sendRedirect("topic.jsp?forum="+forum+"&pageid="+pageid);
         return; 
       }
    }catch(Exception e){
       response.sendRedirect("topic.jsp?forum="+forum+"&pageid="+pageid);
       return;
    }
  }
  if(workFC.cNULL(request.getParameter("id"))){
    try{
       id=Integer.parseInt(request.getParameter("id"));
    }catch(Exception e){id=1;}

⌨️ 快捷键说明

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