用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安装目录,进入 ...
随机推荐
- 彻底搞定Android开发中软键盘的常见问题
软键盘显示的原理 软件盘的本质是什么?软键盘其实是一个Dialog. InputMethodService为我们的输入法创建了一个Dialog,并且将该Dialog的Window的某些参 ...
- Linux I/O scheduler for solid-state drives
An I/O scheduler and a method for scheduling I/O requests to a solid-state drive (SSD) is disclosed. ...
- oracle导入少量数据(少于10M)
工具用PL/SQL Developer select * from temp1 for update;开锁,点+号,直接从Excel复制,然后粘贴. 程序猿必读
- nyoj_114_某种序列_201403161700
某种序列 时间限制:3000 ms | 内存限制:65535 KB 难度:4 描述 数列A满足An = An-1 + An-2 + An-3, n >= 3 编写程序,给定A0, A1 ...
- 3.2 Piecewise Linear Interpolation(站点)
Newton Interpolation: https://www.youtube.com/watch? v=EyRQXA56asI Piecewise Linear Interpolation: h ...
- hdu1316(大数的斐波那契数)
题目信息:求两个大数之间的斐波那契数的个数(C++/JAVA) pid=1316">http://acm.hdu.edu.cn/showproblem.php? pid=1316 这里 ...
- Codeforces 510 A.Fox and Snake
题目链接:http://codeforces.com/contest/510/problem/A A. Fox And Snake time limit per test2 seconds memor ...
- 【SDOI2008】【BZOJ2049】Cave 洞穴勘測
Description 辉辉热衷于洞穴勘測.某天,他依照地图来到了一片被标记为JSZX的洞穴群地区.经过初步勘測,辉辉发现这片区域由n个洞穴(分别编号为1到n)以及若干通道组成.而且每条通道连接了恰好 ...
- QMessageBox 的四种用法
void MainWindow::on_info_clicked() { //info QMessageBox::information(this, "Title", " ...
- Linux 中的键盘映射【转】
本文转载自:http://hessian.cn/p/144.html [转]Linux 中的键盘映射 原文地址:http://www.linuxidc.com/Linux/2011-04/35197. ...