Results 1 to 2 of 2

Thread: Need help on my website...

  1. #1
    butter Guest

    Smile Need help on my website...

    :: Link Removed By Moderator ::
    how do I make a login page/registration page?
    thanks
    Last edited by <CrGeary.com/>; 06 Jul 2010 at 04:42 PM.

  2. #2
    Join Date
    Mar 2010
    Location
    England
    Posts
    1,144
    Basically, just make another .php page call its something like: register.php then:

    1. Make a HTML form containing fields like:
    - Name
    - Email
    - Password
    - Repeat Password

    2. Get your Form interacting with the PHP, using the POST ( $_POST ) method.

    3. Use that PHP to validate data, and then insert it into the database or XML file or w/e your trying to put it into (assuming its a database) then you would do something like this:

    1. Check if all fields are filled out

    2. Check to see if the email is the same as another record in the database. Do this by doing a simple select statement like this:
    [code]SELECT user_email FROM users WHERE user_email = 'the_email@from_the_form.com' LIMIT 1[code]
    Then use mysql_num_rows(); to see if any records where returned, if mysql_num_rows() was 1, then that email exists already, so ask for another.

    3. Next check to see if the passwords match, a simple example would be:
    PHP Code:
    if( $_POST['pass1'] != $_POST['pass2'] ){
         
    // Code to say the passwords do not match.

    4. You also need to validate the email address using a regular expression, and you could probably validate the other fields too.

    5. If everything has gone ok so far, and the email is not in the database, then insert a new record into the database, something like this:

    PHP Code:
    mysql_query"INSERT INTO users ( user_id, user_name, user_email, user_password ) VALUES( NULL, '$name', '$email', '$password' )" ); 

Similar Threads

  1. Website Functionality : Effective Website Design to achieve Maximum Success
    By aressindiaseo in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 18 Apr 2009, 10:39 AM
  2. Free website templates, website tools & website articles
    By webguruaish in forum Website Design Reviews
    Replies: 0
    Last Post: 27 Apr 2007, 08:07 AM

Posting Permissions

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