用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验证用户名和密码的更多相关文章

  1. sql server 设置用户名和密码

    安全性:security 登录名:Logins 可以双击直接对里面现有的用户权限进行修改 也可以右击新建新用户 并对新用户权限进行设置

  2. 【转】在SQL Server 2008中SA密码丢失了怎么办?

    sql server 2008的sa用户莫名其妙就登陆不进去了.提示如下: 以上提示就表明是密码错误,但密码我可是记得牢牢的,也许是系统被黑的原因吧.一直以来我的Windows身份验证就用不起,以下方 ...

  3. c# 调用mysql数据库验证用户名和密码

    使用mysql数据库验证用户名和密码时,如果用户名是中文,一直查不到数据 需要把app.config 中修改为 数据库统一设置utf8编码格式,连接数据库的时候设置编码Charset=utf8可以避免 ...

  4. Android 设置代理(验证用户名和密码)

    这几天在研究在Android中,解析网页,但是公司内容,链接外网需要代理,并需要验证用户名和密码,十分头疼,网上查了下,没有头绪,最后总算在一个外国博客中看到类似的,记录下 URL url = new ...

  5. django 使用form验证用户名和密码

    form验证可以减少查询数据库,所以代码先预先验证,有问题可以返回给前端显示 1.在users文件夹下新建forms.py文件,用来验证用户名和密码是否为空,密码长度是否大于6 # -*- codin ...

  6. SQL Server 验证身份证合法性函数(使用VBScript.RegExp)

    原文:SQL Server 验证身份证合法性函数(使用VBScript.RegExp) 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/wzy0623 ...

  7. SQL Server 2014忘记SA密码或禁用而且Windows身份验证也无法登录的解决办法

    SQL Server双重验证都无法验证的情况下如何处理 1.以管理员身份运行sql配置管理器 2.打开[Sql Server 服务]节点关掉所有服务 3.双击本地实例[SQL Server (MSSQ ...

  8. Sql Server 2008修改Sa密码

    1.用Windows验证模式进入数据库管理器 右键根目录 >>>>属性>>>>左边的安全性 选择sql server 和windows 验证(SQL S ...

  9. SQL Server 2008 忘记sa密码的解决办法

    由于某些原因,sa和windows验证都不能登录 sql server,可以用独占模式,修改sa密码先在服务管理器停止Sql Server服务,然后打开命令行,进入 SQL Server安装目录,进入 ...

随机推荐

  1. 8.2.3 操作MySQL数据库

    Python访问MySQL数据库可以使用MySQLDb模块,该模块主要方法如下: (1)commit():提交事务. (2)rollback():回滚事务. (3)callproc(self,proc ...

  2. Huawei-R&S-网络工程师实验笔记20190527-华为设备密码重置、设置web管理

    >Huawei-R&S-网络工程师实验笔记20190527-华为设备密码重置.设置web管理 >>实验开始(使用SecureCRT 等工具软件): 一.华为设备密码重置,通过 ...

  3. Windows学习总结(7)——学会CMD命令提示符的重要性

    作为普通电脑用户,大家接触最多的应该 是可视的操作系统界面.可是如果想真正学好计算机,学习好命令提示符可就是必不可少的.它可以更高效的帮助我们处理问题. 命令提示符是在操作系统中,提示进行命令输入的一 ...

  4. (39.1) Spring Boot Shiro权限管理【从零开始学Spring Boot】

    (本节提供源代码,在最下面可以下载)距上一个章节过了二个星期了,最近时间也是比较紧,一直没有时间可以写博客,今天难得有点时间,就说说Spring Boot如何集成Shiro吧.这个章节会比较复杂,牵涉 ...

  5. HDU - 1403 - Longest Common Substring

    先上题目: Longest Common Substring Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 65536/32768 K ...

  6. 数学 找规律 Jzzhu and Sequences

    A - Jzzhu and Sequences   Jzzhu has invented a kind of sequences, they meet the following property: ...

  7. ZooKeeper是什么(转)

    ZooKeeper是什么? ZooKeeper是一个分布式的,开放源码的分布式应用程序协调服务,是Google的Chubby一个开源的实现,是Hadoop和Hbase的重要组件.它是一个为分布式应用提 ...

  8. UITextView上加入默认文字

    1. 实现UITextView的代理方法 text.view.delegate = self; 2. 在UITextView上覆盖UILabel ps:必须实现 label.enabled = NO; ...

  9. Xposed获取微信usernamepassword

    请关注我的微信公众号 參考文章:Xposed恶意插件 Android 安全专项-Xposed 劫持usernamepassword实践 0x00 我在之前的文章中演示了一下怎样通过Xposed获取us ...

  10. hdu oj 3371 Connect the Cities (最小生成树)

    Connect the Cities Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Other ...