referral

hello,
I have this in domain1.com

>goto.php
<?php
header("Location: " . $_GET['link']);
die();
?>

when I type this in IE
http://domain1.com/out.php?link=http://domain2.com
it goes to domain2.com

and when I check logs to see who has referred in domain2.com
the domain domain1.com doesnt show up!

do you guys know why is that?
apleloisAsked:
Who is Participating?
 
dr_dedoConnect With a Mentor Commented:
why doint u add the orignal page as a query string to the second page ! e.g.
<HTML><HEAD>
<?
echo "<META HTTP-EQUIV=\"Refresh\"
      CONTENT=\"5; URL=http://domain2.com?ref=http://domain1.com\">";
?>
</HEAD><BODY>We have moved<br>Your being regirected to http://domain2.com or click <a href="http://domain2.com">here</a>
</BODY></HTML>

then in domain2,

$referr = (isset($_GET['ref']) && $_GET['ref']=='http://domain1.com') ? $_GET['ref'] : $HTTP_REFERER ;
0
 
aib_42Commented:
It's most likely a browser issue. Try different methods of redirecting: Say, a META refresh?
0
 
apleloisAuthor Commented:
yeah, that will be nice! how can I do that?
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
TeRReFCommented:
You can only retrieve the referral when a user actually clicks a link. A META refresh might work as well, I.m not sure though... Anyway, this is how you do it:
// $rate: number of seconds until refresh
$rate = "20";
// $url: URL to refresh to
$url = "http://domain2.com";
header("Refresh: $rate; URL=$url");
0
 
dr_dedoCommented:
u can use that, telling the user he/she is being redirected
<HTML><HEAD>
<?
echo "<META HTTP-EQUIV=\"Refresh\"
      CONTENT=\"5; URL=http://domain2.com\">";
?>
</HEAD><BODY>We have moved<br>Your being regirected to http://domain2.com or click <a href="http://domain2.com">here</a>
</BODY></HTML>
0
 
apleloisAuthor Commented:
I tried both ways and none of the following codes leave the referral url.
0
 
apleloisAuthor Commented:
dr_dedo If I click on the link it works, but I dont want the click..
0
 
neesterConnect With a Mentor Commented:
Yeah you MUST have a click - otherwise you would have to forge the HTTP header.

Check this out:

http://www.nyphp.org/phundamentals/spoofed_submission.php

Haven't read it all - but looks on track!
0
 
TeRReFCommented:
You could fake it with a JS click event...
0
 
neesterCommented:
All these Javascript and Meta tag solutions are flawed because they mean you have to assume a browser will pass the referral on.
Some firewalls block referral information!

It is always best if you can override anything yourself - if you are relying on that information.
Cut your losses.
0
 
TeRReFCommented:
Well, another solution (if you use apache) is to add a RewriteCond rule in .htaccess.
http://phpnuke.org/modules.php?name=PHP-Nuke_HOWTO&page=make-php-nuke-hot-link-stealth.html
0
 
neesterCommented:
Terref.
That wouldn't leave a referer footprint without a click either.
He may aswell bypass his PHP script if you do that :)
0
 
apleloisAuthor Commented:
ok, does someone know the click in JS?
0
 
neesterCommented:
You cannot make Javascript "fake" a click.

As far as I know...
Sorry mate.
0
 
dr_dedoCommented:
send domain2 something to know this hit came from domain1, why don't u use a query string or something!!
0
 
aib_42Commented:
How about a JavaScript redirect?

window.location='http://domain2.com/';
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.