cancel
Showing results for 
Search instead for 
Did you mean: 

Protecting access to .php files

aenea
Grafter
Posts: 31
Registered: ‎30-07-2007

Protecting access to .php files

I have just read the posting at
  http://community.plus.net/forum/index.php?topic=465.0
that tells me I cannot use .htaccess/.htpasswd to protect .php files.
Is there any other way of restricting access to .php files or am I stuck with them being publicly accessible?
4 REPLIES
Community Veteran
Posts: 14,469
Registered: ‎30-07-2007

Re: Protecting access to .php files

There is no way to protect access to php files on the ccgi server.
The only option you have is to add some form of authentication protection at the beginning of each file so it will only be run if say the user is logged in.
aenea
Grafter
Posts: 31
Registered: ‎30-07-2007

Re: Protecting access to .php files

Quote from: Peter
There is no way to protect access to php files on the ccgi server.
The only option you have is to add some form of authentication protection at the beginning of each file so it will only be run if say the user is logged in.

Thanks - can you point me to a reference on how to do this? (I'm a PHP beginner.)
Community Veteran
Posts: 14,469
Registered: ‎30-07-2007

Re: Protecting access to .php files

Are you writing your own code or trying to install an existing package like a forum?
If you own code, do a google search for php authentication or look at www.hotscripts.com for authentication scripts. They should then have a method to protect php files.
If you are installing someone elses code then I suspect you will not be in a position to modify it without a lot of php experience.
aenea
Grafter
Posts: 31
Registered: ‎30-07-2007

Re: Protecting access to .php files

Quote from: Peter
Are you writing your own code or trying to install an existing package like a forum?
If you own code, do a google search for php authentication or look at www.hotscripts.com for authentication scripts. They should then have a method to protect php files.
If you are installing someone elses code then I suspect you will not be in a position to modify it without a lot of php experience.


Thanks for that.  I am writing my own code - learning to use php as I go. That sounds like a useful site to know about. I'll take a look there and see if I can find something suitably simple.