As part of my college course I am having to add a member area (coded using both php and mysql) into a website which I created in a previous assignment. I have the code for this and am currently working on it. The idea I have for when users to log on is that from their username a list of files should be made available for them to download (with all files being unique to each user). Does anyone have any ideas on how this can be incorporated or links to a tutorial? I should probably point out that the site is to show off my web design skills and the people who will log on are previous customers so that they can access logos, a zip file of the site ect. Cheers for any help
since the files are all associated to one particular client (thats what I presume from your post!) then why not just have a folder for each and then the directory coded into the database with the user name. Either that or a unique ID for each client that forms part of the filename which can be searched for when scanning a folder. or you could go with the simplest, just a list of names against the user name in the db although that is not the most elegant way
if its apache, you can set the directory so that its access denaid with a simple .htaccess file (see apache manual). Then you can have a PHP script access the files (as thats done from the host process (apache hopefully)'s priveledges in the OS). That way the only way a user can read the file from apache is via php/cgi/etc.
I probably should have pointed out that I also want the content to be displayed on the screen for the user to click on. sorry
I'm afraid there is no way we can help you - what you have told us is far too vague. We need more details on the specifics... Are files exclusive to one user or shared? What kind of files are they?? What content are you talking about? Which aspect of this do you need help with? ie we are not going to do the whole thing for you... so which bits are you stuck with? Chris
Basically what you are talking about is called a CMS (Content Management System). Separate directories for separate users is the straighforward and simple way to isolate one user's documents from another. This way, when a user logs-in, all you would have to code would be the directory to redirect the user to. If you want to design how the page displaying the files is laid out, you can just use PHP's directory scanning functions and save the files into an array and then spit them out in whatever format you'd like. However, when working with CMS and especially user-specific CMS, security should be your main concern. For instance, if there is a directory for each user, you want to make sure than only that user would be able to access that directory. You could do this a number of ways. In all cases, you would want to password-protect the directory directly via the server software (not by php scripting and the like as it can be more easily circumvented). I don't know what server software you're using, so I can't really help you there. Another option would be to do everything via the database. This how many CMS are done. I don't really know what sort of content you're wanting to display (be it an image, pdf file, etc.), so again, I can't really be too much help. It's just that some types of content are more suited to being stored in a database than others. For instance, content simply consisting of flat text could be easily managed in a database-- start adding formatting, images, etc., and the amount of work involved in managing it all gets somewhat bigger. The advantage of doing it via a DB is that you will have an easier time making sure all of your data is secure just by making sure your DB is secure (not having to make sure every single directory of content is secure). With all the data in a central location, you have more options on how you'd like it displayed. You can setup how a client would see it, and then how you would see it (like displaying content from all users at once for yourself) by using a DB.
You could always throw the physical files into a directory and protect it via htaccess, but basically set it so no one can access them via the web. You then create a php script that can read the files and relay them to the user. Access to individual files can then be managed by having the download script check the database for permissions on individual files. It's also trivial to write a script that checks the database and displays the files the user has access to. Hopefully that's clear. This is basically how I set up the downloads system at work. If you have any questions post and I'll go into more detail.