optikalefx Posted October 21, 2007 Share Posted October 21, 2007 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! Quote Link to comment https://forums.phpfreaks.com/topic/74170-protecting-pages/ Share on other sites More sharing options...
derwert Posted October 21, 2007 Share Posted October 21, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/74170-protecting-pages/#findComment-374578 Share on other sites More sharing options...
optikalefx Posted October 21, 2007 Author Share Posted October 21, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/74170-protecting-pages/#findComment-374881 Share on other sites More sharing options...
trq Posted October 21, 2007 Share Posted October 21, 2007 ../other/file.xml Quote Link to comment https://forums.phpfreaks.com/topic/74170-protecting-pages/#findComment-374882 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.