Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 4 1 2 3 ... LastLast
Results 1 to 10 of 31
  1. #1
    Member
    Join Date
    Jul 2011
    Posts
    95
    Member #
    28555
    Liked
    1 times
    Hi everyone
    I know how to create a php/sql members area for a site, but the way I do this just creates members pages which are accessable to all members.

    I want to know how to create a members area where each member would have their own area, ie. 200 members each with their own members area, which cant be access by other members.

    This is so that I can have personal things on there for each member, which is secure and protected from other members.

    I havent a clue how to do this so don't even know if I have posted this is in the right category but would appreciate some advice.

    Thanks, Adey

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    You've already done it when you said you've created a members area ....

    They log in .. is that correct?
    That means a successful login has created an active SESSION.
    You can make that SESSION variable the user ID.

    Every page you display after that can view the SESSION variable and
    decide what to display ... (based on the user ID) ... "members pages".


  4. #3
    Member
    Join Date
    Jul 2011
    Posts
    95
    Member #
    28555
    Liked
    1 times
    OK I have gathered I need to assign the users unique ID to the page for them to be able to access it and nobody else, but I presume I would have to manually do this for each page created and was hoping that the area could be automatically created for each new user on registration (eg when registering for ebay, facebook etc), or is that alot more complex?

  5. #4
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    What are these "pages" you are talking about?

    You can use PHP to dynamically generate those "pages" based on who the user is.
    There are no static pages, like I believe you are talking about.

    Take this forum for example ...
    The page you're viewing now is dynamically created by PHP (using a template).

    You're logged in and you can edit your posts ... but you can't edit my posts.

    I'm logged in, but I can edit your post, because my "member level" is WDF Staff.

    When PHP generates this page for me, I have an edit link for your post.
    See what I mean? Everything about this page is generated by data stored in
    the SQL database, including the posts themselves.


  6. #5
    Member
    Join Date
    Jul 2011
    Posts
    95
    Member #
    28555
    Liked
    1 times
    I understand, the pages I was referring to (I didnt explain very well did I) is for example a page with a progress chart that "user a" can complete for themselves, so we would want "user a" to have access to his/her chart, "user b" to have access to his/hers, but not each others etc..

  7. #6
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    I guess that's the same thing ... a single PHP script that generates or displays the
    user's chart, depending on who is logged in. I assume that the user's data (progress)
    is stored in some sort of database, whether it be MySQL, CSV, plain text, etc?

    I'm still not seeing anything here except one PHP script for all users.

    Show me an example of one of the pages (with the so-called users chart).


  8. #7
    Member
    Join Date
    Jul 2011
    Posts
    95
    Member #
    28555
    Liked
    1 times
    Well nothing is developed yet so I don't have any pages but I guess I am going to have to give the game away so that you can see exactly what it is I am trying to do...
    I want each user to have access to their own "progress chart" which is for their children, like a behaviour chart, with gold stars etc, obviously people with more than 1 child can say they want 2 charts, 3 charts etc, so when they log in, they will have access to their own and only their own childrens behaviour chart. These details will no doubt have to be stored in its own SQL database seperate from the login details database.

  9. #8
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    Yep ... MySQL for sure.

    If this is a school, I expect each child has an id number (instead of their name showing up).
    Might be important for privacy reasons.

    One MySQL table called "progress" with a layout something like this?

    $sql = "CREATE TABLE progress
    (
    rowID int NOT NULL AUTO_INCREMENT,
    PRIMARY KEY(rowID),
    childID varchar(20),
    teacherID varchar(20),
    stars varchar(20),
    beginDate varchar(20),
    endDate varchar(20),
    enable varchar(1),
    timeStamp varchar(20)
    )";
    mysql_query($sql,$con);

    When a teacher or member logs in, the query will be for their ID only.
    It will pull all rows with their ID and then you can query by dates, by
    child, by stars, etc. You could have a points system of any kind 1-5, 1-100, etc.
    and the PHP script will generate a nice graphical chart with stars or whatever
    on one chart for all children, or single charts for each. A timestamp can be used
    to indicate when a child's row was last updated. Begin and End dates to
    separate years, semesters, quarters, etc. An "enable" column to disable the
    ability to change that row if a child leaves school, or is out for some reason.

    By having one table, an "admin person" has ability to view/edit/delete ALL rows.

    MySQL is really powerful, and you have tons of charting tools available the PHP can
    use to generate the GUI for the member (teacher). You can even have PHP generate
    using Google's Chart API ... some really nice charts available.

    A teacher could even enter behavior data on a smartphone.

    The possibilities are endless. Keep us posted on your progress.


  10. #9
    Member
    Join Date
    Jul 2011
    Posts
    95
    Member #
    28555
    Liked
    1 times
    You have been extremely helpful, this isn't for a school, just a personal project and instead of teachers, it will be parents, but could work very similar to the way you described.
    So If I use the code above to create my table but change teacherID to parentID then when parent1 who has 3 kids logs in, they could see all 3 charts for child1, child2 and child3 but no other charts belonging to parent2, parent3 etc etc, am i right? And I may also keep the begin date but remove the end date and the enable column.
    Would I still have to have a seperate table for the username/password or would I just insert a column in this one for password and use parentID and username?

  11. #10
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    One table for the users (parents), one table for the children (progress).

    Here is a free PHP/MySQL user register, validate registration with email, and login script.
    Then, it has like a profile page where the user can edit their own stuff, and the "admin"
    person can edit everything. http://php-login-script.com/
    Easy to install and customize. You would of course adjust, add, remove fields you didn't need.

    Each parent in the parent's table is one row in the database.
    Every child in the progress table has their own row in the database.

    So for me, there would be 5 lines used in the database (between 2 tables) ...
    Me and my wife (in the user table), My 3 children (in the progress table).
    If you have 1000 members, and the average is approx. 3 children each, you would have
    about 5000 lines ... if each parent has their own login. That's nothing for MySQL.
    It could easily handle twice that.

    Once you get the users, members, (parents), or whatever you call it ... and you get that part
    done, and it works, you can add parents, and log-ins, then you can work on the 2nd
    part ... the table for children (or progress). You'll be adding the child part to the parent
    profile part, so they can add, edit, delete children. All changes to that part will affect
    the other table (progress). So you'll have two tables that will use INSERT and UPDATE
    depending on what you're doing.

    The flow will be like this:
    1) User logs-in .. a SESSION (internal PHP cookie) is set, which is the ID number of the user.
    2) As the user moves around the site, all MySQL queries will only result in rows with their
    user ID, so they don't see any other users' data.
    3) When they want to do stuff with their children, those queries look for the parent ID
    in that table as well, and only their children will be found.
    4) Table INSERT to add users and children, Table UPDATE to change info in a row of the table,
    and Table SELECT to grab information you will use to display and make charts.

    MySQL is so nice and easy to work with, you'll be amazed at how a little amount of code is
    needed to do everything.

    I'm typing this like it all sounds easy, but as you mentioned in post #1, you're very
    new to this. You may have to hire a freelancer to do the programming for you ... or
    at least get most of it installed and running. Before spending too much time or money
    on this project, you should at least run some tests by unbiased people to see how many
    would find the site useful. Don't ask family or friends ... they'll lie to you, as not to offend.

    I'm also assuming this is related to the other posts you've been making on WDF?

    NOTE:
    And maybe this shouldn't just be for "how many gold stars" they have ... how about
    keeping track of vaccinations, illnesses, grades in school, chores they do, places they go, etc.



Page 1 of 4 1 2 3 ... LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:33 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com