• Resolved b-cat

    (@b-cat)


    I’m trying to format a URL link so that it will automatically submit the password for one of my password-protected pages, and will automatically load the page without the user having to manually type the password.

    I’m thinking I need to create a URL something like this:

    http://mysite.com/page.htm?[place various parameters here]

    The variables below might be useful information. The login page for the password-protected page shows the following:

    <form action="http://mysite.com/login?action=postpass" class="post-password-form" method="post">
    <label for="pwbox-1234">  "Password:"
    <input name="post_password" id="pwbox-1234" type="password" size="20">
    <input type="submit" name="Submit" value="Submit">

    Any suggestions on how to correctly format a URL so it will submit the password properly? Can this even be done?

    Many thanks for any suggestions!

Viewing 4 replies - 1 through 4 (of 4 total)
  • If you want to pass the password from the form, you need to set the forms method parameter to “get” instead of “post”. BUT… if you’re doing that you should set the form value for ‘action’ as a hidden field so that it’s passed correctly with the rest of the form values.

    <form action="http://mysite.com/login" class="post-password-form" method="get">
    <label for="pwbox-1234">  "Password:"
    <input name="post_password" id="pwbox-1234" type="password" size="20">
    <input type="submit" name="Submit" value="Submit">
    <input type="hidden" name="action" value="postpass" />
    Thread Starter b-cat

    (@b-cat)

    Sorry…I think you might misunderstand my question.

    I don’t want to change the manual login form. For people who need to manually log in, the existing form created by WordPress is fine. (That’s the form code I provided above.)

    What I want to do is this: I want to be able to provide selected users with a specific link (for example, I want to send the link in an email) that links directly to the password-protected page, and that link should have the password already included in the URL.

    For example, the URL I might provide to someone might look like this:
    http://mysite.com/page.htm?[place various parameters here]

    The question is: What is the parameter string that needs to follow the “?” question mark at the end of the URL?

    Thanks.

    Moderator bcworkz

    (@bcworkz)

    You cannot access protected pages that way. The password is sent to the login page for special processing, which sets a cookie if the password is correct. Then the login redirects to the page contained in HTTP_REFERER and the contents are displayed if the cookie is correctly set. Thus the password must come from the page to be opened. Submitting the password from anywhere else will result in a redirect to the wrong location.

    In order to do what you want, you need a custom coded page template that has the ability to check it’s own password.

    Thread Starter b-cat

    (@b-cat)

    Ah…okay. That explains a lot. Thanks very much.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to submit page password via URL parameters’ is closed to new replies.