书签 分享 收藏 举报 版权申诉 / 18

类型JSP SQL实现用户登录与注册.docx

  • 文档编号:7183390
  • 上传时间:2023-01-21
  • 格式:DOCX
  • 页数:18
  • 大小:20.74KB

用户登陆

用户名:

密 码:

注册新用户

Logon.jsp

<%@pagecontentType="text/html;charset=gb2312"language="java"import="java.sql.*"errorPage=""%>

DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http:

//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

//www.w3.org/1999/xhtml">

登陆确认

functionBackWard()

{

history.back();

}

--

.STYLE2{

font-size:

24px;

font-family:

"宋体";

font-weight:

bold;

color:

#FF0000;

}

.STYLE3{

font-family:

"新宋体";

font-size:

16px;

}

.STYLE4{color:

#FF0000}

.STYLE5{

font-size:

12px;

line-height:

14px;

text-decoration:

none;

}

-->

<%

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Stringdriver="jdbc:

odbc:

try";

Connectionconn=DriverManager.getConnection(driver);

Statementstmt=conn.createStatement();

booleana;

Stringuid=request.getParameter("uid");

Stringpassword=request.getParameter("password");

Stringsql="select*fromcustomwhereuid='"+uid+"'andpassword='"+password+"'";

ResultSetrs=stmt.executeQuery(sql);

a=rs.next();

if(a==false)

{rs.close();

session.setAttribute("uid",uid);

%>

:

)欢迎您<%=uid%>

<%}

else

{

rs.close();

%>

输入错误,请重新填写!

<%}%>

Logoff.jsp

<%@pagecontentType="text/html;charset=gb2312"language="java"import="java.sql.*"errorPage=""%>

DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http:

//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

//www.w3.org/1999/xhtml">

用户注销

--

.STYLE2{

font-size:

24px;

font-family:

"宋体";

font-weight:

bold;

color:

#FF0000;

}

.STYLE3{

font-family:

"新宋体";

font-size:

16px;

}

.STYLE4{color:

#FF0000}

.STYLE5{

font-size:

12px;

line-height:

14px;

text-decoration:

none;

}

-->

 

成功注销!


5秒后自动返回首页,如果你不想等待,可以点击这里返回首页

<%response.setHeader("Refresh","5;URL=index.jsp");%>

Register.jsp

<%@pagecontentType="text/html;charset=gb2312"language="java"import="java.sql.*"errorPage=""%>

DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http:

//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

//www.w3.org/1999/xhtml">

用户注册

--

.STYLE2{

font-size:

24px;

font-family:

"宋体";

font-weight:

bold;

color:

#FF0000;

}

.STYLE3{

font-family:

"新宋体";

font-size:

16px;

}

.STYLE4{color:

#FF0000}

.STYLE5{

font-size:

12px;

line-height:

14px;

text-decoration:

none;

}

-->

--

functionCheckSubmit()

{

if(document.registerform.uid.value=="")

{alert("请输入用户名!

");document.registerform.uid.focus();returnfalse;}

if(document.registerform.password.value=="")

{alert("请输入密码!

");document.registerform.password.focus();returnfalse;}

if(document.registerform.password2.value=="")

{alert("请验证密码!

");document.registerform.password2.focus();returnfalse;}

if(document.registerform.password2.value!

=document.registerform.password.value)

{alert("密码验证出错!

");document.registerform.password.focus();returnfalse;}

if(document.registerform.username.value=="")

{alert("请输入真实姓名!

");document.registerform.username.focus();returnfalse;}

returntrue;

}

请如实填写下面的注册申请单(*为必填项)

用户ID:

*

密   码:

*

验证密码:

*

真实姓名:

*

性   别:

*

Register1.jsp

<%@pagecontentType="text/html;charset=gb2312"language="java"import="java.sql.*"errorPage=""%>

DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http:

//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

//www.w3.org/1999/xhtml">

注册信息确认

--

.STYLE2{

font-size:

24px;

font-family:

"宋体";

font-weight:

bold;

color:

#FF0000;

}

.STYLE3{

font-family:

"新宋体";

font-size:

16px;

}

.STYLE4{color:

#FF0000}

.STYLE5{

font-size:

12px;

line-height:

14px;

text-decoration:

none;

}

-->

functionbackward()

{

history.back();

}

<%

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Stringdriver="jdbc:

odbc:

try";

Connectionconn=DriverManager.getConnection(driver);

Statementstmt=conn.createStatement();

Stringuid=request.getParameter("uid");

Stringsql="select*fromcustomwhereuid='"+uid+"'";

ResultSetrs=stmt.executeQuery(sql);

if(rs.next())

{

rs.close();

stmt.close();

conn.close();

%>

用户名不能重名,请重新选择!

<%}

else{

rs.close();

Stringusername=request.getParameter("username");

Stringgender=request.getParam

举报
举报
版权申诉
版权申诉
word格式文档无特别注明外均可编辑修改;预览文档经过压缩,下载后原文更清晰! 立即下载
配套讲稿:

如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

特殊限制:

部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

关 键  词:
JSP SQL实现用户登录与注册 SQL 实现 用户 登录 注册
提示  冰豆网所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
关于本文
本文标题:JSP SQL实现用户登录与注册.docx
链接地址:https://www.bdocx.com/doc/7183390.html
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2008-2022 冰点文档网站版权所有

经营许可证编号:鄂ICP备2022015515号-1

收起
展开