Link to home
Start Free TrialLog in
Avatar of aplelois
aplelois

asked on

referral

hello,
I have this code that when you type this
http://musicsite.com/cgi-bin/goto.cgi?http://google.com
http://musicsite.com/cgi-bin/goto.cgi?http://yahoo.com
it goes to the URL after the .cgi?
when I check the logs from urchin and see
all referrals, all (the domains) that have linked to
my site.. but I dont see the one from musicsite.com
is there anyway to leave that info?
like if I clicked on the link to go to musicsite.com
this is my code


#include <stdio.h>
int main()
{

   printf("Location:%s\n\n", getenv("QUERY_STRING"));
   exit(0);
}

if you dont understand what I mean please ask.
thanks
Avatar of jkr
jkr
Flag of Germany image

That should just be

#include <stdio.h>
int main()
{

   printf("Location:%s\n\n", getenv("HTTP_REFERRER"));
   exit(0);
}
Avatar of aplelois
aplelois

ASKER

HTTP_REFERRE has to be --> http://musicsite.com/cgi-bin/goto.cgi <--
so when I type 5 times this http://musicsite.com/cgi-bin/goto.cgi?http://yahoo.com
on IE then I go to referall I see 5 from goto.cgi
is that possible ?
Sorry, maybe I'm missing something - which is the part you want to actually see?
ok
domain.com/goto.html
has this in it
<a href="/cgi-bin/goto.cgi?http://google.com">Google</a>
<a href="/cgi-bin/goto.cgi?http://mymusicsite.com">My Music Site</a>

so If I click on the (my music site) link it will go to http://mymusicsite.com
yeah, it working but when I check logs it says is coming from --> domain.com/goto.html
and I want to see coming from domain.com/cgi-bin/goto.cgi instead!
And what is it that you get from

   printf("Location:%s\n\n", getenv("HTTP_REFERRER"));

(sorry, but can't test it because I am lacking a HTTP server at the moment)
I type on IE http://musicsite.com/cgi-bin/goto.cgi?http://yahoo.com

Not Found

The requested URL /cgi-bin/(null) was not found on this server.
That is the output of the 'printf()' statement?
yes
Location:(null)
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
same thing

Not Found
The requested URL /cgi-bin/(null) was not found on this server.
Then it seems that the CGI script isn't there where it is supposed to be...
how come this is working fine?

#include <stdio.h>
int main()
{

   printf("Location:%s\n\n", getenv("QUERY_STRING"));
   exit(0);
}