-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdelete1.jsp
79 lines (77 loc) · 2.18 KB
/
delete1.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<%@page language="java" import="java.sql.*" pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%
request.setCharacterEncoding("UTF-8");
Class.forName("com.mysql.jdbc.Driver");
Connection conn=
DriverManager.getConnection("jdbc:mysql://localhost:3306/zk2013150138?user=root&password=");
Statement stat=conn.createStatement();
%>
<html>
<head>
<title>删 除</title>
</head>
<body>
<%
ArrayList l=(ArrayList)session.getAttribute("login");
String type=(String)l.get(1);
String id=request.getParameter("id");
String ty=request.getParameter("ty");
String tid=request.getParameter("tid");
if(type.equals("tea")&&ty.equals("re")){
String sql2="delete from reply where cid='"+id+"'";
stat.executeUpdate(sql2);
%>
<p align="center"><font color="#297405" size="5">
<%out.println("评论删除成功!");%>
<br>页面将在1秒后自动跳转…………</font></p></font></p>
</font></p>
<script type="text/javascript">
window.setTimeout("time2()","1000");
function time2(){window.location.href="topic.jsp?id=<%out.print(tid);%>";}
</script>
<%
}
else if(type.equals("tea")&&ty.equals("kj")){
String sql="delete from file where name='"+id+"'";
stat.executeUpdate(sql);
%>
<p align="center"><font color="#297405" size="5">
<%out.println("主题删除成功!");%>
<br>页面将在1秒后自动跳转…………</font></p></font></p>
</font></p>
<script type="text/javascript">
window.setTimeout("time2()","1000");
function time2(){window.location.href="kejian.jsp";}
</script>
<%
}
else if(ty.equals("re")&&!type.equals("tea"))
{
%>
<p align="center"><font color="#297405" size="5">
<%out.println("你不是老师,不能删除");%>
<br>页面将在1秒后自动跳转…………</font></p></font></p>
</font></p>
<script type="text/javascript">
window.setTimeout("time2()","1000");
function time2(){window.location.href="topic.jsp?id=<%out.print(tid);%>";}
</script>
<%
}
else
{
%>
<p align="center"><font color="#297405" size="5">
<%out.println("你不是老师,不能删除");%>
<br>页面将在1秒后自动跳转…………</font></p></font></p>
</font></p>
<script type="text/javascript">
window.setTimeout("time2()","1000");
function time2(){window.location.href="kejian.jsp";}
</script>
<%
}
%>
</body>
</html>