If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > login & password to certain links

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-12-04, 10:33
stahly stahly is offline
Registered User
 
Join Date: Feb 2004
Posts: 11
login & password to certain links

the login page i got has the username & password and checks it against a database and depending if the user enters it correct or incorrect is determined in an IF/Else statement. is there a way i can limit what links can be show to them? i already have setup so fields that are yes/no and i figured that maybe if there are a yes it display that link.

ex:
username password car suitcase
mike smith Yes
jane smith Yes Yes


so for mike it would only display the suitcase link and for jane it would display both...


thanks for any help, adam
Reply With Quote
  #2 (permalink)  
Old 11-13-04, 20:21
da frog da frog is offline
Registered User
 
Join Date: Jan 2004
Posts: 11
I'm not really sure I understand exactly what you mean but I'll try anyway.

If you want to show links to certain members based on their name you could assign their login-name or some other login-information to a session that remains until they log out.

If your login-table is named tableLogin and your recordset for checking the login-names are named objRecordSet the script could look like this:
Code:
 
If not tableLogin.EOF Then
Session("name") = objRecordSet("username")
End If
On the page were you want to display or not display a certain link you write
Code:
 
If Session("name")="Mike" Then
Response.Write("<a href=""car.html"">car</a>")
End If 
If Session("name")="Jane" Then
Response.Write("<a href=""car.html"">car</a>")
Response.Write("<a href=""car.html"">car</a>")
End If
I think it would be easier to give each user a userlevel, so you have a column in your table called userlevel. Then you can easily create If-statements on your pages so the users with a certain userlevel only can see the links you want them to.
Reply With Quote
  #3 (permalink)  
Old 11-15-04, 20:16
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
Yeah, but now you have to touch your code every time you add a new user. Better yet, either determine if there are groups that have access to certain links and create a column in your database that records the user's group membership, or you can create columns in the db for each link as boolean values. If you go with the membership route, then you query the DB for the user's group membership, then use if/else statements to show the appropriate links, or if you go with the one-column-per-link method, you'd query the db for all of their permissions, and use if/else statements to show the links...

There are pros and cons to both methods.. with group membership, it's easier to manage, but not granular... individual permissions are more granular, but not easy to mamage...
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On