?
Solved

referral

Posted on 2006-06-04
18
Medium Priority
?
1,468 Views
Last Modified: 2012-05-07
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?
0
Comment
Question by:aplelois
  • 4
  • 4
  • 3
  • +2
16 Comments
 
LVL 7

Expert Comment

by:aib_42
ID: 16829959
It's most likely a browser issue. Try different methods of redirecting: Say, a META refresh?
0
 

Author Comment

by:aplelois
ID: 16830200
yeah, that will be nice! how can I do that?
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 16831467
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 16

Expert Comment

by:dr_dedo
ID: 16831729
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
 

Author Comment

by:aplelois
ID: 16832571
I tried both ways and none of the following codes leave the referral url.
0
 

Author Comment

by:aplelois
ID: 16832580
dr_dedo If I click on the link it works, but I dont want the click..
0
 
LVL 16

Accepted Solution

by:
dr_dedo earned 1000 total points
ID: 16832717
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
 
LVL 11

Assisted Solution

by:neester
neester earned 1000 total points
ID: 16832725
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
 
LVL 29

Expert Comment

by:TeRReF
ID: 16832891
You could fake it with a JS click event...
0
 
LVL 11

Expert Comment

by:neester
ID: 16832915
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
 
LVL 29

Expert Comment

by:TeRReF
ID: 16833462
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
 
LVL 11

Expert Comment

by:neester
ID: 16833611
Terref.
That wouldn't leave a referer footprint without a click either.
He may aswell bypass his PHP script if you do that :)
0
 

Author Comment

by:aplelois
ID: 16836600
ok, does someone know the click in JS?
0
 
LVL 11

Expert Comment

by:neester
ID: 16836750
You cannot make Javascript "fake" a click.

As far as I know...
Sorry mate.
0
 
LVL 16

Expert Comment

by:dr_dedo
ID: 16837333
send domain2 something to know this hit came from domain1, why don't u use a query string or something!!
0
 
LVL 7

Expert Comment

by:aib_42
ID: 16837340
How about a JavaScript redirect?

window.location='http://domain2.com/';
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month15 days, 3 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question