Jump to content

Recommended Posts

Hi,

 

I have these files:

/httpdocs/login.php

/httpdocs/secret/index.php

 

the login.php is publicly available, but the folder 'secret' is password protected via my webhost's cpanel

 

I would like the script login.php to check my database for the user submitted name and password and then re-direct the user to /httpdocs/secret/index.php WITHOUT the user having to authorize himself again to enter the password protected folder

 

Is there a way to 'forward username and password' in php like this?

Link to comment
https://forums.phpfreaks.com/topic/72371-setting-folder-authorization-with-php/
Share on other sites

If by "password protected via my webhost's cpanel" you mean HTTP authentication, then there is basically a way. You can use an url like "http://username:password@www.example.com/", but there are several problems in it. Firstly, it's not horribly secure, as the username and password will naturally pass through the user (though, not sure if there is much choice here), and secondly it doesn't work in IE.

 

Sadly, for HTTP authentication, I do not know any other way you can automatically pass the data when redirecting.

that's going to be really tricky. in my example I just named one file in the folder "secret" but in fact it's a folder with many files and many subfolders which are all needed to run the /httpdocs/secret/index.php script

 

so that's not really an option

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.