SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Sep 2003
    0 Post(s)
    0 Thread(s)

    Creating a Login System

    Hey there,
    I'm relatively new to php and working on my first larger project, and I'm looking for some related reading that doesn't seem to be easy to find..

    I have a system setup in php / sql that allows variables to be entered and then outputted again. Each set of variables is called back up on a page using the SQL rows key. The variables remain the same for every output, just the values change.

    Here is what I want to accomplish - each page calling up the variables can be grouped (ie page-set1, page-set2, page-set3, etc). I had planned on using a new unique key to define the page sets.

    What I'd like to do is create a login system that would load up each of the 'page-set#', where each login leads to a different set#, and the ability to edit the variables of only specific page-sets.

    So, this leads me to two questions -
    1. How can I create a login system that leads each user to a page that allows them to only edit their defined page-set#?

    2. How can I output all of the pages contained within page-set#, so that each one has a separate area within their logged in page (and as such allows them to edit each page individually)?

    I have already figured out how to do this on an individual basis (I have setup an edit page that allows variables to be edited within a specific row of the SQL database). I just can't figure out how to put sub-sets of these rows together for editing by a user who has been given a log-in to do such.

    I'm looking at a solution that I found on hotscripts at:

    that appears to do what I need, any feedback from users of this script would be great.

    I hope I was clear enough, let me know if you need any clarification. Thanks for taking a moment to help out a newb

  2. #2
    SitePoint Addict Php_penguin's Avatar
    Join Date
    Aug 2004
    Colwyn Bay, Wales, UK
    0 Post(s)
    0 Thread(s)
    solution is to have two seperate tables:
    username and other info

    pageID or pageURL

    effectively, what you need to do is have a piece of code at the top of each and every page which:

    checks if the user is logged in (for example with a md5 hashed string stored in both a session and the DB)
    if not, display a login form and/or deny access
    if so, retrieve the user info, and allowed pagesets
    check that the current page is in the current users pageset
    if not, diplay an error / index page / denied access page
    if so, continue with output.

  3. #3
    SitePoint Wizard lorenw's Avatar
    Join Date
    Feb 2005
    was rainy Oregon now sunny Florida
    2 Post(s)
    0 Thread(s)
    I have used this one and since it is in tutorial form you learn what it is doing.

    I used it with other lookup tables so I added an auto increment primary key to the users table to make it faster. ie instead of looking up myusername it will look up 100 (primary key value)


Posting Permissions

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