📄 reply_ok.jsp
字号:
<%
/*
* Copyright: Copyright (c) 2004
* @author http://hi.baidu.com/lael80*/
%>
<%@ page contentType="text/html; charset=gb2312" errorPage=""%>
<jsp:useBean id="workDB" scope="page" class="javabean.Conn"/>
<jsp:useBean id="workFC" scope="page" class="javabean.Func"/>
<%
java.util.Date date=new java.util.Date();
String reply_date=date.toLocaleString();
String reply_ip=request.getRemoteAddr();
String forum=request.getParameter("forum");
String topic=request.getParameter("topic");
String pageid=request.getParameter("pageid");
String id=request.getParameter("id");
String user_name=request.getParameter("user_name");
String user_password=request.getParameter("user_password");
String reply_content=workFC.UnitoGB(request.getParameter("textarea"));
String errcodes="";
String tpc_data=workDB.queryData("select topic_type from user_topic where topic_id="+topic+" and topic_forum="+forum);
String edit=request.getParameter("edit");
try{
if(!workFC.cNULL(edit)&&Integer.parseInt(workDB.queryData("select UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(reply_date) from user_reply where user_name='"+session.getAttribute("u_name")+"' order by reply_id desc limit 1"))<15){
response.sendRedirect("result.jsp?errcodes="+workFC.GBtoUni("<li>为了防止有人灌水,不能在十五秒内连续发贴"));
return;
}
}catch(Exception e){}
if(!workFC.cNULL(edit)&&workDB.queryCount("select count(reply_id) from user_reply where topic_id="+topic+" and user_name='"+session.getAttribute("u_name")+"' and reply_content='"+workFC.HtmltoStr(workFC.GBtoUni(reply_content))+"' and reply_forum="+forum)!=0){
response.sendRedirect("result.jsp?errcodes="+workFC.GBtoUni("<li>为了防止有人灌水,不能对同一主题发表相同的回复"));
return;
}
if(tpc_data.equals("1")&&!workFC.cNULL(edit)){
errcodes="<li>该主题已经锁定,不能执行回复";
response.sendRedirect("result.jsp?errcodes="+workFC.GBtoUni(errcodes));
}else{
if(!workFC.cNULL(String.valueOf(session.getAttribute("u_name")))){
if(workDB.queryCount("select count(user_id) from user_info where user_name='"+user_name+"' and user_password='"+user_password+"'")==0||!workFC.CheckStr(workFC.UnitoGB(user_name))||!workFC.CheckStr(workFC.UnitoGB(user_password))){
errcodes="<li>您还没有注册或登录,或填写的用户名与密码不对";
response.sendRedirect("result.jsp?errcodes="+workFC.GBtoUni(errcodes));
}else session.setAttribute("u_name",user_name);
}
if(workFC.cNULL(edit)&&workFC.cNULL(String.valueOf(session.getAttribute("u_name")))){
if(workDB.queryCount("select count(user_id) from user_info where user_name='"+session.getAttribute("u_name")+"' and (user_type="+forum+" or user_type=100)")==0){
if(workDB.queryCount("select count(reply_id) from user_reply where user_name='"+session.getAttribute("u_name")+"' and reply_id="+edit)==0){
errcodes="<li>错误贴子参数或您没有权限修改别人的贴子";
response.sendRedirect("result.jsp?errcodes="+workFC.GBtoUni(errcodes));
}
}
}
if(workFC.cNULL(String.valueOf(session.getAttribute("u_name")))&&!workFC.cNULL(errcodes)){
if(workDB.queryData("select user_type from user_info where user_name='"+session.getAttribute("u_name")+"'").equals("50")){
errcodes="<li>您的帐号已被锁定,暂时不能发贴,如有疑问请给版主留言";
response.sendRedirect("result.jsp?errcodes="+workFC.GBtoUni(errcodes));
}else{
if(!workFC.cNULL(reply_content)||!workFC.CheckLen(reply_content,20000)){
errcodes="<li>您回复的内容超出允许长度或为0,应该为(1-20000)字节";
response.sendRedirect("result.jsp?errcodes="+workFC.GBtoUni(errcodes));
}else{
if(workFC.cNULL(edit)){
String tmp="\r\n\r\n[该贴子由 "+workFC.UnitoGB(String.valueOf(session.getAttribute("u_name")))+" 于 "+reply_date+" 编辑过]";
workDB.executeUpdate("update user_reply set reply_content='"+workFC.HtmltoStr(workFC.GBtoUni(reply_content+tmp))+"' where user_name='"+session.getAttribute("u_name")+"' and reply_id="+edit);
}else workDB.executeUpdate("insert into user_reply(topic_id,user_name,reply_content,reply_date,reply_forum,reply_ip) Values("+topic+",'"+session.getAttribute("u_name")+"','"+workFC.HtmltoStr(workFC.GBtoUni(reply_content))+"','"+reply_date+"',"+forum+",'"+reply_ip+"')");
response.sendRedirect("display.jsp?forum="+forum+"&topic="+topic+"&pageid="+pageid+"&id="+id);
}
}
}
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -