用SQL Server验证用户名和密码
用SQL Server验证用户名和密码,从页面输入的用户名和密码与数据库的用户名和密码进行匹配,正确则登入,错误则提醒。
<form action="index.jsp" method="post" >
<!--大的div框架开始-->
<div id="div"> <!--左边div框架开始-->
<div id="div1">
<p style="margin-left:30px;"><img src="data:image/login/vjia.gif"></img></p>
<div style="width:350px;height:20px;margin-left:30px;margin-top:-10px">
<p><hr/></p>
</div>
<p style="margin-top:0px;margin-left:30px"><img src="data:image/red_btn.gif"></img></p>
<p style="margin-top:-35px;margin-left:40px;color:#fff;font-size:12px;align:center">Vjia用户</p> <p style="margin-top:-28px;margin-left:110px"><img src="data:image/btn_long.gif"></img></p>
<p style="margin-top:-35px;margin-left:120px;font-size:12px">Vancl用户</p> <div style="width:350px;height:20px;margin-left:30px;margin-top:-8px">
<p><hr/></p>
</div> <p style="margin-left:60px">用户名:<input type="text" name="userName"></p>
<p style="margin-left:75px">密码:<input type="password" name="password"></p> <p style="margin-left:150px;margin-top:10px"><input type="submit" value="" style="width:65px;height:26px;background:url(image/tu2.gif)"></p> <p style="margin-left:30px;margin-top:30px;margin-right:80px">使用合作伙伴账号登入Vjia:<img src="data:image/account_qq.gif"></img></p> <p style="margin-left:30px;margin-top:0px;color:red;font-weight:bold">温馨提示:</p> <p style="text-indent:3em;font-size:14px">如果还未注册VJIA用户,您可以使用VANCL用户名进行登录,登录后系统会自动为您注册一个与VANCL账户相关联的VJIA账户。账户关联后您可共享VANCL的会员积分和消费金额。</p>
<p style="margin-top:30px;margin-left:100px">有任何疑问请点击<font style="font-weight:bold">帮助中心</font>或<font style="font-weight:bold">联系客服</font></p>
</div>
</form>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="jdbc.sqlServer"%> <%
String userName = request.getParameter("userName");
userName = new String(userName.getBytes("ISO-8859-1"),"utf-8");
String password = request.getParameter("password"); //引用连接数据库方法
sqlServer sq=new sqlServer();
//得到数据库连接
Connection con = sq.getConnection();
//编写sql语句
String sql="select * from Admin where userName=? and password=? ";
//得到数据库操作对象
PreparedStatement st=null;
st =con.prepareStatement(sql);
st.setString(1,userName);
st.setString(2,password); //得到结果集
ResultSet rs=null;
rs=st.executeQuery();
if(rs.next()){
session.setAttribute("url",userName); %>
<script type="text/javascript">
alert("登入成功");
location="jieHe.jsp";
</script>
<% }else{
%>
<script type="text/javascript">
alert("请先注册,后登入");
location="doLog.jsp";
</script>
<% }
//释放资源
sq.ShiFang(rs,st,con); %>
用SQL Server验证用户名和密码的更多相关文章
- sql server 设置用户名和密码
安全性:security 登录名:Logins 可以双击直接对里面现有的用户权限进行修改 也可以右击新建新用户 并对新用户权限进行设置
- 【转】在SQL Server 2008中SA密码丢失了怎么办?
sql server 2008的sa用户莫名其妙就登陆不进去了.提示如下: 以上提示就表明是密码错误,但密码我可是记得牢牢的,也许是系统被黑的原因吧.一直以来我的Windows身份验证就用不起,以下方 ...
- c# 调用mysql数据库验证用户名和密码
使用mysql数据库验证用户名和密码时,如果用户名是中文,一直查不到数据 需要把app.config 中修改为 数据库统一设置utf8编码格式,连接数据库的时候设置编码Charset=utf8可以避免 ...
- Android 设置代理(验证用户名和密码)
这几天在研究在Android中,解析网页,但是公司内容,链接外网需要代理,并需要验证用户名和密码,十分头疼,网上查了下,没有头绪,最后总算在一个外国博客中看到类似的,记录下 URL url = new ...
- django 使用form验证用户名和密码
form验证可以减少查询数据库,所以代码先预先验证,有问题可以返回给前端显示 1.在users文件夹下新建forms.py文件,用来验证用户名和密码是否为空,密码长度是否大于6 # -*- codin ...
- SQL Server 验证身份证合法性函数(使用VBScript.RegExp)
原文:SQL Server 验证身份证合法性函数(使用VBScript.RegExp) 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/wzy0623 ...
- SQL Server 2014忘记SA密码或禁用而且Windows身份验证也无法登录的解决办法
SQL Server双重验证都无法验证的情况下如何处理 1.以管理员身份运行sql配置管理器 2.打开[Sql Server 服务]节点关掉所有服务 3.双击本地实例[SQL Server (MSSQ ...
- Sql Server 2008修改Sa密码
1.用Windows验证模式进入数据库管理器 右键根目录 >>>>属性>>>>左边的安全性 选择sql server 和windows 验证(SQL S ...
- SQL Server 2008 忘记sa密码的解决办法
由于某些原因,sa和windows验证都不能登录 sql server,可以用独占模式,修改sa密码先在服务管理器停止Sql Server服务,然后打开命令行,进入 SQL Server安装目录,进入 ...
随机推荐
- flask_model防止循环引用
1 首先介绍app-model的循环引用 https://www.cnblogs.com/fuzzier/p/7920645.html 2 解决方式 https://www.cnblogs.com/f ...
- Django——2 路由分配设置 re_path正则匹配 include总路由 url传参 name使用 模板渲染render方法 模板渲染方法
Django 路由分配设置 re_path正则匹配 include总路由设置 url额外参数的传递 name的使用 模板的渲染:render方法 路由的分配中, 可以设定相应的转换器加以约束,比如 ...
- 在Centos安装oracle_11gR2进度68%"Error in invoking target mkldflags ntcontab.o nnfgt.o of makefile..”
http://www.xwood.net/_site_domain_/_root/5870/5874/t_c265367.html
- 洛谷—— P2733 家的范围 Home on the Range
https://www.luogu.org/problem/show?pid=2733 题目背景 农民约翰在一片边长是N (2 <= N <= 250)英里的正方形牧场上放牧他的奶牛.(因 ...
- HDU 5225
求逆序的个数.首先处理出对n个数它所有排列的逆序的个数.然后,按位枚举,当枚举的数少于当前位,逆序数的个数就是前面确定的数对于后面数的逆序总数+后面k个数的排列的逆序总数. 1Y. #include& ...
- jQuery和CSS3炫酷button点击波特效
这是一款效果很炫酷的jQuery和CSS3炫酷button点击波特效.该特效当用户在菜单button上点击的时候.从鼠标点击的点開始,会有一道光波以改点为原点向外辐射的动画效果,很绚丽. 在线演示:h ...
- 小议:部署SharePoint 2013时,无法连接SQL Server问题
最近在给学员培训时发现,个别学员在完毕SharePoint 2013部署时,无法连接SQL Server,两种报错情况,例如以下所看到的: :配置SharePointConnect to SQL Se ...
- [RK3288][Android6.0] U-boot 启动流程小结【转】
本文转载自:http://blog.csdn.net/kris_fei/article/details/52536093 Platform: RK3288OS: Android 6.0Version: ...
- bzoj 4318 OSU! —— 期望DP
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4318 期望DP,因为平方的期望不等于期望的平方,所以用公式递推: 第一次推错了囧,还是看这位 ...
- 感知器算法 C++
We can estimate the weight values for our training data using stochastic gradient descent. Stochasti ...