forked from maxliaops/Java_Web_Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanage_user.jsp
More file actions
163 lines (162 loc) · 5.29 KB
/
manage_user.jsp
File metadata and controls
163 lines (162 loc) · 5.29 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<%@ page contentType="text/html; charset=gb2312"%>
<%@ page import="com.model.User"%>
<%@ page import="com.core.*"%>
<%@ page import="java.util.*"%>
<%
if (!Crazyadept.UserIsOK(session, FinalConstants.STATUS_ADMIN))
return;
%>
<html>
<head>
<title>view_user</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<link href="../css/admin.css" rel="stylesheet" type="text/css">
<body>
<table width="98%" border="0" align="center" cellpadding="0"
cellspacing="1" class="tableNew">
<tr align="center">
<td colspan="4" class="TableTitle1">
用户管理
</td>
</tr>
<tr align="center">
<td height="27" bgcolor="#FFFFFF">
用户ID
</td>
<td bgcolor="#FFFFFF">
注册时间
</td>
<td bgcolor="#FFFFFF">
用户权根
</td>
<td bgcolor="#FFFFFF">
用户状态
</td>
</tr>
<%
String uid = "", name = "", tel = "", qq = "", email = "", http = "", address = "", sql = "", age = "";
int int_age = -1;
String value = ParamUtils.getRequestString(request, "select");
if ("uid".equals(value)) {
uid = ParamUtils.getRequestString(request, "value");
} else if ("name".equals(value)) {
name = ParamUtils.getRequestString(request, "value");
} else if ("tel".equals(value)) {
tel = ParamUtils.getRequestString(request, "value");
} else if ("qq".equals(value)) {
qq = ParamUtils.getRequestString(request, "value");
} else if ("email".equals(value)) {
email = ParamUtils.getRequestString(request, "value");
} else if ("http".equals(value)) {
http = ParamUtils.getRequestString(request, "value");
} else if ("address".equals(value)) {
address = ParamUtils.getRequestString(request, "value");
} else if ("age".equals(value)) {
int_age = ParamUtils.getIntParameter(request, "value", -1);
}
uid = StringUtils.SqlToLink(uid);
name = StringUtils.SqlToLink(name);
tel = StringUtils.SqlToLink(tel);
qq = StringUtils.SqlToLink(qq);
email = StringUtils.SqlToLink(email);
http = StringUtils.SqlToLink(http);
address = StringUtils.SqlToLink(address);
age = StringUtils.SqlToLink(int_age);
String sex = StringUtils.SqlToLink(ParamUtils.getIntParameter(
request, "sex", -1));
String status = StringUtils.SqlToLink(ParamUtils.getIntParameter(
request, "status", -1));
String state = StringUtils.SqlToLink(ParamUtils.getIntParameter(
request, "state", -1));
String submit = ParamUtils.getRequestString(request, "submit");
if (submit == null || "".equals(submit)) {
try {
sql = session.getAttribute("sqlsearch").toString();
} catch (Exception e) {
}
} else {
sql = " WHERE uid " + uid + " AND name " + name + " AND tel "
+ tel + " AND qq " + qq + " AND email " + email
+ " AND http " + http + " AND address " + address
+ " AND age " + age + " AND sex " + sex
+ " AND status " + status + " AND state " + state;
session.setAttribute("sqlsearch", sql);
}
BasetableFactory bf = BasetableFactory.getInstance();
int submit_page = ParamUtils.getIntParameter(request, "page");
Collection coll = bf.ListUser(submit_page, sql);
if (coll == null || coll.size() <= 0) {
%>
<tr align="center">
<td height="27" colspan="4" bgcolor="#FFFFFF">
当前用户记录为空
</td>
</tr>
<%
} else {
Iterator it = coll.iterator();
while (it.hasNext()) {
User user = (User) it.next();
%>
<tr align="center">
<td height="27" bgcolor="#FFFFFF">
<a target="_self" href="info_user.jsp?uid=<%=user.getUid()%>"><%=user.getUid()%></a>
</td>
<td bgcolor="#FFFFFF"><%=user.getRegtime()%></td>
<form method="post" action="modify_user.jsp">
<td bgcolor="#FFFFFF">
<input name="status" type="radio" class="noborder"
onChange="Jscript:submit();" value="1"
<%=user.getStatus() == FinalConstants.STATUS_ADMIN ? "checked"
: ""%>>
管理员
<%
if (!"mr".equals(user.getUid())) {
%>
<input name="status" type="radio" class="noborder"
onChange="Jscript:submit();" value="0"
<%=user.getStatus() == FinalConstants.STATUS_USER ? "checked"
: ""%>>
普通用户
<%
}
%>
<input type="hidden" name="uid" value="<%=user.getUid()%>">
</td>
</form>
<form method="post" action="modify_user.jsp">
<td bgcolor="#FFFFFF">
<input name="state" type="radio" class="noborder"
onChange="Jscript:submit();" value="0"
<%=user.getState() == FinalConstants.STATE_FREE ? "checked"
: ""%>>
正常
<%
if (!"mr".equals(user.getUid())) {
%>
<input name="state" type="radio" class="noborder"
onChange="Jscript:submit();" value="1"
<%=user.getState() == FinalConstants.STATE_FREEZE ? "checked"
: ""%>>
冻结
<%
}
%>
<input type="hidden" name="uid" value="<%=user.getUid()%>">
</td>
</form>
</tr>
<%
}
%>
<tr align="right">
<td height="27" colspan="4" bgcolor="#E9F2F6"><%=HtmlUtils.table(bf.getRow("user" + sql), submit_page,
"manage_user.jsp")%></td>
</tr>
<%
}
%>
</table>
</body>
</html>