#! /usr/bin/perl
use LWP::Simple;
my $ReferFrom = "$ENV{'HTTP_REFERER'}";
if ($ReferFrom =~ m/^http:\/\/www\.XXXX\.no\-ip\.info\/index.php/){
<!--#include VIRTUAL="place.cgi" -->
}
else {
print "You have reached here by accident.";
}
print $ReferFrom;
thanks anyone who helps
Last edited by a94060 on Mon Mar 30, 2015 9:08 pm, edited 1 time in total.
oh yea your right,i never did think of that,that will not match with https://XXXX.no-ip.info right? or anything else? If it doesnt(which i think so) then thank you. i just dont know perl well to do all this,i like being in php(even though i know the 2 have common stuff)
There's very little you can do the make sure the request is coming from a valid location. The only thing I've seen even come close is by setting some predictable or known session variable and cross match it with an allowance in a database record.
is there a way that i can make my script send a mandatory header out? Also,i thought that php has the $_SERVER['HTTP_REFERER'] option in it? wouldnt that mean that it gets sent along between scripts even though it is not used?
It's not sent between scripts. The BROWSER sends it, if at all. Since it is an optional header, there are many systems that will remove it well before the server receives a request, and many browsers have settings to disable it as well. Do not under any circumstances rely on it existing or you will create a potentially horrible user experience.