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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    PHP to give Unique area only accessible by that member

    Hey all,
    First post; May I start by saying this forum has given invaluable help over the last couple of weeks.

    Ok, first off, I aim to develop a system which, in its simplest:

    1.Allows users to log in, Forget Password, and all that jumble.

    2.Takes said user to their own version of, index.php.

    3.On page, the user can only see their stats, and can edit only theirs. There may be a button, for example 'PURCHASE 10 ITEM1's' which if pressed will check if they can do it via looking at a database entry associated with their account.

    EXAMPLE database:
    NAME PASSWD MONEY ITEM1 ITEM2
    DAVE ***** 500 4 5

    By purchasing 10 item 1s it would take off their combined cost for example 100 from money.

    That's all simple maths, but what I can't get my head around is how a user can just see their section and deal with their section and no one elses.

    Further If implemented I am looking to have various pages like this, where only the user in question can see their records for that page.

    I have tried to explain clearly, please feel free to ask questions.

    I am not asking for all the code, but if you can, point me in the right direction.

    Thanks all!

    EDIT:
    Quote Originally Posted by Fou-Lu View Post
    Its a simple matter of: login -> establish session variables -> pull session variables for data -> query only based on the session variables.

    Simple as that. PHP was designed with the purpose to introduce dynamic content based on input. Give google a quick look for 'php mysql user tutorial'. There will likely be a lot of matches to tutorials that can take you step by step to creating a simple user system.
    Thanks for quick reply, I will look into that and bump thread if I have trouble! Btw I have already made the login and stuff it was mainly the other part of having a unique page.
    Last edited by Glitch100; 02-16-2012 at 11:42 PM.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Its a simple matter of: login -> establish session variables -> pull session variables for data -> query only based on the session variables.

    Simple as that. PHP was designed with the purpose to introduce dynamic content based on input. Give google a quick look for 'php mysql user tutorial'. There will likely be a lot of matches to tutorials that can take you step by step to creating a simple user system.

  • Users who have thanked Fou-Lu for this post:

    Glitch100 (02-16-2012)

  • #3
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,470
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    You're doing a stand-alone site (not using Jooma or a pre-made CMS),
    so I recommend you download and use this free user/register/login script:
    http://php-login-script.com/

    You can customize it how you want. In fact, I've used it (just for the scripts),
    and not any of the CSS, layouts or graphics. I used all my own stuff.

    You will be adding more columns to their profile (than what the script uses).
    Add columns for user "account balance", and anything else you need.


  •  

    Posting Permissions

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