ACCESS和SQL数据库怎么让输入的密码,转换成密文的方式保存在数据库中啊?谢谢了.

ACCESS和SQL数据库怎么让输入的密码,转换成密文的方式保存在数据库中啊?谢谢了.,第1张

密码字段类型改成 varbinary(255)

--新增或修改密码

create proc modifypwd

@uid varchar(16),@pwd varchar(16)

as

declare @encode varbinary(255)

set @encode=convert(varbinary(255),pwdencrypt(@pwd))

if exists(select uid from [user] where uid=@uid)

update [user] set pwd=@encode where uid=@uid

else

insert into [user](uid,pwd) values(@uid,@encode)

go

--判断密码是否正确

CREATE proc checkid

@uid varchar(16),@pwd varchar(16)

as

declare @encode varbinary(255)

select @encode=pwd from [user] where uid=@uid

if pwdcompare(@pwd,@encode,0)='1'

select '登录成功'

else

select '用户名或密码错'

GO

Redis支持使用AUTH命令来设置密码,可以将密码设置为明文或者密文。要将密码设置为密文,需要在redis.conf文件中设置requirepass参数,并将它设置为加密后的密文字符串即可。

输入的密码如果是HTML的控件的话<input type="password" name="password1" id="password1" />如果是WEB服务器控件TextBox的话设置它的TextMode为Password即可。 输入进数据库的时候进行"MD5"加密,string password=FormsAuthentication.HahPasswordForStringinConfigFile("要加密的字段") 显示的时候也是设置 TextBox的TextMode的属性为password即可。

希望采纳


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/9655113.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-30
下一篇 2023-04-30

发表评论

登录后才能评论

评论列表(0条)

保存