Results 1 to 3 of 3

Thread: [RESOLVED] username password help

  1. #1

    Thread Starter
    Hyperactive Member ninjanutz's Avatar
    Join Date
    Jun 2005
    Location
    Bayside
    Posts
    256

    Resolved [RESOLVED] username password help

    i made the option for username password retype password on my form how can i make it so wen the information is processed it will make sure both passwords match and give u a popup warning if they dont?

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: username password help

    When the forum is submitted, read the 'newpassword' and 'confirmnewpassword' fields, compare them, and depending upon that, you can show a message or continue with submission of the form.

  3. #3
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: username password help

    All you need is a simple string comparision:
    PHP Code:
    if ($_POST['password'] != $_POST['confirm_password']) {
      
    /* passwords don't match - redirect back to the form */

    You can also use client side Javascript to check this before the form is submitted to your script.
    Code:
    <script type="text/javascript">
    <!--
        function check_pw(theForm)
        {
            if(theForm.password.value != theForm.confirm_password.value)
            {
                alert('Your passwords do not match.');
                theForm.password.value = '';
                theForm.confirm_password.value = '';
                theForm.password.setFocus();
                
                return false;
            }
            
            return true;
        }
    //-->
    </script>
    ..
    
    ..
    
    <form onsubmit="return check_pw(this);">
    You should also still check in the PHP script even if you yuse javascript to check as this can be bypassed.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

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



Click Here to Expand Forum to Full Width