?? gb_del.jsp
字號(hào):
<%@page import="java.util.*" %>
<%@ page contentType="text/html; charset=GBK" %>
<jsp:useBean id="redhat" class="com.my.www.redhat.myfile" scope="request" />
<%@ include file="config.jsp" %>
<%
String id = "";
if(request.getParameter("id") != null){
id = request.getParameter("id");
}
String inpass;
String errmsg;
redhat.setFile(file);
String s = new String(redhat.fileRead());
String[] tmp = s.split(sp1);
String[] tmps;
StringBuffer sb = new StringBuffer("");
int l = tmp.length;
if(request.getParameter("inpass") != null){
inpass = request.getParameter("inpass");
if(inpass.equals(pass)){
for(int i=0;i<l;i++){
tmps = tmp[i].split(sp);
if(tmps[0].equals(id)){
continue;
}
else{
sb.append(tmp[i]+sp1);
}
}
redhat.setMsg(new String(sb));
redhat.fileWrite();
out.println("<script language=\"javascript\">alert('刪除留言成功');window.location.href=\"index.jsp\";</script>");
}
else{
errmsg = "密碼錯(cuò)誤,<a href=\"javascript:window.history.back(-1)\">點(diǎn)擊此處返回</a>";
out.println(errmsg);
}
}
else{
%>
<html>
<head>
<title>刪除留言</title>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="style.css" rel=stylesheet>
</head>
<body bgcolor='#ffffff'>
<center>
<p>
<span style="font-size:15px;color:red">刪除留言</span>
<hr size=1 color=gray>
<table cellpadding='4' cellspacing='0' border='0' width='60%' align='center' class="write">
<tr bgcolor="white"><Td>
<form action="<%=request.getRequestURL()%>" method="post">
<input type="hidden" name="id" value="<%=id%>">
密碼:<input type="password" name="inpass" >
<center><input type="submit" value="刪除"></center>
</form>
</td></tr>
</table>
</p>
</center>
</body>
</html>
<%
}
%>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -