+ Reply to Thread
Results 1 to 9 of 9

Thread: i want to make user registration

  1. #1
    neteater's Avatar
    neteater is offline x10 Lieutenant neteater is an unknown quantity at this point
    Join Date
    Dec 2008
    Location
    some where between CPU and heat sink
    Posts
    377

    i want to make user registration

    hi there i want to make an user registration system on my website can any one tell me how to do this step by step like creating a databse conecting it storing user info and most imp thing i want to retrict visitor of my site by playing any online game without being register how to do this the last thing is very important please help me

  2. #2
    diabolo's Avatar
    diabolo is offline Community Advocate diabolo is on a distinguished road
    Join Date
    Nov 2007
    Location
    Jersey Shore
    Posts
    1,683

    Re: i want to make user registration

    creating a user registration system is quite a challenging thing, once you take into consideration everything. A simple one wouldn't be hard, but if you want the security I suggest you use an already created CMS or forum and integrate the member system into your website

  3. #3
    kbjradmin's Avatar
    kbjradmin is offline x10 Elder kbjradmin is an unknown quantity at this point
    Join Date
    Feb 2008
    Location
    Washington State, USA
    Posts
    512

    Re: i want to make user registration

    well, have fun with that... :nuts:

  4. #4
    Zenax's Avatar
    Zenax is offline Lord Of The Keys Zenax is an unknown quantity at this point
    Join Date
    Jul 2006
    Location
    The Brilliant United Kingdom
    Posts
    1,339

    Re: i want to make user registration

    Hey,

    Creating a members system is not as hard as you think. The basic principle that you are trying to achieve, is to have a website with games on it, but people are only allowed to play the game with having a member account.

    One of the ways in which you would achieve this is by using session cookies. You would have a PHP script that would check the username against the cookie to see whether a current user is logged in.

    One of the first things that you have to do is to create the MySQL database in which you are going to store usernames, passwords and email addresses or any other information that you might want to have on the registration form.

    Start off by going into MySQL admin in your cPanel, and create a new database. You are able to name it whatever you want to, but one of the most simple names would be members or users.

    Now you need to set up a connection script to the database. This is achieve like this:

    PHP Code:
    mysql_connect ('localhost''database Username''database password or die ("cannot connect!");
    mysql_select_db ('
    database name') or die ("cannot select database"); 
    That is a basic connection script. all you have to do is change the database username and password to your cPanel username and cPanel password!

    The database name would be cPanel username_database name. Example: zenax_members

    Once you have this file created, you can then reference it in every file it is required. I am not going to go into any more detail, but if you do a simple google search on PHP Registration tutorial, there are a few decent ones out there that can help you out. Once you followed a tutorial, you can then adapt it to use cookies if it is not discussed in the tutorial.

    Hope this is a little bit of help to you!
    Last edited by Zenax; 02-14-2009 at 04:50 PM.
    Regards,
    Zenax

  5. #5
    garrettroyce's Avatar
    garrettroyce is offline Generally Helpful Member garrettroyce is a glorious beacon of lightgarrettroyce is a glorious beacon of light
    Join Date
    Apr 2008
    Location
    IL, USA
    Posts
    3,746

    Re: i want to make user registration

    Building on what Zenax said, if you want to make sure the user can't view a page without being logged in you can redirect them like this:

    Code:
    if(!isset($SESSION['user_logged_in']))
    {
         header("location: mywebsite.com");
    }
    Or display different content
    Code:
    if(!isset($SESSION['user_logged_in']))
    {
         echo "you must be logged in to view this";
    }
    else
    {
         echo "you are logged in!";
    }
    You would save the $SESSION['user_logged_in'] value if the user's login is correct.

    I found a nice article here:

    http://www.phpeasystep.com/workshopview.php?id=6

    As diabolo said, creating a script is pretty easy, but making a secure and featured script is quite difficult. If you don't understand everything that is happening in your script, you may open a huge hole in your security or close off legitimate users from doing what they want.

    Good luck!
    Last edited by garrettroyce; 02-14-2009 at 05:16 PM. Reason: added reference to diabolo

  6. #6
    freecrm's Avatar
    freecrm is offline x10 Elder freecrm is an unknown quantity at this point
    Join Date
    May 2008
    Location
    UK
    Posts
    629

    Re: i want to make user registration

    OMG... a true registration is lengthy and pretty tricky!!!

    I have one on my site...

    Form - put in details - JS to validate the form values.

    Encrypt data.

    Save to DB - send automated email to User.

    User validates from e-mail using link.

    The a login system has to be done with sessions or cookies - Login page itself and then a check system on each page......

    This is not simple and anyone trying to do this without validation is subject to mass spamming problems.

    That said, it is a very good way to learn php!

    Just try to go through it step by step but don't expect it to be an evenings work!

    Due to the number of times this comes up, I think I might do a tutorial (If there isn't one already)

  7. #7
    xPlozion's Avatar
    xPlozion is offline x10 Elder xPlozion is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Delaware, USA
    Posts
    872

    Re: i want to make user registration

    i've gotta agree with some to say that a user registration is pretty simple. you don't need js, just make sure you check the forms in php ;) i built mine early on in my php learning process, and it was actually easy.

    encrypting data is a one line piece of code sha1($pass.$salt); ($salt to make it more secure).

    i had a few lines on top of all the code (10 lines max iirc) to check if the user was authenticated to be logged in and to set a few values (id > username, time offset, etc), and this was part of the 10 lines.


    what i did was use cookies to set a user_id and a password cookie.

  8. #8
    garrettroyce's Avatar
    garrettroyce is offline Generally Helpful Member garrettroyce is a glorious beacon of lightgarrettroyce is a glorious beacon of light
    Join Date
    Apr 2008
    Location
    IL, USA
    Posts
    3,746

    Re: i want to make user registration

    Quote Originally Posted by xPlozion View Post
    i've gotta agree with some to say that a user registration is pretty simple. you don't need js, just make sure you check the forms in php ;) i built mine early on in my php learning process, and it was actually easy.

    encrypting data is a one line piece of code sha1($pass.$salt); ($salt to make it more secure).

    i had a few lines on top of all the code (10 lines max iirc) to check if the user was authenticated to be logged in and to set a few values (id > username, time offset, etc), and this was part of the 10 lines.


    what i did was use cookies to set a user_id and a password cookie.
    Encryption is a very good measure, but there are many others that someone new to php might miss. For example, measures must be taken to avoid injection attacks. Valuable data in cookies can be exploited as well. I believe neteater can create a script, but will be be wholly secure?

    I would recommend a pre-built script or full tutorial to close every loophole.

  9. #9
    freecrm's Avatar
    freecrm is offline x10 Elder freecrm is an unknown quantity at this point
    Join Date
    May 2008
    Location
    UK
    Posts
    629

    Re: i want to make user registration

    Quote Originally Posted by garrettroyce View Post
    I would recommend a pre-built script or full tutorial to close every loophole.
    Full agree..

    xPlozion - you know what you're doing and scripts like this are relatively easy but to the uninitiated, this can be a little daunting.

+ Reply to Thread

Similar Threads

  1. Best Methods To Make Money Online
    By visitor0 in forum Earning Money
    Replies: 5
    Last Post: 08-12-2009, 02:29 PM
  2. Replies: 35
    Last Post: 02-06-2009, 11:40 AM
  3. quick help for how to make a database registration
    By cloudnakpil in forum Programming Help
    Replies: 3
    Last Post: 10-08-2008, 06:23 PM
  4. smf registration for and login script for 300 points
    By nahsorhseda in forum The Marketplace
    Replies: 0
    Last Post: 06-14-2008, 05:07 AM
  5. Can anyone make me a banner or two
    By Kay in forum The Marketplace
    Replies: 12
    Last Post: 12-22-2005, 08:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers