/    Sign up×
Community /Pin to ProfileBookmark

PHP Sessions and .htaccess

I have a section of a website that is password protected for members only and I use PHP sessions to keep the connection alive between pages. While logged in they have access to a series of internal links to a subdirectory of html files that pop into a new window… however this directory it is not protected. … unless you know the exact URL, you pretty much cant find it… but I am concerned that people are copying the link and sending it to other people who are not subscribers.

Is it possible to setup some sort of .htaccess on a certain directory, in which the user would be prompted for a username and password unless they were already logged in? [B]Meaning is it possible to pass a PHP session username and password to a .htaccess-protected directory? If they are logged in already they see the page/directory, if they are not logged in they get the .htaccess prompt.[/B]

Is there a way to do this or can someone recommend a better method of handling this?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@ripcurlksmauthorMay 16.2007 — The files I am trying to protect are .htm Microsoft Publisher files, not PHP files. Which is why I choose .htaccess... Please advise.
×

Success!

Help @ripcurlksm spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...