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.
solution is to have two seperate tables:
users:
userID
username and other info
userpageset
pagesetID
pageID or pageURL
userID
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.
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)
Bookmarks