changing password script not running, help me?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • muchexie
    New Member
    • Feb 2007
    • 20

    #1

    changing password script not running, help me?

    I have developed a login system but its failing to allow the user to change password.
    Here is my code.
    [PHP]
    <?
    require_once("s ystem_fns.php") ;
    session_start() ;
    do_html_header( "Changing password");
    check_valid_use r();
    $new_passwd=($H TTP_POST_VARS['new_passwd']);
    $new_passwd2=($ HTTP_POST_VARS['new_passwd2']);
    if (!filled_out($H TTP_POST_VARS))
    {
    echo "You have not filled out the form completely.
    Please try again.";
    display_user_me nu();
    exit;
    }
    else
    {
    if ($new_passwd!=$ new_passwd2)
    echo "Passwords entered were not the same. Not changed.";
    else if (strlen($new_pa sswd)>16 || strlen($new_pas swd)<6)
    echo "New password must be between 6 and 16 characters. Try again.";
    else
    {
    // attempt update
    if (change_passwor d($valid_user, $old_passwd, $new_passwd))
    echo "Password changed.";
    else
    echo "Password could not be changed.";
    }


    }
    display_user_me nu();
    ?>
    [/PHP]

    These are the error messages I'm getting.

    Notice: Undefined index: new_passwd in C:\project\test \change_passwd. php on line 6
    Notice: Undefined index: new_passwd2 in C:\project\test \change_passwd. php on line 7
    These are lines in question.
    [PHP]
    $new_passwd=($H TTP_POST_VARS['new_passwd']);
    $new_passwd2=($ HTTP_POST_VARS['new_passwd2']);
    [/PHP]
    Please help me.
  • xwero
    New Member
    • Feb 2007
    • 99

    #2
    what is the html code of the form?

    Comment

    • Motoma
      Recognized Expert Specialist
      • Jan 2007
      • 3236

      #3
      What version of PHP are you using? Have you tried referencing them via $_POST rather than $HTTP_POST_VARS ?

      Comment

      • muchexie
        New Member
        • Feb 2007
        • 20

        #4
        Originally posted by xwero
        what is the html code of the form?
        Here is the html code

        [HTML]
        <form method='post' action='change_ passwd.php'>
        <table bgcolor=''>
        <tr>
        <td>Username: </td>
        <td><input type='text' name='username' size=16 maxlength=16></td></tr>
        <tr>
        <td>Old Password:</td>
        <td><input type='password' name='passwd'
        size=16 maxlength=16></td></tr>
        <tr>
        <td>New Password <br />(between 6 and 16 chars):</td>
        <td valign='top'><i nput type='password' name='new_passw d'
        size=16 maxlength=16></td></tr>
        <tr>
        <td>Confirm password:</td>
        <td><input type='password' name='new_passw d2' size=16 maxlength=16></td></tr>
        <tr>
        <td colspan=2 align='center'>
        <input type='submit' value='Change'> </td></tr>
        </table></form>
        [/HTML]

        Comment

        • muchexie
          New Member
          • Feb 2007
          • 20

          #5
          Originally posted by Motoma
          What version of PHP are you using? Have you tried referencing them via $_POST rather than $HTTP_POST_VARS ?
          I'm using PHP 4.4.4 version.Well I'm going to replace $HTTP_POST_VARS by
          $_POST.
          Thanks I hope its gonna work.

          Comment

          Working...