Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default [PHP] Displays the same error?

    PHP Code:
    <?php
    $username 
    $_POST['username'];
    $password $_POST['password'];
    $cpassword $_POST['cpassword'];
    $email $_POST['email'];
    $password md5($password);

    $query mysql_query("SELECT * FROM `users`");
    $data mysql_num_rows($query);

    if(
    $grab_login === 1){
        
    header("Location: index.php");
    } else {
        if(
    $_GET['do'] == register){
            if(
    $data['username'] == $username){
                echo 
    "sorry mate, someone has that username already.";
            }
    [
    B]        if($password !== $cpassword){
                echo 
    "the two passwords do not match, learn how to type.";[/B]
            } else {
                
    $update mysql_query("INSERT INTO `users` (`username`, `password`, `email`) VALUES ('".$username."', '".$password."', '".$email."')");
                echo 
    "congratulations, you signed up.";
                echo 
    "<meta HTTP-EQUIV=\"refresh\" CONTENT=\"5\"; URL=\"index.php\">";
            }
        } else {
            echo 
    "<form action=\"?do=register\" method=\"post\"><br />
            username: <input type=\"text\" name=\"username\" /><br />
            password: <input type=\"password\" name=\"password\" /><br />
            confirm password: <input type=\"password\" name=\"cpassword\" /><br />
            email: <input type=\"text\" name=\"email\" /><br />
            <input type=\"submit\" value=\"login\" />
            </form>"
    ;
        }
    }
    ?>
    When I tested the script I got the error: "the passwords don't match, learn to type". I've tried it several times with the same password (copy + paste so they're not actually incorrect). I don't see anything wrong with it.

    +rep

  2. #2
    Join Date
    Jun 2008
    Location
    United Kingdom
    Posts
    2,015
    Tokens
    568

    Latest Awards:

    Default

    You've md5'd the first password, but not the second one.

  3. #3
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    Ahh, thanks.

Posting Permissions

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