View Full Version : login script / memberspace

03-01-2012, 12:09 AM
I tried out this login script and its great http://phpsense.com/2006/php-login-script/ (not spam)

After login how can I create so each user has there own web space? Say if after login I add an image gallery or a file uplaod is there a simple formula to connect the user to there own folders?

03-01-2012, 12:22 AM
When a user successfully logs in, a PHP SESSION variable is set ...

So, any other PHP script you have, you can check for the existence of that
SESSION, and you can also know what the user's ID is ... for controlling content.

At the top of any protected, or user-specific page ...


// user is logged-in OK
// user is not logged-in, so kick them out ....
header("location: index.php");

// the rest of your script continues on down ...

// query database table .... WHERE memberID='$memberID' ....

// not sure what you call your columns.



03-01-2012, 12:59 AM
I got it now, thanks. Is there a simple way to assign folders to users?

03-01-2012, 02:51 AM
You don't assign any folders (directories).

You save all photos into a directory. If they duplicate a filename,
then append a number to the filename, recheck the filename and then
save it if the filename is unique.

When the photo saves, you add a new row to your MySQL table. That row
has the user's ID, photo filename, title, caption, etc.

Everyone is using the same MySQL table for all of their photos.

When a person logs in, all queries in that table will result in only their photos ..
the rows that have their ID in them.

The file management, user management, everything is controlled by the MySQL tables.

A table for the users,
A table for the photos.