11-12-04, 11:33 #1Registered User
- Join Date
- Feb 2004
Unanswered: 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.
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
11-13-04, 21:21 #2Registered User
- Join Date
- Jan 2004
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:
If not tableLogin.EOF Then Session("name") = objRecordSet("username") End If
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
11-15-04, 21:16 #3Useless...
- Join Date
- Jul 2003
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.