package ch11.bean;
import java.util.*;
import java.sql.Connection;
import java.sql.ResultSet;
import ch11.util.*;
public class User {
private String username = null;
private String password = null;
private String nickname = null;
private String sex = null;
private String birthyear = null;
private String birthmonth = null;
private String birthday = null;
private String email = null;
private String mobile = null;
private String signiture = null;
private String grade = null;
private int score = 0;
public User(){}
public void setUsername(String username) {
this.username = username;
}
public String getUsername() {
return username;
}
public void setPassword(String password) {
this.password = password;
}
public String getPassword() {
return password;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getNickname() {
return nickname;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getSex() {
return sex;
}
public void setBirthyear(String birthyear) {
this.birthyear = birthyear;
}
public String getBirthyear() {
return birthyear;
}
public void setBirthmonth(String birthmonth) {
this.birthmonth = birthmonth;
}
public String getBirthmonth() {
return birthmonth;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
public String getBirthday() {
return birthday;
}
public void setEmail(String email) {
this.email = email;
}
public String getEmail() {
return email;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getMobile() {
return mobile;
}
public void setSigniture(String signiture) {
this.signiture = signiture;
}
public String getSigniture() {
return signiture;
}
public void setGrade(String grade) {
this.grade = grade;
}
public String getGrade() {
return grade;
}
public void setScore(int score) {
this.score = score;
}
public int getScore() {
return score;
}
public static boolean checkUser(DB db,String name,String psw) throws Exception{
String strSql;
ResultSet rs;
strSql = "select * from user where username='"
+ name + "' and password='" + psw + "'";
rs = db.execQuery(strSql);
if ( rs.next()) {
return true;
}
else{
return false;
}
}
public boolean Insert(DB db) throws Exception{
String strSql;
strSql = "insert into user values('"
+ username +"','"
+ password +"','"
+ nickname +"','"
+ sex +"','"
+ birthyear +"','"
+ birthmonth+"','"
+ birthday +"','"
+ email +"','"
+ mobile +"','"
+ signiture +"','普通用户',100)";
if ( db.execUpdate(strSql)==0) {
return false;
}
else{
return true;
}
}
public static String getUserGrade(DB db,String name) throws Exception{
String strSql;
ResultSet rs;
strSql = "select * from user where username='"
+ name + "'";
rs = db.execQuery(strSql);
if ( rs.next()) {
return rs.getString("usergrade");
}
else{
return null;
}
}
public static Vector Search(DB db ,String username) throws Exception{
Vector Users = new Vector();
ResultSet rs,rsNest;
String strSql=null;
strSql = "select * from user where username like '%" + username + "%'";
rs = db.execQuery(strSql);
while (rs.next()){
User user = new User();
user.setUsername(rs.getString("username")) ;
user.setGrade(rs.getString("usergrade")) ;
Users.add(user);
}
return Users;
}
public static Vector SearchMaster(DB db) throws Exception{
Vector Users = new Vector();
ResultSet rs,rsNest;
String strSql=null;
strSql = "select * from user where usergrade = '斑竹'";
rs = db.execQuery(strSql);
while (rs.next()){
User user = new User();
user.setUsername(rs.getString("username")) ;
user.setGrade(rs.getString("usergrade")) ;
Users.add(user);
}
return Users;
}
public static boolean Delete(DB db,String username) throws Exception{
String strSql;
strSql = "delete from user where username='"+username+"'";
if ( db.execUpdate(strSql)==0) {
return false;
}
else{
return true;
}
}
public static boolean Edit(DB db,String username,String grade,String sort) throws Exception{
String strSql;
strSql = "update user set usergrade='"+grade+"' where username='"+username+"'";
if ( db.execUpdate(strSql)==0) {
return false;
}
else{
if (!grade.equals("斑竹")){
strSql = "update sort set master='' where master='"+username+"'";
db.execUpdate(strSql);
}
return true;
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
用JSP写网上论坛BBS系统
共227个文件
gif:96个
class:35个
java:35个
4星 · 超过85%的资源 需积分: 9 102 下载量 140 浏览量
2009-12-10
09:41:44
上传
评论 1
收藏 2.1MB RAR 举报
温馨提示
用JSP写的一个简单的BBS.整个网站分前台,后台俩个部分,即针对上网用户的论坛界面和针对论坛管理人员管理界面。这个对于要写留言板的人也满实用的。
资源推荐
资源详情
资源评论
收起资源包目录
用JSP写网上论坛BBS系统 (227个子文件)
Resource_temp.properties.bak 854B
Resource_temp.properties.bak 854B
User.class 6KB
NewTopicSubmitAction.class 4KB
Respond.class 4KB
Sort.class 4KB
SignAction.class 3KB
TopicAction.class 3KB
ActionUserEdit.class 3KB
ActionSortInsert.class 3KB
Topic.class 3KB
ActionSortEditSubmit.class 3KB
LoginAction.class 3KB
ActionTopicDel.class 3KB
ActionAdminLogin.class 3KB
ActionSortDel.class 3KB
ActionUserDel.class 3KB
ActionUserAdmin.class 3KB
ActionSortAdmin.class 3KB
UserForm.class 3KB
TopicDisp.class 3KB
ActionSortEdit.class 2KB
ActionTopicSearch.class 2KB
ContentAction.class 2KB
ActionUserSearch.class 2KB
NewTopicAction.class 2KB
DB.class 2KB
CodeFilter.class 2KB
AdminQuitAction.class 1KB
QuitAction.class 1KB
ActionSortPreInsert.class 1KB
PreSignAction.class 1KB
Constants.class 1KB
SortForm.class 974B
MyRequestProcessor.class 963B
LoginUserForm.class 781B
TopicForm.class 512B
style.css 2KB
style.css 2KB
Thumbs.db 104KB
Thumbs.db 104KB
btn_28.gif 1KB
btn_28.gif 1KB
btn_30.gif 1KB
btn_30.gif 1KB
btn_32.gif 1KB
btn_32.gif 1KB
bg_01.gif 1KB
bg_01.gif 1KB
b012.gif 942B
b012.gif 942B
btn_10.gif 882B
btn_10.gif 882B
btn_07.gif 843B
btn_07.gif 843B
b022.gif 799B
b022.gif 799B
btn_18.gif 722B
btn_18.gif 722B
btn_24.gif 642B
btn_24.gif 642B
icon_15.gif 601B
icon_15.gif 601B
btn_01.gif 560B
btn_01.gif 560B
btn_05.gif 545B
btn_05.gif 545B
btn_09.gif 533B
btn_02.gif 533B
btn_09.gif 533B
btn_02.gif 533B
btn_08.gif 523B
btn_08.gif 523B
part1_38.gif 522B
part1_38.gif 522B
icon_04.gif 475B
icon_04.gif 475B
icon_36.gif 470B
icon_36.gif 470B
icon_37.gif 334B
icon_37.gif 334B
female_2.gif 327B
female_2.gif 327B
male_2.gif 324B
male_2.gif 324B
icon_27.gif 267B
icon_27.gif 267B
201.gif 264B
icon_5.gif 264B
201.gif 264B
icon_5.gif 264B
icon_29.gif 263B
icon_29.gif 263B
icon_7.gif 262B
icon_25.gif 262B
icon_7.gif 262B
icon_25.gif 262B
icon_10.gif 261B
icon_24.gif 261B
icon_10.gif 261B
共 227 条
- 1
- 2
- 3
资源评论
- Windows26112011-12-20运行虽然有点错误,但还是要顶下
- u0111203532013-06-18文件有错误,但比我强多啦
- Jone_Chiang2013-06-23有错,可以参考
- NJNBJL2014-04-30有错误,自己还不会改........
- lexine2013-05-09运行有错误还是鼓励一下
cl359250030
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功