thanks to the community. i have a inhouse script, we are going to make the script in such a way that it want to be open only in firefox and referrer shud be from http://intranet/. any code or direction code is appreciated.
Printable View
thanks to the community. i have a inhouse script, we are going to make the script in such a way that it want to be open only in firefox and referrer shud be from http://intranet/. any code or direction code is appreciated.
Since HTTP referrals can be forged, I do not recommend using that method. Here is the code though:
PHP Code:<?php
if(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST) != 'intranet' || strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') === false){
die;
}
echo 'hello, you\'re one of us (maybe...)';
If you wish to set up an intranet, it is better to enforce this behaviour on the network level, no on the application level. By default, a proper set-up intranet would only allow requests to come from computers on the same intranet...
The reason for this is such -- why if next time you change the http://intranet string (or whatever it is)? You have to change a lot of files.
Sorry for my rambling, but I am just thinking you are solving the problem at the wrong level.
Thanks techietim its working fine :) now need to see how to put this in my login.php :).
Techietim,
instead of die can i redirect to http://intranet ? sorry i am not even close to programmer please ignore my ignorance on this :)
To Crazychop,
already in apache i have done ip level access restriction. this is to ensure that our users are not accessing the site directly.. i mean the script can be directly accessed and every time i change the server or something i need to notify all of them for change of url.
PHP Code:if(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST) != 'intranet' || strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') === false){
header('Location: http://intranet/');
die;
}