Results 1 to 5 of 5

Thread: Creating New User Accounts with PHP

  1. #1
    Join Date
    Aug 2006
    Posts
    209

    Creating New User Accounts with PHP

    I have done many programs with PHP. I want to create a new user account using PHP. Can someone help me by telling the right solution. I have chosen the PHP because by using PHP, it enables a web site programmer to automate server tasks. Hoping that someone knowing the solution will help me soon.!!
    Blessings to you

  2. #2
    Join Date
    Mar 2008
    Posts
    672

    Re: Creating New User Accounts with PHP

    I think that creating a new user account in PHP is not so tough. You can do it easily once you get the proper knowledge of PHP. I would like to tell you that while creating a new user account in PHP, you will have to write the coding that will do the following things :
    1. If no user details have been entered then display a form asking for all relevant details (just like validation).
    2. Work out whether the web page needs to display a blank form or if it should process the new user's details.
    3. Also the main thing you will have to keep in mind, that when the user enters the user-name that should be checked in database to see if it is already exists.
    4. If the user id already exists, the code should inform that the id is already taken.
    5. And if the id is not in database, then create the new id.

  3. #3
    Join Date
    Mar 2008
    Posts
    349

    Re: Creating New User Accounts with PHP

    I have given you the code that might help you to understand the coding of PHP for creating a new user account in PHP. Just have a look on the coding that is mentioned down :
    PHP Code:
    <?php
    if ( isset( $_POST['submit'] ) )
    {
      if ( 
    authed() == true )
        
    header"Location: account.php" );
    }
    ?>
    <form action="login.php" method="post">
    <input name="submit" type="submit" value="Register"/>
    </form>
    In the above code have assumed that it is in 'login.php' file.

  4. #4
    Join Date
    Jul 2006
    Posts
    289

    Re: Creating New User Accounts with PHP

    The main thing will have to see is that after the user keeps the user id field blank, then your code must check that properly and should give message to the user to enter the user id. The following code will help you for identifying whether or not the User has entered their details. Here is the PHP code for that :
    PHP Code:
    <?php
    $username 
    $_REQUEST["username"];
    if (!isset(
    $username)) {
    echo 
    "<form method=post>
    Enter New Username<input name=username><br>
    <input type=submit></form>"
    ;
    } else {
    The above code will be executed only if the user has entered details into a text box and then pressed the submit button.
    Signatures reduce available bandwidth

  5. #5
    Join Date
    Aug 2006
    Posts
    235

    Re: Creating New User Accounts with PHP

    If you are using the SQL as your database and you have to check that the entry done by the user exists or not then you will have to call the select function which can be written as follows :
    Code:
    $SQL = "select * from USERS where username='$username'";
    After this you will have to run the query mentioned below on the database :
    Code:
    $result = mysql_query($SQL) or die (mysql_error());
    Then you will have to use the code stated down :
    Code:
    $num = mysql_numrows($result);
    The user name already exists, if the number returned is not zero.
    3.2 (northwood)
    2gig ram
    ATI AIW X800xt 256mb
    Gigabyte GA-8knxp 875p Chipset
    Optiwrite 8X DVD Burner
    Win XP PRO Sp2 (Works Perfectly)
    2 SATA Raptor 74gig Raid 0
    2 7200 IDE 320gig HD

Similar Threads

  1. Replies: 7
    Last Post: 15-10-2011, 10:36 PM
  2. Replies: 4
    Last Post: 17-08-2010, 12:20 AM
  3. Replies: 2
    Last Post: 22-07-2009, 11:55 PM
  4. How to Change user accounts with Super user in Linux/Unix
    By mellisahi in forum Tips & Tweaks
    Replies: 2
    Last Post: 26-01-2009, 06:20 PM
  5. Can't log on to my user accounts
    By Deffen-Baugh in forum Windows XP Support
    Replies: 2
    Last Post: 11-10-2008, 11:44 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,710,819,238.91245 seconds with 16 queries