ASP and Storage process

Source: Internet
Author: User
Process CREATE PROCEDURE login_verify


  (


@community_id int,--Take value


@username varchar (20),


@password varchar (40),


@result tinyint output


  )


  


as


  


SET NOCOUNT on


  


declare @service_deadline_date smalldatetime, @community_setting_max_online_count int---defines a variable as a short date format


  


Select @community_setting_max_online_count =community_setting_max_online_count, @service_deadline_date = Service_deadline_date from Community_info where community_id= @community_id--This is the maximum number of logins


  


If DateDiff (d, @service_deadline_date, GETDATE ()) >10-In fact, this is to limit the user's usage period, the current date and the record date in the library is greater than 10 days, then return @result = 11


begin


Set @result = 11--Exceeds the usage period


return


End


  


if (select COUNT (*) from online_user where = @community_setting_max_online_count ">community_id= @community_id)" & Gt;= @community_setting_max_online_count--based on the records in the library compared to the current number


begin


Set @result = 10--Exceeds the online number limit--Returns @result=10


return


End


  


declare @stamia int, @last_update_stamia_date smalldatetime, @level_id INT--Define variable integer short-date integer


declare @userid int, @user_role int


Select @userid =userid, @user_role =user_role, @stamia =stamia, @last_update_stamia_date =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


  


--Writes some information to the defined three variables from the User information table


  


if @userid is not null----if @userid invariant null value


Begin-User name and password checksum success


Set @result = 1-Test Success


return


End


Else


begin


set @result =0---login failed


End


  


SET NOCOUNT off


  


Go


  


we take a name for the process above login_verify is called





is written as a place to invoke security authentication in ASP code


  


' ' has defined conn
in advance.

  


Set cmd. Activeconnection=conn


cmd.commandtext= "Login_verify"


cmd.commandtype=&h0004


  


@community_id int,--Take value


@username varchar (20),


@password varchar (40),


@result int


  


cmd. Parameters.Append cmd. CreateParameter ("@community_id", 3)


cmd. Parameters.Append cmd. CreateParameter ("@username", 200)


cmd. Parameters.Append cmd. CreateParameter ("@password", 200)


  


cmd ("@community_id") =session ("community_id")


cmd ("@username") =request ("userid")


cmd ("@password") =request ("userid")


  


Cmd.execute


  


Dim result


  


result=cmd ("@result")


  


Conn.close


  


if trim (Result) = "1" then


  


  


' "'" "" "" "" "" "" Login successful prompts and actions


Else


  


' "'" "" "" "" "" "" "" "" "" Login failure prompts and actions


End If





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.