Creating a registration page with php and mysql

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Phoubers
    Sergeant

    • Oct 2007
    • 34

    #16
    Re: Creating a registration page with php and mysql

    hmmm yet, theres another problem i had a friend sign up and everything worked fine, but then he registered again with the same name and it let him...so the usernamecheck isnt working properly

    $usernamecheck = mysql_query("SELECT * FROM members WHERE username = '$username'");

    if ($usernamecheck >= 1)
    errors .="Message";

    is what i have so, what am i doing wrong now?
    No its not Fowbers its foobers :D

    Comment

    • navaldesign
      General & Forum Moderator

      • Oct 2005
      • 12080

      #17
      Re: Creating a registration page with php and mysql

      Instead of :

      $usernamecheck = mysql_query("SELECT * FROM members WHERE username = '$username'");
      $emailcheck = mysql_query("SELECT * FROM members WHERE email = '$email'");

      and

      if (mysql_num_rows($usernamecheck)==1)
      $errors .="Sorry but the username <b>$username</b> is already taken.<br />";




      use this code:

      $query = "SELECT username FROM members WHERE username= '$username'";
      $result = mysql_query($query, $con);
      $rows = mysql_affected_rows ();
      if ($rows != 0) {
      $errors .= "This Username address already exists! Please select another one!<br>";
      }

      and a similar one for the email address
      Navaldesign
      Logger Lite: Low Cost, Customizable, multifeatured Login script
      Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
      DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
      Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

      Comment

      • Phoubers
        Sergeant

        • Oct 2007
        • 34

        #18
        Re: Creating a registration page with php and mysql

        Originally posted by navaldesign View Post
        Instead of :

        $usernamecheck = mysql_query("SELECT * FROM members WHERE username = '$username'");
        $emailcheck = mysql_query("SELECT * FROM members WHERE email = '$email'");

        and

        if (mysql_num_rows($usernamecheck)==1)
        $errors .="Sorry but the username <b>$username</b> is already taken.<br />";




        use this code:

        $query = "SELECT username FROM members WHERE username= '$username'";
        $result = mysql_query($query, $con);
        $rows = mysql_affected_rows ();
        if ($rows != 0) {
        $errors .= "This Username address already exists! Please select another one!<br>";
        }

        and a similar one for the email address
        Hmm idk still not working. My Table name is members and the username field is username so im not sure why this isnt working. I am going to drop the table and make a new one to see if this helps.
        No its not Fowbers its foobers :D

        Comment

        • navaldesign
          General & Forum Moderator

          • Oct 2005
          • 12080

          #19
          Re: Creating a registration page with php and mysql

          Enter phpMyadmin and check to see if the two usernames are actually the same. If the seem the same, check to see that whitespaces have been trimmed (or modify your code to trim them) as a simple white space can create the problem
          Navaldesign
          Logger Lite: Low Cost, Customizable, multifeatured Login script
          Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
          DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
          Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

          Comment

          • Phoubers
            Sergeant

            • Oct 2007
            • 34

            #20
            Re: Creating a registration page with php and mysql

            Ok a friend and i have tested it and EVERYTHING on the page is working. An email is sent to us with the url. But watdaflip sais

            The "validation page to confirm the registration": you need to have one more field in your database, for subscription Status. It should be set in "Pending" (or a number, if you wish to use numbers instead of text) when the user registers. Your script, should also send an email to the user, with a message and a link like " Please click on the following link to activate your account: http://www.yourdomain.com/activation...o$validcode;?> . the user clicks on that and gets redirected to a script called "activation.php" on your site . This script recieves the $validcode value, looks in the database for a user with that value, and if it finds such a user, it updates the table setting the Status field in "Active", or displays an error message.
            How would i redirect it from http://www.yourdomain.com/activation...o$validcode;?> to the activcation.php, i already have the activation.php ready. Im guessing i should redirect it in the registration form?
            No its not Fowbers its foobers :D

            Comment

            • navaldesign
              General & Forum Moderator

              • Oct 2005
              • 12080

              #21
              Re: Creating a registration page with php and mysql

              Not sure what you mean.

              What i suggested is that the email sent to the user after registration cintains a link like : http://www.yourdomain.com/activation...tekey=xxxxxxxx where xxxxxxx is the actual value of the validation key for the specific user. The user clicks on this link and is automatically redirected to the activation page. There, in this page, you need to have a piece of code that will update the "Status" column, for this specific user, to be "Active". After the script activates the account, you can simply use a header ("Location: http://.........."); command to redirect the user to whatever page you want. If you want the user to go straight in his profile page in order to add more details, just place there the URL of the Edit Profile page, like header ("Location: http://www.yourdomain.com/path/editprofile.php?validatekey=xxxxxxxx");
              Navaldesign
              Logger Lite: Low Cost, Customizable, multifeatured Login script
              Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
              DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
              Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

              Comment

              Working...
              X