bazz
02-21-2005, 07:30 PM
Hi,
I run a script which can be called by any (Qualified list), website. SO when you access the script from a page in their site the HTTP_REFERER should work fine. I should add, that this script outputs an html page where the variables have been called from a flat file db.
However.....As my script loads, it calls on a .pm file so that the script loads a header and footer to make the script output match the calling site.
What I see is that the outputted script shows tha referer to be my site, when I want to be able to read the domainname.com from the incoming site.
Progress in thought even, is difficult as I am losing track the steps my coding needs to take.
Thinking so far....(It is a question itself);
My script should call the HTTP_REFERER from the incoming site?
Then it should pass it to the .pm file in a hidden input so that it knows that it is the external site and not miine, that is calling the script.
Then the .pm file can run as coded to provide the appropriate header and footer to integrate the outputted html with that external sitres appearance.
But, surely I can't write to a .pm file; surely it is simply called as is? So how then can I get information to it (such as http_referer) so that it can work out which page has called it?
Here's the .pm file - It works in as much as the defalt header will load. That's because I haven't yet worked out how to tell it what it needs to know.
package includes;
# Header & footer module, includes.pm:
sub new(){
my $self=shift;
my %sites=(
'www.yourdomain.com'=>['../../../headers_and_footers/default/header.html','../../../headers_and_footers/default/footer.html'],
'www.anotherdomain.co.uk'=>['../../../headers_and_footers/chris/header.html','../../../headers_and_footers/chris/footer.html']
);
my @files=((exists $sites{$ENV{'REMOTE_HOST'}})?(@{$sites{$ENV{'REMOTE_HOST'}}}):('../../../headers_and_footers/default/header.html','../../../headers_and_footers/default/footer.html'));
bless \@files,$self;
}
sub header(){
return showfile($_[0]->[0]);
}
sub footer(){
return showfile($_[0]->[1]);
}
sub showfile{
local $/;
open(my $file,$_[0]) or die 'Can\'t open '.$!;
my $content=<$file>;
close($file);
return $content;
}
1;
BTW, I have tried different ENV variables with not the correct success.
REMOTE_HOST
SERVERNAME
HTTP_REFERER
I would rather not use cookies for just one reason. I haven't had time to try them and I need this done sort of, well, today (if possible). :rolleyes:
Bazz
I run a script which can be called by any (Qualified list), website. SO when you access the script from a page in their site the HTTP_REFERER should work fine. I should add, that this script outputs an html page where the variables have been called from a flat file db.
However.....As my script loads, it calls on a .pm file so that the script loads a header and footer to make the script output match the calling site.
What I see is that the outputted script shows tha referer to be my site, when I want to be able to read the domainname.com from the incoming site.
Progress in thought even, is difficult as I am losing track the steps my coding needs to take.
Thinking so far....(It is a question itself);
My script should call the HTTP_REFERER from the incoming site?
Then it should pass it to the .pm file in a hidden input so that it knows that it is the external site and not miine, that is calling the script.
Then the .pm file can run as coded to provide the appropriate header and footer to integrate the outputted html with that external sitres appearance.
But, surely I can't write to a .pm file; surely it is simply called as is? So how then can I get information to it (such as http_referer) so that it can work out which page has called it?
Here's the .pm file - It works in as much as the defalt header will load. That's because I haven't yet worked out how to tell it what it needs to know.
package includes;
# Header & footer module, includes.pm:
sub new(){
my $self=shift;
my %sites=(
'www.yourdomain.com'=>['../../../headers_and_footers/default/header.html','../../../headers_and_footers/default/footer.html'],
'www.anotherdomain.co.uk'=>['../../../headers_and_footers/chris/header.html','../../../headers_and_footers/chris/footer.html']
);
my @files=((exists $sites{$ENV{'REMOTE_HOST'}})?(@{$sites{$ENV{'REMOTE_HOST'}}}):('../../../headers_and_footers/default/header.html','../../../headers_and_footers/default/footer.html'));
bless \@files,$self;
}
sub header(){
return showfile($_[0]->[0]);
}
sub footer(){
return showfile($_[0]->[1]);
}
sub showfile{
local $/;
open(my $file,$_[0]) or die 'Can\'t open '.$!;
my $content=<$file>;
close($file);
return $content;
}
1;
BTW, I have tried different ENV variables with not the correct success.
REMOTE_HOST
SERVERNAME
HTTP_REFERER
I would rather not use cookies for just one reason. I haven't had time to try them and I need this done sort of, well, today (if possible). :rolleyes:
Bazz