Forum Moderators: coopster
Anyway, the current issue I'm having is figuring out exactly how to get individual private user pages for my clients.
I'd like to be able to let them register an account (Or I can manually create the account if it'd make any difference, doesn't matter to me) and upon logging in I'd like them to be re-directed to a private page all of their own that I can keep an updated list of project files on, etc, as well as have an upload form for them to easily kick source materials and whathaveyou to me.
I've got the basic user login/registration/etc scripts up and running, I've had several friends as well as myself make test accounts and the DB and Scripts all work perfectly. I just need to know what to add in to get the private client pages up and running.
Thanks in advance for your help!
private.php is a script that users access after logging into the member's area.
Each user has saved certain data to their private area which you have stored in a MySQL database. Or perhaps you have saved the data for them.
In any case, once private.php has determined that it has a valid user, it would then perform a database query using the user's ID or username. The query would return the user's saved data which private.php would then display for them.
If this is what you want to do, I did a quick search and found this:
[tutorialized.com...]
I didn't look over the tutorial so I can't say how good it is but there should be a section that goes over building a customized member's area page for each user, which is what you want.
The other areas of the tutorial might give you some tips for your login system as well.
Hope that helps. If not, you should be able to Google other tutorials.
all I had to do was change my headers around and wha-lah!
The only problem I have now is restricting access to the pages... like I said I'm new at this, so configuring cookies and whatnot is way out of my knowledge base.
If anyone has any suggestions about securing pages and only allowing access to a certain username or something like that I'd appreciate the help.
If not, I'll figure it out eventually. =]
Right now I'm gonna hit the hay and start fresh tomorrow.
Thanks for your help so far, Ian!
From what I can see I have two options. I can either use a cookie or a session.. but regardless of which one I end up using, how can I set a certain page to only allow a specific user on it? I've tried fiddling with cookies to see if I could redirect users that didn't have the required name for the page, but I've yet to have any success. Help? =/
Try to get your head around the above as it is the fundamental principle behind the use of back end scripting on the web :-)
The private.php (or whatever) page would work basically like this:
if (checklogin()) {
$content = readDataFor($userID);
print $myheader;
print $content;
print $myfooter;
}
else { //redirect user to login script
} checklogin() verifies that the cookied or session login data is valid.
readDataFor() queries the database to get the stored custom data for the user accessing the page.
How exactly do I get their data in there? Would I be creating a table and filling it with the data, or..?
Jeez, I'm so sorry for being such a pain, this is my first experience with DB's :(
Yes you would create a table for the content, with the primary key (column) being the username or user ID. How many other columns you use, and the types of columns, will depend on what you're storing.
I'll look into how to set that all up, I assume that it'll be pretty basic, all I need to do is give them an upload form and a list of project related documents/materials to download from my server.
Is something like this very easily maintained or am I barking up the wrong tree for a client project management type system here?
For all I know I could be doing this in the hardest way possible, haha. :)
Images and other binary files can be stored in the database but might also be stored in user specific directories in the file system.
In either case you'll still want to store the overview data (user ID, filename, etc...) in the database as that is where you'll be cross referencing to the user's login details.
What would be the most efficient/easy way to do it? Storing the files/images in a DB, or in a user specific directory? I don't want to tax the system too much (not that I'm going to be having thousands of users or anything, but still).
I'm thinking perhaps a user specific directory would be a better choice, as I could FTP in and upload materials easily as well as have it serve as a landing spot for their uploaded files via the upload form that I'll most likely be doing using jquery or something similar.
I'll be searching around on my own for tutorials or tips on how to get this all running but in the meantime do you have any extra tips/examples/tutorials handy?
Thanks again for you help, hopefully I'll have this fully functional within the next few days :D
If the point of the system is just to allow the transfer of files between you and your clients then you really wouldn't need to use the database at all (outside of the registration and login system), just generate a linked list of files in their directory for them. The directory name itself (their user ID) is enough to link their login to their files.
Ah, and about that example code you gave me a few posts up, where exactly do I need to pull the content from?
I'm still confused as to how exactly to get individual data on that same page.
I'm guessing at the moment that I need to add some data into the DB and have content (e.g., list of links to the files in their directory, etc) in there.. Or can I link their userid to a php page inside their directory and have it show that, perhaps?
I'm probably way of, I'm sorry.. if I wasn't in such a crunch for time I'd probably be able to get this figured out on my own without having to bug you for your help. Thank you again though. :)
However in theory, because of the way PHP's permissions work (PHP generally needs a directory to have public permissions in order to access the files it contains) it would be possible for someone to access a user's files by navigating directly to the directory with their browser.
There are various ways to avoid this but that's kind of a broad topic. It's probably not something you need to worry too much about as it's unlikely that anyone is going to know another user's ID.