PHP 代码:
<%@page language="java" contentType="text/html;charset=GBK" import="java.sql.*" %>
<%@include file="/inc/config.jsp"%> <%@include file="/inc/include.jsp"%>
<%--权限判断--%> <% try{ String userName = (String)session.getAttribute("userName"); if(userName == null){ response.sendRedirect("/login.jsp?error=1"); } }catch(Exception ex){ response.sendRedirect("/login.jsp?error=1"); }
%> <%--执行数据库查询--%> <%
Integer integer = (Integer)session.getAttribute("userId"); int selfUserId = integer.intValue(); //分组信息 Integer groupIdInteger = session.getAttribute("groupid")==null?(new Integer(0)):(Integer)session.getAttribute("groupid"); int groupId = groupIdInteger.intValue(); if(groupId==0){ response.sendRedirect("/grouperror.jsp?error=6"); } //每页显示条数 int numberPerPage = 10; String pageStr = request.getParameter("page")==null?"1":request.getParameter("page"); int pageInt = Integer.parseInt(pageStr); String sqlStr = "select count(*) from leaveword where groupid="+groupId; %> <jsp:useBean id="db" scope="page" class="com.ljsilver.util.DatabaseOperate"> <jsp:setProperty name="db" property="sqlStr" value="<%=sqlStr%>"/> </jsp:useBean> <% db.buildConnection(); ResultSet result = db.getResultSet(); result.next(); int count = result.getInt(1); db.close(); int pageNumber; if(count%numberPerPage==0){ pageNumber = count/numberPerPage; }else{ pageNumber = count/numberPerPage+1; } if(pageInt>pageNumber||pageInt<1){pageInt = 1;} String footStr = "第"+pageStr+"页 共"+pageNumber+"页 "; if(pageInt!=1){ footStr+="<a href='/list.jsp?page=1'>首页</a> <a href='/list.jsp?page=" +(pageInt-1)+"'>上一页</a> "; } if(pageInt!=pageNumber){ footStr+="<a href='/list.jsp?page=" +(pageInt+1)+"'>下一页</a> <a href='list.jsp?page=" +pageNumber+"'>末页</a>"; } int first = count-(pageInt-1)*numberPerPage; String sqlStr2 = "select lwid,name,ip,time,content,leaveword.userid from leaveword,member where member.userid=leaveword.userid and groupid="+groupId+" ORDER BY lwid"; %> <jsp:useBean id="db2" scope="page" class="com.ljsilver.util.DatabaseOperate"> <jsp:setProperty name="db2" property="sqlStr" value="<%=sqlStr2%>"/> </jsp:useBean> <% db2.buildConnection(); ResultSet result2 = db2.getResultSet(); result2.absolute(first); String content=""; int i=0; if(count>0){ do{ content += "<table width=\"760\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" > " +"<tr bgcolor=\"#CCCCCC\"><td width=\"10%\" align=\"left\">"; content += result2.getString("name")+"</td><td width=\"20%\" align=\"left\">"; String[] address = net.acai.ip.IPLocalizer.search(result2.getString("ip")); content += "留言ip:"+result2.getString("ip")+"</td><td width=\"30%\" align=\"left\">"; content += "来自:<font color=\"0099FF\">"+address[0]+"</font>"+address[1] +"</td><td width=\"12%\" align=\"right\">"; if(selfUserId==result2.getInt("leaveword.userid")){ content +="<a href=/editleaveword.jsp?lwid="+result2.getInt("lwid")+">编辑</a>"; } content += " "; content += "<a href=/leaveword.jsp?quoteid="+result2.getInt("lwid")+">引用回复</a>"; content += "</td><td width=\"28%\" align=\"right\">"; content += "发表日期:"+result2.getString("time")+"</tr><tr>" +"<td colspan=\"5\" bgcolor=\"#FFFFFF\">"; content += com.ljsilver.util.HTMLString.HTMLUBB(result2.getString("content")); content +="</td></tr><tr><td colspan=\"5\"> </td></tr></table>"; i++; }while(result2.previous()&&i<numberPerPage); }else{ content+="<font color=\"blue\">暂无留言。<br><br><br></font>"; } db2.close(); %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>查看留言</title> <!--meta http-equiv="refresh" content="300;URL=/list.jsp"--> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <LINK rel="stylesheet" type="text/css" href="/inc/style.css"> <script language="JavaScript">
function checkliuyan(){ if(document.frmAnnounce.content.value==""){ alert("留言内容不能为空!"); document.frmAnnounce.content.focus(); return false; } document.frmAnnounce.submit(); } function pageload(){
document.frmAnnounce.content.focus(); } function AddText(NewCode) { document.frmAnnounce.content.value+=NewCode } helpstat = false; stprompt = true; basic = false; function thelp(swtch){ if (swtch == 1){ basic = false; stprompt = false; helpstat = true; } else if (swtch == 0) { helpstat = false; stprompt = false; basic = true; } else if (swtch == 2) { helpstat = false; basic = false; stprompt = true; } }
function email() { if (helpstat) { alert("Email 标记\n插入 Email 超级链接\n用法1: webmaster@aspsky.net\n用法2: 沙滩小子"); } else if (basic) { AddTxt=""; AddText(AddTxt); } else { txt2=prompt("链接显示的文字.\n如果为空,那么将只显示你的 Email 地址",""); if (txt2!=null) { txt=prompt("Email 地址.","name@domain.com"); if (txt!=null) { if (txt2=="") { AddTxt=""+txt+""; } else { AddTxt=""+txt2; AddText(AddTxt); AddTxt=""; } AddText(AddTxt); } } } } function flash() { if (helpstat){ alert("Flash 动画\n插入 Flash 动画.\n用法: [flash]Flash 文件的地址[/flash]"); } else if (basic) { AddTxt="[flash][/flash]"; AddText(AddTxt); } else { txt=prompt("Flash 文件的地址","http://"); if (txt!=null) { AddTxt="[flash]"+txt; AddText(AddTxt); AddTxt="[/flash]"; AddText(AddTxt); } } }
function showsize(size) { if (helpstat) { alert("文字大小标记\n设置文字大小.\n可变范围 1 - 6.\n 1 为最小 6 为最大.\n用法: 这是 \"+size+\" 文字"); } else if (basic) { AddTxt="[/size]\"; AddText(AddTxt); } else { txt=prompt(\"大小 \"+size,\"文字\"); if (txt!=null) { AddTxt=\"[size=\"+size+\"]\"+txt; AddText(AddTxt); AddTxt=\""; AddText(AddTxt); } } }
function bold() { if (helpstat) { alert("加粗标记\n使文本加粗.\n用法: 这是加粗的文字"); } else if (basic) { AddTxt=""; AddText(AddTxt); } else { txt=prompt("文字将被变粗.","文字"); if (txt!=null) { AddTxt=""+txt; AddText(AddTxt); AddTxt=""; AddText(AddTxt); } } }
function italicize() { if (helpstat) { alert("斜体标记\n使文本字体变为斜体.\n用法: [i]这是斜体字[/i]"); } else if (basic) { AddTxt="[i][/i]"; AddText(AddTxt); } else { txt=prompt("文字将变斜体","文字"); if (txt!=null) { AddTxt="[i]"+txt; AddText(AddTxt); AddTxt="[/i]"; AddText(AddTxt); } } }
function quote() { if (helpstat){ alert("引用标记\n引用一些文字.\n用法: "); } else if (basic) { AddTxt="[/quote]\"; AddText(AddTxt); } else { txt=prompt(\"被引用的文字\",\"文字\"); if(txt!=null) { AddTxt=\"[quote]\"+txt; AddText(AddTxt); AddTxt=\" |
| "; AddText(AddTxt); } } }
function showcolor(color) { if (helpstat) { alert("颜色标记\n设置文本颜色. 任何颜色名都可以被使用.\n用法: [color="+color+"]颜色要改变为"+color+"的文字[/color]"); } else if (basic) { AddTxt="[color="+color+"][/color]"; AddText(AddTxt); } else { txt=prompt("选择的颜色是: "+color,"文字"); if(txt!=null) { AddTxt="[color="+color+"]"+txt; AddText(AddTxt); AddTxt="[/color]"; AddText(AddTxt); } } }
function center() { if (helpstat) { alert("对齐标记\n使用这个标记, 可以使文本左对齐、居中、右对齐.\n用法: [align=center|left|right]要对齐的文本[/align]"); } else if (basic) { AddTxt="[align=center|left|right][/align]"; AddText(AddTxt); } else { txt2=prompt("对齐样式\n输入 'center' 表示居中, 'left' 表示左对齐, 'right' 表示右对齐.","center"); while ((txt2!="") && (txt2!="center") && (txt2!="left") && (txt2!="right") && (txt2!=null)) { txt2=prompt("错误!\n类型只能输入 'center' 、 'left' 或者 'right'.",""); } txt=prompt("要对齐的文本","文本"); if (txt!=null) { AddTxt="\r[align="+txt2+"]"+txt; AddText(AddTxt); AddTxt="[/align]"; AddText(AddTxt); } } }
function hyperlink() { if (helpstat) { alert("超级链接标记\n插入一个超级链接标记\n使用方法: http://www.justhis.com\nUSE: 链接文字"); } else if (basic) { AddTxt="[url][/url]"; AddText(AddTxt); } else { txt2=prompt("链接文本显示.\n如果不想使用, 可以为空, 将只显示超级链接地址. ",""); if (txt2!=null) { txt=prompt("超级链接.","http://"); if (txt!=null) { if (txt2=="") { AddTxt="[url]"+txt; AddText(AddTxt); AddTxt="[/url]"; AddText(AddTxt); } else { AddTxt="[url="+txt+"]"+txt2; AddText(AddTxt); AddTxt="[/url]"; AddText(AddTxt); } } } } }
function image() { if (helpstat){ alert("图片标记\n插入图片\n用法: [img]http://www.justhis.com/logo.gif[/img]"); } else if (basic) { AddTxt="[img][/img]"; AddText(AddTxt); } else { txt=prompt("图片的 URL","http://"); if(txt!=null) { AddTxt="\r[img]"+txt; AddText(AddTxt); AddTxt="[/img]"; AddText(AddTxt); } } }
function showcode() { if (helpstat) { alert("代码标记\n使用代码标记,可以使你的程序代码里面的 html 等标志不会被破坏.\n使用方法:\n [code]这里是代码文字[/code]"); } else if (basic) { AddTxt="\r[code]\r[/code]"; AddText(AddTxt); } else { txt=prompt("输入代码",""); if (txt!=null) { AddTxt="\r[code]"+txt; AddText(AddTxt); AddTxt="[/code]"; AddText(AddTxt); } } }
function list() { if (helpstat) { alert("列表标记\n建造一个文字或则数字列表.\n\nUSE:"); } else if (basic) { AddTxt=""; AddText(AddTxt); } else { txt=prompt("列表类型\n输入 'A' 表示有序列表, '1' 表示无序列表, 留空表示无序列表.",""); while ((txt!="") && (txt!="A") && (txt!="a") && (txt!="1") && (txt!=null)) { txt=prompt("错误!\n类型只能输入 'A' 、 '1' 或者留空.",""); } if (txt!=null) { if (txt=="") { AddTxt="; } else { AddTxt="[list="+txt+"]"; } txt="1"; while ((txt!="") && (txt!=null)) { txt=prompt("列表项\n空白表示结束列表",""); if (txt!="") { AddTxt+=""+txt+"[/*]"; } } AddTxt+=""; AddText(AddTxt); } } }
function showfont(font) { if (helpstat){ alert("字体标记\n给文字设置字体.\n用法: [face="+font+"]改变文字字体为"+font+"[/face]"); } else if (basic) { AddTxt="[face="+font+"][/face]"; AddText(AddTxt); } else { txt=prompt("要设置字体的文字"+font,"文字"); if (txt!=null) { AddTxt="[face="+font+"]"+txt; AddText(AddTxt); AddTxt="[/face]"; AddText(AddTxt); } } } function underline() { if (helpstat) { alert("下划线标记\n给文字加下划线.\n用法: 要加下划线的文字"); } else if (basic) { AddTxt=""; AddText(AddTxt); } else { txt=prompt("下划线文字.","文字"); if (txt!=null) { AddTxt=""+txt; AddText(AddTxt); AddTxt=""; AddText(AddTxt); } } } function setfly() { if (helpstat){ alert("飞翔标记\n使文字飞行.\n用法: "); } else if (basic) { AddTxt=""; AddText(AddTxt); } else { txt=prompt("飞翔文字","文字"); if (txt!=null) { AddTxt="+txt; AddText(AddTxt); AddTxt=""; AddText(AddTxt); } } }
function move() { if (helpstat) { alert("移动标记\n使文字产生移动效果.\n用法: "); } else if (basic) { AddTxt=""; AddText(AddTxt); } else { txt=prompt("要产生移动效果的文字","文字"); if (txt!=null) { AddTxt="+txt; AddText(AddTxt); AddTxt=""; AddText(AddTxt); } } }
function shadow() { if (helpstat) { alert("阴影标记\n使文字产生阴影效果.\n用法: [SHADOW=宽度, 颜色, 边界]要产生阴影效果的文字[/SHADOW]"); } else if (basic) { AddTxt="[SHADOW=255,blue,1][/SHADOW]"; AddText(AddTxt); } else { txt2=prompt("文字的长度、颜色和边界大小","255,blue,1"); if (txt2!=null) { txt=prompt("要产生阴影效果的文字","文字"); if (txt!=null) { if (txt2=="") { AddTxt="[SHADOW=255, blue, 1]"+txt; AddText(AddTxt); AddTxt="[/SHADOW]"; AddText(AddTxt); } else { AddTxt="[SHADOW="+txt2+"]"+txt; AddText(AddTxt); AddTxt="[/SHADOW]"; AddText(AddTxt); } } } } }
function rm() { if (helpstat) { alert("realplay\n播放realplay文件.\n用法: [rm=宽度, 高度]文件地址[/rm]"); } else if (basic) { AddTxt="[rm=500,350][/rm]"; AddText(AddTxt); } else { txt2=prompt("视频的宽度,高度","500,350"); if (txt2!=null) { txt=prompt("视频文件的地址","请输入"); if (txt!=null) { if (txt2=="") { AddTxt="[rm=500,350]"+txt; AddText(AddTxt); AddTxt="[/rm]"; AddText(AddTxt); } else { AddTxt="[rm="+txt2+"]"+txt; AddText(AddTxt); AddTxt="[/rm]"; AddText(AddTxt); } } } } }
function mp() { if (helpstat) { alert("Media Player\n播放Media Player文件.\n用法: [mp=宽度, 高度]文件地址[/mp]"); } else if (basic) { AddTxt="[mp=500,350][/mp]"; AddText(AddTxt); } else { txt2=prompt("视频的宽度,高度","500,350"); if (txt2!=null) { txt=prompt("视频文件的地址","请输入"); if (txt!=null) { if (txt2=="") { AddTxt="[mp=500,350]"+txt; AddText(AddTxt); AddTxt="[/mp]"; AddText(AddTxt); } else { AddTxt="[mp="+txt2+"]"+txt; AddText(AddTxt); AddTxt="[/mp]"; AddText(AddTxt); } } } } }
function qt() { if (helpstat) { alert("QuickTime\n播放QuickTime文件.\n用法: [qt=宽度, 高度]文件地址[/qt]"); } else if (basic) { AddTxt="[qt=500,350][/qt]"; AddText(AddTxt); } else { txt2=prompt("视频的宽度,高度","500,350"); if (txt2!=null) { txt=prompt("视频文件的地址","请输入"); if (txt!=null) { if (txt2=="") {   |