|
 |
栏目导栏 |
|
| |
|
|
|
|
 |
资料搜索 |
|
| |
|
|
|
|
 |
热门文章 |
|
| |
|
|
|
|
 |
最新文章 |
|
| |
|
|
|
| |
| |
|
|
|
|
CREATE PROCEDURE login_verify sp6Linux联盟 ( sp6Linux联盟 @community_id int, --拿值 sp6Linux联盟 @username varchar(20), sp6Linux联盟 @password varchar(40), sp6Linux联盟 @result tinyint output sp6Linux联盟 ) sp6Linux联盟 sp6Linux联盟 AS sp6Linux联盟 sp6Linux联盟 set nocount ON sp6Linux联盟 sp6Linux联盟 declare @service_deadline_date smalldatetime,@community_setting_max_online_count int ---定义一个变量为 短日期格式 sp6Linux联盟 sp6Linux联盟 select @community_setting_max_online_count=community_setting_max_online_count,sp6Linux联盟 @service_deadline_date=service_deadline_date from community_info where community_id=@community_id --这里是求最大登录人数 sp6Linux联盟 sp6Linux联盟 if datediff(d,@service_deadline_date,getdate())>10 --其实这个是限制用户的使用期,求当前日期与库中的记录日期如时大于10天,则返回@result =11 sp6Linux联盟 begin sp6Linux联盟 set @result=11 --超过使用期 sp6Linux联盟 return sp6Linux联盟 end sp6Linux联盟 sp6Linux联盟 if (select count(*) from online_user where =@community_setting_max_online_count">community_id=@community_id)>=@community_setting_max_online_count --根据库中的记录设定与当前人数比较 sp6Linux联盟 begin sp6Linux联盟 set @result=10 --超出在线人数限制 --返回@result=10 sp6Linux联盟 return sp6Linux联盟 end sp6Linux联盟 sp6Linux联盟 declare @stamia int,@last_update_stamia_date smalldatetime,@level_id int --定义变量 整型 短日期型 整型 sp6Linux联盟 declare @userid int ,@user_role int sp6Linux联盟 select @userid=userid,@user_role=user_role,@stamia=stamia,@last_update_stamia_date=sp6Linux联盟 last_update_stamia_date,@level_id=level_id from user_info where username=@username and password=@password and community_id=@community_id and user_type=0 sp6Linux联盟 sp6Linux联盟 --从用户信息表中,将一些信息写入到定义的三个变量中 sp6Linux联盟 sp6Linux联盟 if @userid is not null ----如果@userid 不变null值 sp6Linux联盟 begin --用户名和密码校验成功 sp6Linux联盟 set @result=1 --检验成功 sp6Linux联盟 return sp6Linux联盟 end sp6Linux联盟 else sp6Linux联盟 begin sp6Linux联盟 set @result=0 ---登录失败 sp6Linux联盟 end sp6Linux联盟 sp6Linux联盟 set nocount OFF sp6Linux联盟 sp6Linux联盟 GO sp6Linux联盟 sp6Linux联盟 我们给上面的过程取个名login_verify叫做 sp6Linux联盟 sp6Linux联盟 写成是ASP代码中调用安全认证的地方 sp6Linux联盟 sp6Linux联盟 '''事先已经定义好conn sp6Linux联盟 sp6Linux联盟 Set cmd.ActiveConnection=conn sp6Linux联盟 cmd.CommandText="login_verify" sp6Linux联盟 cmd.CommandType=&H0004 sp6Linux联盟 sp6Linux联盟 @community_id int, --拿值 sp6Linux联盟 @username varchar(20), sp6Linux联盟 @password varchar(40), sp6Linux联盟 @result int sp6Linux联盟 sp6Linux联盟 cmd.Parameters.Append cmd.CreateParameter("@community_id",3) sp6Linux联盟 cmd.Parameters.Append cmd.CreateParameter("@username ",200) sp6Linux联盟 cmd.Parameters.Append cmd.CreateParameter("@password",200) sp6Linux联盟 sp6Linux联盟 cmd("@community_id")=session("community_id") sp6Linux联盟 cmd("@username")=request("userid") sp6Linux联盟 cmd("@password")=request("userid") sp6Linux联盟 sp6Linux联盟 cmd.execute sp6Linux联盟 sp6Linux联盟 dim result sp6Linux联盟 sp6Linux联盟 result=cmd("@result") sp6Linux联盟 sp6Linux联盟 conn.close sp6Linux联盟 sp6Linux联盟 if trim(result)="1" then sp6Linux联盟 sp6Linux联盟 sp6Linux联盟 '''''''''''''登录成功的提示与操作 sp6Linux联盟 else sp6Linux联盟 sp6Linux联盟 ''''''''''''''''''''''登录失败的提示与操作 sp6Linux联盟 end if sp6Linux联盟
Linux联盟收集整理 ,转贴请标明原始链接,如有任何疑问欢迎来本站Linux论坛讨论 |
|
|
|
|
|