944,117 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1287
  • PHP RSS
Jul 26th, 2007
0

PHP and XML

Expand Post »
I use PHP to access a XML data file. I don't want that XML to be access by browser(see) access only data with php. How to block the access to the XML for everithing else except the PHP file?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
Alexandro is offline Offline
26 posts
since Sep 2006
Jul 26th, 2007
0

Re: PHP and XML

You'll need to use .htaccess to block that file. If your XML files all have a .xml file extension this oughta do it:

PHP Syntax (Toggle Plain Text)
  1. # Block all .xml files from being viewed through a web browser
  2. <Files ~ "\.xml$">
  3. Order allow,deny
  4. Deny from all
  5. </Files>
Moderator
Reputation Points: 161
Solved Threads: 38
He's No Good To Me Dead
stymiee is offline Offline
1,422 posts
since May 2006
Jul 26th, 2007
0

Re: PHP and XML

if I don't have a htdocs I create one myself in the public area ?
This block also the search engines or i have to use a robot.txt file?
Reputation Points: 10
Solved Threads: 0
Light Poster
Alexandro is offline Offline
26 posts
since Sep 2006
Jul 26th, 2007
0

Re: PHP and XML

This will block everyone. It goes in a file called .htaccess and it needs to be in your root directory.

Keep in mind that no one can find these files unless you someone have their location in your source code. Otherwise the odds of someone finding them will be small.
Moderator
Reputation Points: 161
Solved Threads: 38
He's No Good To Me Dead
stymiee is offline Offline
1,422 posts
since May 2006
Jul 26th, 2007
0

Re: PHP and XML

It is not about finding them in the source code, I want the acces to see to be block for everithing, with the exception of the PHP file the acces the file, like a sql database with a password.
Reputation Points: 10
Solved Threads: 0
Light Poster
Alexandro is offline Offline
26 posts
since Sep 2006
Jul 27th, 2007
0

Re: PHP and XML

I understand why you want to do it. I just wanted to let you know the odds of anyone finding those files is very remote.
Moderator
Reputation Points: 161
Solved Threads: 38
He's No Good To Me Dead
stymiee is offline Offline
1,422 posts
since May 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Object Oriented PHP Question
Next Thread in PHP Forum Timeline: login form





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC