Web Design Forum  
 
Go Back   Web Design Forum > Web Software > Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-18-2011, 07:22 PM   #1
New Member
 
Join Date: Sep 2011
Posts: 4
Default PHP File Access

Hello,

I would like to be able to read a flat file with php (via fopen and fgets), but not allow viewers to access the file itself (by visiting www.website.com/flat_file).

I have not been able to get this working properly with file permissions. Is there another (efficient) way to accomplish this?
nschmoyer is offline   Reply With Quote


Old 11-19-2011, 03:28 PM   #2
Silver Member
 
Join Date: Jul 2011
Posts: 146
Default

Check if your web host allows you to store the file in a password protected directory. You can also set up your own password protection with .htaccess if your host allows that. Here is a tutorial.
__________________
space
Orchid Technical Services
Website Design/Development and Technical Support
DesignerBill is offline   Reply With Quote
Old 11-25-2011, 05:08 AM   #3
Bronze Member
 
n1c0_ds's Avatar
 
Join Date: Nov 2009
Location: Granby, Québec
Posts: 55
Send a message via Skype™ to n1c0_ds
Default

I have nothing to add. DesignerBill has covered the topic and provided the best answer. I merely confirm that using .htaccess is the best solution here.
__________________
Nicolas Bouliane
Web designer/developer in Granby, Québec
n1c0_ds is offline   Reply With Quote
Old 11-29-2011, 05:29 PM   #4
Silver Member
 
Join Date: Aug 2011
Posts: 100
Default

Another solution is to store it outside the web directory. For example store it in the directory above where you put the rest of your website.
__________________
Mark R

Wubbleyou - Web Design Newcastle
A professional web design agency based in Newcastle upon Tyne servicing clients based throughout the U.K.

Home spray tan machine - Landlord Reviews
MarkR is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:49 AM.


Camera Forum - Computer Forum - Web Design Forum

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.