package service;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.http.HttpSession;
import model.TAdmin;
import org.directwebremoting.WebContext;
import org.directwebremoting.WebContextFactory;
import db.DB;
public class loginService
{
public String login(String userName,String userPw,int userType)
{
String result="no";
if(userType==0)//系统管理员登陆
{
String sql="select * from t_admin where userName=? and userPw=?";
Object[] params={userName,userPw};
DB mydb=new DB();
mydb.doPstm(sql, params);
try
{
ResultSet rs=mydb.getRs();
boolean mark=(rs==null||!rs.next()?false:true);
if(mark==false)
{
result="no";
}
else
{
result="yes";
TAdmin admin=new TAdmin();
admin.setUserId(rs.getInt("userId"));
admin.setUserName(rs.getString("userName"));
admin.setUserPw(rs.getString("userPw"));
WebContext ctx = WebContextFactory.get();
HttpSession session=ctx.getSession();
session.setAttribute("userType", 0);
session.setAttribute("admin", admin);
}
rs.close();
}
catch (SQLException e)
{
System.out.println("登录失败!");
e.printStackTrace();
}
finally
{
mydb.closed();
}
}
if(userType==1)
{
String sql="select * from t_yonghu where loginName = ? and loginPass = ? and del='no'";
Object[] params={userName,userPw};
DB mydb=new DB();
mydb.doPstm(sql, params);
try
{
ResultSet rs=mydb.getRs();
boolean mark=(rs==null||!rs.next()?false:true);
if(mark==false)
{
result="no";
}
else
{
result="yes";
/*TYonghu yonghu = new TYonghu();
yonghu.setId(rs.getInt("id"));
yonghu.setXingming(rs.getString("xingming"));
yonghu.setLoginName(rs.getString("loginName"));
yonghu.setLoginPass(rs.getString("loginPass"));
WebContext ctx = WebContextFactory.get();
HttpSession session=ctx.getSession();
session.setAttribute("userType", 1);
session.setAttribute("yonghu", yonghu);*/
}
rs.close();
}
catch (SQLException e)
{
System.out.println("登录失败!");
e.printStackTrace();
}
finally
{
mydb.closed();
}
}
return result;
}
public String adminPwEdit(String userPwNew)
{
WebContext ctx = WebContextFactory.get();
HttpSession session=ctx.getSession();
TAdmin admin=(TAdmin)session.getAttribute("admin");
String sql="update t_admin set userPw=? where userId=?";
Object[] params={userPwNew,admin.getUserId()};
DB mydb=new DB();
mydb.doPstm(sql, params);
return "yes";
}
public String yonghuPwEdit(String userPwNew)
{/*
WebContext ctx = WebContextFactory.get();
HttpSession session=ctx.getSession();
TYonghu yonghu=(TYonghu)session.getAttribute("yonghu");
String sql="update t_yonghu set loginPass=? where id=?";
Object[] params={userPwNew,yonghu.getId()};
DB mydb=new DB();
mydb.doPstm(sql, params);*/
return "yes";
}
public String yonghuCheck(String loginName,String loginPass){
String result = "no";
String sql = "select 1 from t_yonghu where loginName = ? and loginPass = ?";
Object[] params={loginName,loginPass};
DB mydb=new DB();
mydb.doPstm(sql, params);
try
{
ResultSet rs=mydb.getRs();
if(rs.next())
{
result="yes";
}
rs.close();
}
catch (SQLException e)
{
System.out.println("登录失败!");
e.printStackTrace();
}
finally
{
mydb.closed();
}
return result;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
基于Java+JSP的 JAVA商场VIP消费查询系统(毕业设计作品)毕业设计实现+源码.zip
共183个文件
gif:112个
jsp:19个
jar:18个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 1 下载量 92 浏览量
2022-04-20
22:30:42
上传
评论
收藏 13.46MB ZIP 举报
温馨提示
基于Java+JSP的 JAVA商场VIP消费查询系统(毕业设计作品)毕业设计实现+源码.zip
资源推荐
资源详情
资源评论
收起资源包目录
基于Java+JSP的 JAVA商场VIP消费查询系统(毕业设计作品)毕业设计实现+源码.zip (183个子文件)
商场VIP消费查询系统录像.avi 29.53MB
xiaofei_servlet.class 9KB
huiyuan_servlet.class 5KB
loginService.class 4KB
DB.class 4KB
THuiyuan.class 2KB
TXiaofei.class 2KB
EncodingFilter.class 2KB
DateUtils.class 1KB
TAdmin.class 910B
.classpath 2KB
css.css 10KB
base.css 5KB
woncore.css 3KB
dtree.css 795B
reservation01.gif 22KB
login-content-bg.gif 20KB
login-wel.gif 9KB
login_06.gif 4KB
main_01.gif 3KB
main_21.gif 3KB
main_06.gif 3KB
main_37.gif 2KB
loading.gif 2KB
main_17.gif 2KB
main_066.gif 2KB
main_05.gif 2KB
left_2.gif 1KB
left_4.gif 1KB
left_3.gif 1KB
left_1.gif 1KB
top_12.gif 1KB
globe.gif 1KB
top_14.gif 1KB
top_15.gif 1KB
top_9.gif 1KB
top_13.gif 1KB
login_09.gif 1KB
trash.gif 1KB
question.gif 1KB
top_10.gif 1KB
base.gif 1KB
top_17.gif 1KB
top_11.gif 1KB
top_8.gif 1KB
top_18.gif 995B
nolines_plus.gif 870B
nolines_minus.gif 861B
main_07.gif 821B
main_09.gif 734B
musicfolder.gif 633B
imgfolder.gif 622B
head1.gif 610B
page.gif 582B
main_13.gif 580B
top_16.gif 574B
top_7.gif 561B
main_25.gif 559B
xyb.gif 556B
syb.gif 554B
top_5.gif 523B
main_36.gif 498B
main_43.gif 493B
right_03.gif 486B
main_15.gif 441B
luck.gif 429B
main_03.gif 427B
main_38.gif 426B
folderopen.gif 376B
tab_bg.gif 376B
folder.gif 372B
qx.gif 359B
main_30.gif 354B
main_30_1.gif 354B
dl.gif 341B
main_40.gif 339B
main_11.gif 334B
top_4.gif 316B
top_3.gif 316B
wbg.gif 311B
login_03.gif 305B
right_10.gif 294B
main_18.gif 285B
cd.gif 239B
top_6.gif 214B
top_2.gif 211B
right_06.gif 211B
right_12.gif 200B
right_061.gif 195B
login-top-bg.gif 174B
Submit_bg.gif 171B
top_1.gif 146B
dialogclose.gif 114B
login-buttom-bg.gif 112B
main_29.gif 101B
main_27.gif 101B
main_32.gif 99B
mini_icons_046.gif 94B
plus.gif 89B
plusbottom.gif 88B
共 183 条
- 1
- 2
资源评论
- m0_690110102022-06-29用户下载后在一定时间内未进行评价,系统默认好评。
zzzzl333
- 粉丝: 701
- 资源: 7万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功