I can't seem to get the ENV variable HTTP_REFERER when posting with CGI from one program to another. In my post program I have put in the <HEAD>
- ie www.xyz.com (I have also tried removing it entirely in case that was causing problems.
I have tried to extract the HTTP_REFERER in my receiving program with - $http_ref = $ENV{'HTTP_REFERER'};
That didn't work so I just printed all variables with - foreach $key (sort keys(%ENV)) {
-
print "$key = $ENV{$key}<p>"; }
What I get printed is (and I'll just copy the few before and after where I might have expected to see it:
HTTP_KEEP_ALIVE = 300
HTTP_USER_AGENT = Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
HTTP________ = -------------------------------------------------------------------------------------
HTTP___________ _____ = ------------
PATH = /usr/local/bin:/usr/bin:/bin
There was no HTTP_REFERER listed.
Thanks for any help I can get on this.
6 5354 numberwhun 3,509
Recognized Expert Moderator Specialist
I can't seem to get the ENV variable HTTP_REFERER when posting with CGI from one program to another. In my post program I have put in the <HEAD>
- ie www.xyz.com (I have also tried removing it entirely in case that was causing problems.
I have tried to extract the HTTP_REFERER in my receiving program with - $http_ref = $ENV{'HTTP_REFERER'};
That didn't work so I just printed all variables with - foreach $key (sort keys(%ENV)) {
-
print "$key = $ENV{$key}<p>"; }
What I get printed is (and I'll just copy the few before and after where I might have expected to see it:
HTTP_KEEP_ALIVE = 300
HTTP_USER_AGENT = Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
HTTP________ = -------------------------------------------------------------------------------------
HTTP___________ _____ = ------------
PATH = /usr/local/bin:/usr/bin:/bin
There was no HTTP_REFERER listed.
Thanks for any help I can get on this.
Well, the HTTP_REFERER variable would be set to the page that contained the link that got you to this page. If its not set, then I have to ask, did you load the page directly?
Jeff
Well, the HTTP_REFERER variable would be set to the page that contained the link that got you to this page. If its not set, then I have to ask, did you load the page directly?
Jeff
I loaded the page through a perl program - here is the start of the html it creates as well as the <form> post section -
<HTML>
-
<HEAD>
-
<TITLE>ECOC Registration - OOC</TITLE>
-
here I have had <HTTP_REFERER
-
<style type="text/css"> some style stuff
-
</style>
-
-
</HEAD>
-
<BODY>
-
<form target='_self' action='http://www.ottawaoc.ca/scgi-bin/COC_confirm.pl' method='post'>
-
<input type='hidden' name='item_number' value='71'>
-
<input type='image' src='http://www.ottawaoc.ca/images/marker.gif'
-
border='0' name='submit' alt='Pay for all by cheque'>
-
<input type='hidden' name='lname' value=Forbes>
-
<input type='hidden' name='fname' value=Mary>
-
</form>
-
Does that help?
I loaded the page through a perl program - here is the start of the html it creates as well as the <form> post section -
<HTML>
-
<HEAD>
-
<TITLE>ECOC Registration - OOC</TITLE>
-
here I have had <HTTP_REFERER="www.ottawaoc.ca">
-
<style type="text/css"> some style stuff
-
</style>
-
-
</HEAD>
-
<BODY>
-
<form target='_self' action='http://www.ottawaoc.ca/scgi-bin/COC_confirm.pl' method='post'>
-
<input type='hidden' name='item_number' value='71'>
-
<input type='image' src='http://www.ottawaoc.ca/images/marker.gif'
-
border='0' name='submit' alt='Pay for all by cheque'>
-
<input type='hidden' name='lname' value=Forbes>
-
<input type='hidden' name='fname' value=Mary>
-
</form>
-
Does that help?
Sorry - forgot to get in the assignment statement that I have also tried in the <HEAD>
<HTTP_REFERER=" www.ottawaoc.ca ">
I loaded the page through a perl program - here is the start of the html it creates as well as the <form> post section -
<HTML>
-
<HEAD>
-
<TITLE>ECOC Registration - OOC</TITLE>
-
here I have had <HTTP_REFERER="www.ottawaoc.ca">
-
<style type="text/css"> some style stuff
-
</style>
-
-
</HEAD>
-
<BODY>
-
<form target='_self' action='http://www.ottawaoc.ca/scgi-bin/COC_confirm.pl' method='post'>
-
<input type='hidden' name='item_number' value='71'>
-
<input type='image' src='http://www.ottawaoc.ca/images/marker.gif'
-
border='0' name='submit' alt='Pay for all by cheque'>
-
<input type='hidden' name='lname' value=Forbes>
-
<input type='hidden' name='fname' value=Mary>
-
</form>
-
Does that help?
Sorry - forgot to get in the assignment statement that I have also tried in the <HEAD>
<HTTP_REFERER=" www.ottawaoc.ca ">
If you want to look at the code online, go to ottawaoca.ca/scgi-bin/COC_2008.pl
put in a name and a phone or email, click 'Enter indiv runners,' then 'enter participants', then put in a yob, then click on 'submit this entry' and finally on the red and white icon. The code behind the red and white icon is what posts info to the final program. (I guess I could post this same information - that should work) Sorry there are so many steps but the editing requires some basic info.
numberwhun 3,509
Recognized Expert Moderator Specialist
Sorry - forgot to get in the assignment statement that I have also tried in the <HEAD>
<HTTP_REFERER=" www.ottawaoc.ca ">
That I know of, that is not going to work. You cannot just put that in your HTML and expect it to work. "<HTTM_REFE RER> is not an HTML element. In fact, I doubt that page would pass any validation with that in there. Here is a link that will explain to you exactly what HTTP_REFERER is. You should read it. It is an environment variable that gets set, telling you where you just came from. In other words, if I click a link to google.com from my own web page, then clicking on the google.com link will automatically set my web page, where I just came from, as the HTTP_REFERER. Does that clear it up?
You say you called the HTML page from a Perl script. Are you saying that you generated it with a Perl script using CGI? Just curious.
Ok, here is an example that will hopefully show you. Go to this page. Now, take note of what the URL is. Now go to the bottom of the page and click on the link for "Main". The information you are being shown in the grey box is the header information. Look at the line that says "Referer". If you remember, that is the page you were just at, where you clicked the link to come here. Hope that really clears that up.
Regards,
Jeff
That I know of, that is not going to work. You cannot just put that in your HTML and expect it to work. "<HTTM_REFE RER> is not an HTML element. In fact, I doubt that page would pass any validation with that in there. Here is a link that will explain to you exactly what HTTP_REFERER is. You should read it. It is an environment variable that gets set, telling you where you just came from. In other words, if I click a link to google.com from my own web page, then clicking on the google.com link will automatically set my web page, where I just came from, as the HTTP_REFERER. Does that clear it up?
You say you called the HTML page from a Perl script. Are you saying that you generated it with a Perl script using CGI? Just curious.
Ok, here is an example that will hopefully show you. Go to this page. Now, take note of what the URL is. Now go to the bottom of the page and click on the link for "Main". The information you are being shown in the grey box is the header information. Look at the line that says "Referer". If you remember, that is the page you were just at, where you clicked the link to come here. Hope that really clears that up.
Regards,
Jeff
Thanks Jeff
No I am not any the wiser - I had read all of that - through other sources. The insert of HTTP_REFERER into the HEAD was just another attempt to make it work - you have confirmed what I thought - that the variable is set (or not set) by the method of getting there - not by a specific setting in the calling program.
Yes I generated it with a Perl script using CGI? and a post rather than a get.
In any case, due to another snag I hit, I have changed my program flow considerably and will not be using one program from 2 different places any longer so do not need this (although I am still curious for future reference)
Many thanks.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jez |
last post by:
Any ideas why I'm not able to use $_SERVER on my
shared hosting account (PHP 4.1.2), but I can on my local server (PHP
4.3.3)?
I imagine it has something to do with the different versions of PHP or
perhaps php.ini, but I'm not sure what?
Thanks!
Jez
|
by: deko |
last post by:
I have a page that I don't want anyone to be able to link directly to. The
page should only be accessed from gatepage.php. I tried this code, but keep
getting errors - "header info already sent", or something like that... Am I
missing something, or is there a better way to do this?
<?php
$ref = $_SERVER;
//echo $ref;
if ( $ref == 'http://www.mydomain.com/gatepage.php' )
{
|
by: ssk |
last post by:
Hello!
I made a web site using PHP Open sources for message board.
Everything's fine except one computer can't open a message writing
page.
The code that gives an error is the following.
if(!eregi($HTTP_HOST,$HTTP_REFERER)) Error("Write in the normal way");
|
by: Robert Mark Bram |
last post by:
Hi All!
I have the following in an ASP script:
var bounceBackPage = Request.ServerVariables("HTTP_REFERER");
Response.Write("<p>bounceBackPage: " +
bounceBackPage + ". Undefined? " +
(bounceBackPage == "undefined") + " </p>");
When I enter the page URL by itself, I expect HTTP_REFERER to be undefined..
|
by: M Smith |
last post by:
On our web site we allow our members access to features hosted by another
web site. The way the other web site authenticates users is to check the
value of the HTTP_REFERER. If it comes from our Login.asp page it lets them
in. When our users login to go to the other site, they login on our site's
Login.asp page. When they click submit, our LoginCheck.asp page validates
them and does a response.redirect to the other site. In most cases...
| |
by: Ringo Langly |
last post by:
Hi everyone,
We're using an outside vendor to provide some content for our website,
and they use the http_referer variable to verify their content is only
viewed from subscribing customers.
Anyway, we're using the mm_menu javascript menu for our web menus, and
under only Internet Explorer it's not passing the http_referer -- which
means any site of theirs we link to from the menu doesn't work. This
works fine in Firefox, Mozilla, and...
|
by: Prabhat |
last post by:
Hello,
I have the below requirement.
When ever my website is opened by any link: say clicked from the google
search result or a link from other website:
Then I should able to know the referrer URL. How Do I get that?
I know about Request.ServerVariables("HTTP_REFERER"). So I used this in
|
by: windandwaves |
last post by:
Hi Folk
I am reading the info below and I am thinking, just how trusted is it.
I have a redirection in place using an .htaccess file. The file it
redirects to is 404.php. Is there a way to find out what the file was that
people entered originally? I was thinking about $_SERVER
but that does not seem to do the trick (it is empty).
Can you help?
|
by: walterbyrd |
last post by:
I like to develop on my desktop, then when I get stuff working, I copy
to my web-site.
I set up a new version Xampp on my windows-2k desktop. And downloaded
the stuff from the website to edit. On the website, everything worked,
on my desktop, nothing works.
I am guessing this has to do with PHP versions. I know PHP breaks
everything whenever they come out with a new version.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |