Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Feb 2011
    Posts
    56
    Thanks
    5
    Thanked 2 Times in 2 Posts

    Question login script / memberspace

    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?

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    When a user successfully logs in, a PHP SESSION variable is set ...
    $_SESSION['SESS_MEMBER_ID']

    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 ...

    PHP Code:
    <?php
    session_start
    ();

    if(isset(
    $_SESSION['SESS_MEMBER_ID'])){
    // user is logged-in OK
    $memberID=$_SESSION['SESS_MEMBER_ID'];
    }
    else{
    // user is not logged-in, so kick them out ....
    header("location: index.php");
    exit;
    }

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

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

    // not sure what you call your columns.

    ?>

    .

  • Users who have thanked mlseim for this post:

    neptune1 (02-29-2012)

  • #3
    New Coder
    Join Date
    Feb 2011
    Posts
    56
    Thanks
    5
    Thanked 2 Times in 2 Posts
    I got it now, thanks. Is there a simple way to assign folders to users?
    Last edited by neptune1; 03-01-2012 at 12:36 AM.

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    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.

  • Users who have thanked mlseim for this post:

    neptune1 (03-07-2012)


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •