New Company DB Help

Results 1 to 4 of 4

Thread: New Company DB Help

  1. #1
    kian Guest

    Default New Company DB Help

    Hello, If anyone can help me and 2 other guys new company that invloves some ASP programming with login related info for free... please email me at asap. If we find your help very usefull... you WILL be rewared and credited highly. thanks.

  2. #2
    Karl Guest

    Default RE: Free login code..someone better than me tell m

    If you are looking for a database driven login-page, here&#039s code I does use 1 session variable...and I can&#039t promise on how effective it is!<BR><BR>&#060;%<BR>IF NOT Session("Validate") = "AccessGranted" THEN<BR> username = TRIM(Request.Cookies("user")("name"))<BR> password = TRIM(Request.Cookies("user")("pass")) <BR> IF (NOT username = "") AND (NOT password = "") THEN<BR> Set LoginConn = Server.CreateObject("ADODB.Connection")<BR> LoginConn.Open &#060;** Database info here **&#062;<BR> Check = "SELECT * FROM T_login WHERE C_UserName = &#039" & username & "&#039 AND C_Password = &#039" & password &"&#039"<BR> Set Check = LoginConn.Execute(check)<BR> IF (NOT Check.BOF) AND (NOT Check.EOF) THEN<BR> Session("Validate") = "AccessGranted"<BR> END IF<BR> LoginConn.Close<BR> Set LoginConn = Nothing<BR> END IF<BR>END IF<BR><BR>IF NOT Session("Validate") = "AccessGranted" THEN<BR> Response.Redirect("&#060;** Redir to a login page **&#062;")<BR>END IF<BR>%&#062;<BR><BR>Basically that would be in an include file you attach at the top of any page you want to protect. It basically checks to see if a session variable has already been set to give the user access (if it has the page loads normally), if it hasn&#039t it checks to see if a cookie with the required information is availabe (optional) and if a cookie is found it checks to see that the information matches a username and password found in the database..if so the session is set (so you don&#039t have to go through the cookie validation again) and the page loads normally.<BR><BR>If the there is no session and no cookie is found, you send the user to a login page.<BR><BR>this page would be a typical username/password form (maybe even a checkbox for &#060;b&#062;Remember this information?&#060;/b&#062;) which redirects to a validation page which is ALMOST exactly like the code above, except you have to set the cookie (once again optional) and instead of request.cookie, you request.form.<BR><BR>You can make it fancier by remembering what page they tried to access then redirect them back to that page after a successful login.<BR><BR>If anyone is interested in a more detailed look at the above code, you can e-mail me @ I&#039ll consider writing something up..<BR><BR><BR>--<BR>Karl

  3. #3
    Rob Guest

    Default RE: New Company DB Help

    Your email address does not work

  4. #4
    Karl Guest

    Default RE: New Company DB Help

    heh..I actually had to test it to make sure..but it does work as far as I can tell...try again :)<BR><BR> also...<BR><BR>--<BR>Karl

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts