DylanD Posted November 2, 2007 Share Posted November 2, 2007 I have a bunch of php scripts that get information from a database then mark it up in XML. I want to prevent random people from running these pages and being able to look at the XML. How do you accomplish this while still allowing my flex app to see them? Thanks in advance Dylan Link to comment https://forums.phpfreaks.com/topic/75832-stop-people-from-viewing-php-files/ Share on other sites More sharing options...
phpSensei Posted November 2, 2007 Share Posted November 2, 2007 <?php if($_SERVER['REMOTE_ADDR'] != "USER"){ die(); } else { //echo } ?> Link to comment https://forums.phpfreaks.com/topic/75832-stop-people-from-viewing-php-files/#findComment-383803 Share on other sites More sharing options...
marcus Posted November 2, 2007 Share Posted November 2, 2007 Password protect the folder. His IP can change. Link to comment https://forums.phpfreaks.com/topic/75832-stop-people-from-viewing-php-files/#findComment-383806 Share on other sites More sharing options...
phpSensei Posted November 2, 2007 Share Posted November 2, 2007 True, just CHMOD it to whatever you want. http://catcode.com/teachmod/ http://en.wikipedia.org/wiki/Chmod Link to comment https://forums.phpfreaks.com/topic/75832-stop-people-from-viewing-php-files/#findComment-383808 Share on other sites More sharing options...
burtybob Posted November 2, 2007 Share Posted November 2, 2007 What about a basic form and code eg. if($_REQUEST[pass]!=USERSCHOSENPW && $_REQUEST[user]!=USERSCHOSENUSER){ die(); } else { //echo } ?> <html> <form action="" method=post> <input type=password name=pass> <input type=text name=user> <form> BTW i did leave the textbox without any labels any purpose as it increses security a pinch as a person wont know which is which although i wouldnt recomend that on a client side login. Link to comment https://forums.phpfreaks.com/topic/75832-stop-people-from-viewing-php-files/#findComment-383892 Share on other sites More sharing options...
cooldude832 Posted November 2, 2007 Share Posted November 2, 2007 if you only need the data from a database, just make it be on demand and password protect the page some how Link to comment https://forums.phpfreaks.com/topic/75832-stop-people-from-viewing-php-files/#findComment-383896 Share on other sites More sharing options...
otuatail Posted November 2, 2007 Share Posted November 2, 2007 Can't see how anyone can view the PHP part as the server only dishes up the HTML. Link to comment https://forums.phpfreaks.com/topic/75832-stop-people-from-viewing-php-files/#findComment-383897 Share on other sites More sharing options...
revraz Posted November 2, 2007 Share Posted November 2, 2007 "I want to prevent random people from running these pages and being able to look at the XML." He didnt say anything about viewing code. Link to comment https://forums.phpfreaks.com/topic/75832-stop-people-from-viewing-php-files/#findComment-383920 Share on other sites More sharing options...
thebadbad Posted November 3, 2007 Share Posted November 3, 2007 Just stick those files one directory UP from the domain-root. http://www.phpfreaks.com/forums/index.php/topic,165195.0.html Link to comment https://forums.phpfreaks.com/topic/75832-stop-people-from-viewing-php-files/#findComment-383964 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.