Jump to content

setting folder authorization with php


dtest

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:[email protected]/", 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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.