Client management and viewing

Relatively new to php. I am setting up a website for my wife’s personal business in photography. I have already made the pages with .php, created the MySQL database and table, and tested it out. Luckily, everything works fine. My problem is there are two additional things I need to do. My wife wants the ability to be able to upload either a file or link to a file so that when one of her clients logs in, they will be able to view the file. The file, as of now can be simply a web gallery. The problem is she doesn’t want every client to view other clients files. Along with their login, they have to supply a session ID number. I want that number to pull the correct file or link. I would prefer not to have hundreds of webpages so if it’s possible to create one page with multiple files that would be great.

Another thing I need to happen is how to upload, then view the records for deletion. The insert I can work fine, but I don’t know how to get the page to show all records and their contents to delete a record without going directly to MySQL.

Again, sorry if I’m not making much sense, my query could be not possible for all I know, but any help would be greatly appreciated. Btw, I’m designing the site through dreamweaver and she’s hosting through Not my first choice, but she’s the boss. Again thank you in advance.

I presume each of your clients will be identified by a client id along with their login details. When your wife uploads the file for a specific client, she will need to first login as some kind of admin, find the client, select their id, and a table will link the uploaded file details and the client id. When the client logs in, a query on that table will list all (if any) files that have been uploaded with their client id, and no others.

For deleting records, do you mean so that your wife/admin can bring up all the files she has posted and choose them for deletion, or so that clients can delete their own? Both are pretty much the same - bring up either a list or a thumbnail gallery and have a checkbox alongside each one and a hidden variable or some other means of linking that to the unique file id that you created when they were uploaded. Have a delete button which when pressed checks for a selected image and deletes it/them.

Thank you for your reply. I am trying to keep this as simple as possible, so I am using only one table. The table has the following fields:

username: VARCHAR (30)
password: VARCHAR (30)
sessionID: INT
file: VARCHAR (60)

I have a webpage for ADMIN login which will use the ‘isADMIN’ field to allow access, and I have the CLIENT LOGIN page for obviously the clients. The clients login will only be available for a short period of time. For that reason, she has to be able to delete the records. She has another program to keep their information in.

When logging in, the clients MUST enter Session ID, Username, Password. After clicking Login, I want to query or search for their username along with the session ID and narrow the result to ONLY show that record. There will be times when one client has more than one session, so querying for that record would solve confusion. When the next page loads, I want that record to show up with the Username, sessionID, and File (whether or not it is a hyperlink or actual file). I have no problem making the login pages, its getting the system to query and SHOW the results on the next page. And the same goes with the ADMIN page, except I want it to show all records and after adding or deleting a client, the page refreshes to show the updates. I know little about coding this. So please help and show me if this is possible. Thank you.

I’m not sure of the question now. When you say you have the login pages, do you have the PHP code to take the user-supplied data and find the user session record, or do you just have the html for the pages? If you already have the login code to take their details and check them against the database, getting the file details from the table at the same time would just be a case of adding that column to the query, then displaying it if it is not empty.

If you don’t have any of the code yet, I’d have a look around for some sample user login code - there are plenty around, but you should try to find one that uses the later mysqli or PDO libraries to access the database. A lot of samples and tutorials use the older mysql functions which it isn’t really worth the time to learn as they’re deprecated.

Basically your pseudo-code will be something like:

connect to database
get form variables
query the database for username, password and session number
if no record is found, reject login and start again
if admin flag is set:
  display list of all current user sessions with tickbox for deletion
  display user details and, if specified, FILE details