1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Newbie Help: Create Register & Login Pages

Discussion in 'PHP' started by ozgression, Aug 25, 2013.

  1. #1
    I want to use PHP/MySQL/Apache to make a site which allows registration and login. So, I need to create a table in the MySQL database which has the fields for UserID (auto increment), UserName (person's first name), Password (selected by the user when registering) that a user submits to the database using the register.php page. The user then needs to be redirected to the index.php page and click the "Login" link to go to the login.php. Oh, they also need to be able to "Logout".

    This sounds really simple, probably, to you guys. But I tried to use a tutorial and the MySQL insertion was out of date or something. It was for an older version of PHP or MySQL or both. ;)

    So, any tips or code examples to share with me?
     
    ozgression, Aug 25, 2013 IP
  2. johnd123

    johnd123 Active Member

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    56
    #2
    Hay - this is a big project with many things to consider such as form validation and checking

    as for the unique id, you could do this a few ways, the easiest would be something like

    
    <?php
    
    $unique_id = time(); //Gives a unique id based on timestamp
    
    ?>
    
    PHP:
    The likelyhood of someone registering at the exact millisecond is very unlikely :)

    As for the rest of the code, doing a quick search on google for "php sql member login tutorial" produced many helpful results
    Normally i don't like stating the obvious but as this is a specific thing i really feel its your 1st point of call.
     
    johnd123, Aug 25, 2013 IP
  3. ChiragKalani

    ChiragKalani Active Member

    Messages:
    41
    Likes Received:
    2
    Best Answers:
    3
    Trophy Points:
    73
    #3
    Hi John, I have created one sample code to understand how things work. Please find attached login-register.zip.

    Please create "test" database and and create dbUsers table in that database. Update db config in config.php file.

    Please reply if you have any confusion. This is very basic example but in really it will be much complex.
     

    Attached Files:

    ChiragKalani, Aug 25, 2013 IP