Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

Folder Permission on Linux: only allow my PHP script access?

General discussions related to php

Moderators: macek, egami, gesf

Folder Permission on Linux: only allow my PHP script access?

Postby Tony121076 » Fri Mar 07, 2003 11:03 am

I made a simple (unsecure, I know), php script to handle a few password protected pages on my site. All of the links to the secure pages pass a variable to the script that then gets the requested file's content from a sub folder and shows it (if they enter the correct password).

My question is this. Can I set the permission (linux server) on the subfolder so that only my local script can access the files inside (but web site visitors can't just type in the address to a file in that folder)?

Thanks in advance.
Tony121076
New php-forum User
New php-forum User
 
Posts: 28
Joined: Fri Jan 03, 2003 4:00 pm

Postby Redcircle » Sat Mar 08, 2003 11:04 am

Here is what you can to. Make a directory in your account that is not world readable. Typically in your root dir under the public_html dir. Just have your script read in the information from that dir.

You cannot change the permissions on the file because your webserver user that the index.php is executed as would not beable to read in the file.

You could use .htaccess on the subfolder. it would bring up a username and password dialog if the user directly access the file.
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Postby Unknown » Sat Mar 08, 2003 12:21 pm

Why not use php sessions??
Unknown
New php-forum User
New php-forum User
 
Posts: 9
Joined: Mon Jan 13, 2003 10:33 am


Return to PHP General

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron