Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-29-2002, 07:43 PM   PM User | #1
scroots
Senior Coder

 
Join Date: Jun 2002
Location: UK
Posts: 1,137
Thanks: 0
Thanked 0 Times in 0 Posts
scroots is an unknown quantity at this point
ASP tutorials/password area script

anyone know of a good set of ASP database tutorials?
also does anyone know of a password area script, so that the user when logged in can see some pages where as someone higher up e.g. admin can see all the pages.
thanks in advance
scroots
__________________
Spammers next time you spam me consider the implications:
(1) that you will be persuaded by me(in a legitimate mannor)
(2)It is worthless to you, when i have finished
scroots is offline   Reply With Quote
Old 07-30-2002, 06:41 AM   PM User | #2
oracleguy
Rockstar Coder


 
Join Date: Jun 2002
Location: USA
Posts: 9,042
Thanks: 1
Thanked 322 Times in 318 Posts
oracleguy is a jewel in the roughoracleguy is a jewel in the roughoracleguy is a jewel in the rough
I can partially answer your question. For the password area scripting. One way that I have found most effective is to have an access number i.e. 2 for a user and store it in a database. Then when the login make a session variable equal that number.

So then for pages level 2 users and above can access you'd add this at the top of the pages:
Code:
<%If Session("Level")>2 then Response.Redirect("Login.asp")%>
So then if someone doesn't have a high enough access level it redirects them.

Am I making sense?
oracleguy is offline   Reply With Quote
Old 07-30-2002, 06:12 PM   PM User | #3
scroots
Senior Coder

 
Join Date: Jun 2002
Location: UK
Posts: 1,137
Thanks: 0
Thanked 0 Times in 0 Posts
scroots is an unknown quantity at this point
you are making a litle sense, i`m new to the stuff.
could i not just have a database and IF statements e.g. if user value =2 then access to level to.
doing it your way, how would i make the session variable equal a number.

scroots
__________________
Spammers next time you spam me consider the implications:
(1) that you will be persuaded by me(in a legitimate mannor)
(2)It is worthless to you, when i have finished
scroots is offline   Reply With Quote
Old 07-30-2002, 11:48 PM   PM User | #4
whammy
Senior Coder

 
Join Date: Jun 2002
Location: 41° 8' 52" N -95° 53' 31" W
Posts: 3,660
Thanks: 0
Thanked 0 Times in 0 Posts
whammy is an unknown quantity at this point
Code:
'Put your database connection here!

AccessQuery = "SELECT AccessLevel FROM database_name WHERE Username = '" & Username & "' AND Password = '" & Password & "'"

rs = Conn.Execute(AccessQuery)

If NOT rs.EOF Then
     Session("AccessLevel") = rs("AccessLevel")
Else
     Session("AccessLevel") = 0
End If
__________________
Former ASP Forum Moderator - I'm back!

If you can teach yourself how to learn, you can learn anything. ;)
whammy is offline   Reply With Quote
Old 06-29-2007, 02:03 AM   PM User | #5
gilgalbiblewhee
Regular Coder

 
Join Date: Mar 2005
Posts: 735
Thanks: 4
Thanked 1 Time in 1 Post
gilgalbiblewhee is an unknown quantity at this point
Quote:
Originally Posted by whammy View Post
Code:
'Put your database connection here!

AccessQuery = "SELECT AccessLevel FROM database_name WHERE Username = '" & Username & "' AND Password = '" & Password & "'"

rs = Conn.Execute(AccessQuery)

If NOT rs.EOF Then
     Session("AccessLevel") = rs("AccessLevel")
Else
     Session("AccessLevel") = 0
End If
Can you explain me how the code works?
gilgalbiblewhee is offline   Reply With Quote
Old 07-01-2007, 10:07 PM   PM User | #6
phill_ridout
Regular Coder

 
Join Date: Mar 2006
Posts: 187
Thanks: 5
Thanked 0 Times in 0 Posts
phill_ridout is an unknown quantity at this point
use an MD5 encryption alogarithm to encrypt the password before it is stored in the database. Because you cant decrypt MD5 to check the login pass work you have to encrypt it using the alogarithm. i have an include file which you can use that you just pass a var to in a function call
phill_ridout is offline   Reply With Quote
Old 07-02-2007, 05:47 PM   PM User | #7
Daemonspyre
Regular Coder

 
Join Date: Mar 2007
Posts: 505
Thanks: 1
Thanked 19 Times in 19 Posts
Daemonspyre is on a distinguished road
Here's the explanation that you are looking for:

Once you make your DSN-less database connection, then you submit a query to the Access database.

[OT] My issues with the query are that is you don't do some pre-Query validation and character replacements, you are vulnerable to SQL Injection and database hacking. [/OT]

That query asks the database for the AccessLevel you are searching for in your original post. It then stores that data in a Session variable, allowing you to access it for the entire time that a user is logged in.

If you don't have any permissions in your record, or your user doesn't have a record in the database ( rs.EOF = Recordset.EndOfField), it sets that session variable to '0'. This is so they have no access to your system (or read-only if you so prefer).

Does that help?
__________________
Quote:
To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
Please, if you found my post helpful, pay it forward. Go and help someone else today.
Daemonspyre is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:27 AM.


Advertisement
Log in to turn off these ads.