SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast hombre_de_las_ca's Avatar
    Join Date
    Apr 2005
    Location
    Bangalore, India
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Red face Login Previliges!!!

    if i want to give login prev to users such as admin and Partial admin such that i can control who can manipulate which data in an Access database, is it possible and how!!!
    CaveMan
    Don't ask what your Country can do for you,
    Ask what you can do for your Country.

  2. #2
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    are you looking at doing this via a browser using coding or directly via the database?

    Gav

  3. #3
    SitePoint Enthusiast hombre_de_las_ca's Avatar
    Join Date
    Apr 2005
    Location
    Bangalore, India
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    which ever is simpler and effective!!!
    Don't ask what your Country can do for you,
    Ask what you can do for your Country.

  4. #4
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Well via database, really it's only SQL that you can use multiple login's, as access will ask you for a password to open it.

    But if you do it via the browser whilst coding, you can setup the account privilages, then show/hide buttons or links to actions on what type of security access they have.

    So when logging in, you do a standard check, but add a field to the database stating what type of account previlages the user has.

    then you do this.

    Login Page

    Code:
    <%
    
    	Dim Connection
    	Set Connection = Server.CreateObject("ADODB.Connection")
    		Connection.open "dsnname"
    
    	Dim Login
    	Set Login = Server.CreateObject("ADODB.Recordset")
    		Login.Open "SELECT * FROM Users WHERE Username = '" & request.form("username") & "' AND Password = '" & request.form("password") & "'", Connection, 2, 2
    		
    	if not login.eof then
    	
    		Session("user") = Login("User_Type") & "|" & Login("UserID")
    		Login.Close
    	Set Login = nothing
    		Connection.Close
    	set Connection = Nothing
    	
    		response.redirect "userpage.asp"
    		
    	else
    	
    		Login.Close
    	Set Login = nothing
    		Connection.Close
    	set Connection = Nothing
    	
    		Response.redirect "loginfailed.asp"
    		
    	end if
    	
    %>
    On the page you require to show items depending on user type.

    Code:
    <%
    
    	User_Details = Split(Session("user"),"|")
    
    	Dim Connection
    	Set Connection = Server.CreateObject("ADODB.Connection")
    		Connection.open "dsnname"
    		
    	Dim User
    	Set User = Server.CreateObject("ADODB.Recordset")
    		User.Open "SELECT * FROM Users WHERE UserID = '" & User_Details(1) & "'", Connection, 2, 2
    		
    %>
    Then all you need to is start adding the following codes to either buttons/images with links/ basically anything that will need a certain type of user to do something.

    Also, what you can do is with forms etc, admin accounts can use all items within a form, and if you use the code to hide things like password and account types etc from other users.

    Gav


Bookmarks

Posting Permissions

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