Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 278
  • Last Modified:

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
0
aplelois
Asked:
aplelois
  • 6
  • 6
1 Solution
 
jkrCommented:
That should just be

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

   printf("Location:%s\n\n", getenv("HTTP_REFERRER"));
   exit(0);
}
0
 
apleloisAuthor Commented:
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 ?
0
 
jkrCommented:
Sorry, maybe I'm missing something - which is the part you want to actually see?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
apleloisAuthor Commented:
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!
0
 
jkrCommented:
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)
0
 
apleloisAuthor Commented:
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.
0
 
jkrCommented:
That is the output of the 'printf()' statement?
0
 
apleloisAuthor Commented:
yes
Location:(null)
0
 
jkrCommented:
Aaah, now I see what you mean. In this case, try

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

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

   printf("Location:%s\n\n", getenv("SCRIPT_NAME"));
0
 
apleloisAuthor Commented:
same thing

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

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

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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 6
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now