greekuser Posted January 23, 2008 Share Posted January 23, 2008 hello, i have a little problem with one eshop i have made and credit card payments are send to a bank secure site. everything works ok, but the bank asked me for a validation.php file to be on the eshop that sends an ok in order to complete the payment. what i want to do is to limit the access to that php file so that it can be accessed only by direct request and only from the bank site url i dont want to be accessed by anyone else. the reason is that the validation.php makes a query that i dont want the result (even if it is a simple ok) to be known to anyone else but the bank can this be done within php or with a .htaccess modification ??? Quote Link to comment https://forums.phpfreaks.com/topic/87376-php-file-accessible-only-from-specific-destination/ Share on other sites More sharing options...
revraz Posted January 23, 2008 Share Posted January 23, 2008 You can use their IP, their domain or a login type of system. Quote Link to comment https://forums.phpfreaks.com/topic/87376-php-file-accessible-only-from-specific-destination/#findComment-446946 Share on other sites More sharing options...
greekuser Posted January 23, 2008 Author Share Posted January 23, 2008 and how exactly can i put it in php can you please help me with the writting or if the is there a tutorial i can read Quote Link to comment https://forums.phpfreaks.com/topic/87376-php-file-accessible-only-from-specific-destination/#findComment-446966 Share on other sites More sharing options...
greekuser Posted January 23, 2008 Author Share Posted January 23, 2008 i could use a litle help with the syntax Quote Link to comment https://forums.phpfreaks.com/topic/87376-php-file-accessible-only-from-specific-destination/#findComment-446999 Share on other sites More sharing options...
adam291086 Posted January 23, 2008 Share Posted January 23, 2008 you will need something like $hostname = $_SERVER['REMOTE_ADDR']; echo $hostname Quote Link to comment https://forums.phpfreaks.com/topic/87376-php-file-accessible-only-from-specific-destination/#findComment-447005 Share on other sites More sharing options...
adam291086 Posted January 23, 2008 Share Posted January 23, 2008 ok i got bord, try something like this. $hostname = $_SERVER['REMOTE_ADDR']; if($hostname =="192.168.2.1") { //do the validation stuff } else { echo "You don't have access to this file"; } Quote Link to comment https://forums.phpfreaks.com/topic/87376-php-file-accessible-only-from-specific-destination/#findComment-447020 Share on other sites More sharing options...
greekuser Posted January 23, 2008 Author Share Posted January 23, 2008 thanks adam291086 but one last thing if i want to use their domain instead i just replace the IP right? Quote Link to comment https://forums.phpfreaks.com/topic/87376-php-file-accessible-only-from-specific-destination/#findComment-447030 Share on other sites More sharing options...
adam291086 Posted January 23, 2008 Share Posted January 23, 2008 if you want domain look at http://uk3.php.net/manual/en/function.gethostbyaddr.php Quote Link to comment https://forums.phpfreaks.com/topic/87376-php-file-accessible-only-from-specific-destination/#findComment-447034 Share on other sites More sharing options...
revraz Posted January 23, 2008 Share Posted January 23, 2008 You would want to use REFERER instead Quote Link to comment https://forums.phpfreaks.com/topic/87376-php-file-accessible-only-from-specific-destination/#findComment-447039 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.