Jump to content

Recommended Posts

Let me first say i love using php to solve my problems, so for this php was an obvious choice.

 

Im using XML for a database, then i have a script that can search it to retreive data.  Is there a way to make it so that you cant navigate to www.mysite.com/file.xml  but my php page can access the xml file?  That would be ideal, if impossible, at least encrypt so that you cant read the xml file...And No im not switching to mySql, xml is perfect for what im doing, however i can use mysql for things like passwords or something if thats a suggestion but i really cant think of a way.. any ideas welcome!

Link to comment
https://forums.phpfreaks.com/topic/74170-protecting-pages/
Share on other sites

You could rename the file so it has a .php extension then at the top put <?php exit(); ?>

You'd have to make a little change in your scripts to discard this before processing the XML data; but that wouldn't be too much IMO.

Also if you are using Apache for a web server you could use a .htaccess file to deny access to the file.

And another option is to move the file beneath the web directory.

Link to comment
https://forums.phpfreaks.com/topic/74170-protecting-pages/#findComment-374578
Share on other sites

so i like that 3rd option a lot, in my web directory all files accessible by the net are inside a folder called htdocs.  so if you go to www.mysite.com/index.htm index is located in htdocs.  How would i make a link to something under htdocs?  say i have a folder 'other' and a folder 'htdocs' where htdocs is the accessible folder?

 

 

Link to comment
https://forums.phpfreaks.com/topic/74170-protecting-pages/#findComment-374881
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.