Search code examples
phpphp4

Can I login to a protected directory via a link?


I want to create links to pages and content that are in protected directories. I didn't program the protected directories I set them up from the host admin page.

I want to be able to give links to user that will take them to page and login as well.

Also if there is a way I want to be able to embed content from the protected directories in other places and not have the password box shop up in order to display the content.

I am using PHP4

Thanks!


Solution

  • Depending on the authentication, you can use a URL like this:

    http://username:password@yoursite.com/protected_dir
    

    I know that works for simple protection via .htaccess. However, keep in mind that you will be sending that link with the password in clear text, and may be inadvertently seen by the wrong people.