Re: Securing a File with php
| From: | Mike Mike | Date: | Tue, 28 Nov 2000 18:56:10 +0000 |
| Subject: | Re: Securing a File with php | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-27658@lists.php.net to get a copy of this message | ||
I have something like that where the php file will ask
for a password if you go straight to the page. Like
for example:
if i typed
http://www.somewhere.com/~mike/upnorth/somefile.php
it would bring up a login screen and ask for a
password. But if i typed
http://www.somewhere.com/~mike/upnorth/word.doc
you can view that word document without a login screen
showing up.
Is there a way to do this in php to avoid viewing the
word document securely without the .htaccess file? The
problem I'm having is if I do secure the directory
with a .htaccess file it asks for the password 2
times. One for the php file and one for the
directory. I'm trying to get away with the 2nd login
screen wich the .htaccess file creates.
Thanks
--- lou <louisr@gte.net> wrote:
> I would do this:
>
> On successful log in, create a session variable for
> the user like "login=1"
>
> On all the pages that you want secured....put an "if
> login = 1" at the top
> of the php page. This way if someone tries to access
> that page they will not
> have a value for login and will get bumped out (or
> wherever you want to put
> them from your "else" statement.)
>
> Hope this helps
>
>
>
> > Hello,
> > I have a secure login which works fine. But I
> have a
> > document that when you do a direct link to it,
> people
> > can view it. Is there a way of securing that
> document
> > without using a .htaccess file with php. I've
> tried
> > to move it outside of the /home/html path but
> could
> > not get it to work.
> > Thanks for any help.
> > --Mike
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Shopping - Thousands of Stores. Millions of
> Products.
> > http://shopping.yahoo.com/
>
__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/