Members Only Script? Advice Needed!

Discussion in 'Programming' started by GH Fever, Feb 25, 2010.

  1. #1
    Hi there. I'm trying to make a certain section of my website exclusive to members only. So a user must sign up by entering his/her e-mail address, etc and using a username/password to login to the restricted pages.

    How would I go about doing this? Is it a script or a simple code, or?

    Any help would be truly appreciated.
     
    GH Fever, Feb 25, 2010 IP
  2. jimmy4feb

    jimmy4feb Peon

    Messages:
    56
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Its not a very complicated task, you just need to maintain user session. Follow this link to know about the sessions please visit this link

    http://www.tizag.com/phpT/phpsessions.php

    after creating the session you need to add

    session_start();

    in the 1st line of every page where you want to give access to only authorized user.

    see the following example that how to make a login page.

    http://php.codenewbie.com/articles/php/1482/Login_With_Sessions-Page_1.html

    Hope this information will help you.

    Thanks,

    Jimmy
     
    jimmy4feb, Feb 26, 2010 IP
  3. GH Fever

    GH Fever Peon

    Messages:
    432
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for all the great reading material!

    I have a few questions about the second link though. I have the logout.php, auth.php and connect.php files saved to my computer, I also have a MySQL database setup for this.

    I'm having trouble figuring out what to do from this point onward, though.

    Do I upload the three files to my webserver? Where do I place the code on an already made page in order to make it subscription only? Where do user register?

    Still very confused.

    Thank you for your help!
     
    GH Fever, Feb 26, 2010 IP
  4. jimmy4feb

    jimmy4feb Peon

    Messages:
    56
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hello,

    You know I am going to make you more confuse by giving this answer. But just try to understand the things.

    you need to upload these file into server & you can place these files any where in your server but give a link to these files into your website else you will not able to access the files using your website. You also need to upload or create database on server which these pages will use.

    you need to make a form for registering a new user. to do this you do not need to maintain any session.

    Just make a user registration form in HTML & insert the values of the HTML fields into database using PHP

    see following link to know that how you can create registration form

    http://www.x-code.com/vdaemon/samples/registration.php

    Use these links are reference material, do not try to use these examples as it is in your website beocz you will not come to know anything that whts going on & you will get more confuse.

    Try to code pages your self... Google about the topics you need....

    There is alot of material on internet from which you can take help....

    Thanks,

    Jimmy
     
    jimmy4feb, Feb 26, 2010 IP
  5. GH Fever

    GH Fever Peon

    Messages:
    432
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Jimmy,

    Thanks a LOT for all the help you've provided. I think I've got the basic idea of what to do and am going to start researching and coding today!

    You rock.
     
    GH Fever, Feb 27, 2010 IP
  6. jijieyz

    jijieyz Guest

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Yeah.. Thats give me an idea too..
    Thanks.
     
    jijieyz, Mar 26, 2010 IP