Jump to content

[SOLVED] faking referer - without using meta refresh


Recommended Posts

Hi everyone, i am a php newbie, but i was wondering if its any way possible to make a fake referrer on a link without using meta refresh.

i read somewhere something about curl, but i have no idea what that even is.

 

for example I put a link on site A which goes THROUGH my website (Site B) and comes out to Site C. I'd like site C to see My site (Site B) as the referer.

i think i tried everything under the sun, javascripts, http meta refreshes.. is anything possible? even with some crazy server side things? im willing to pay if this needs some crazy coding.

 

thanks a lot!

well the link is on site A. when someone clicks it, it goes to my site's (B's) php file that has that "header...etc" code and redirects to site C.

 

site C sees site A as the referrer instead of my site, even though it just went through my site.

i think i misunderstood the problem. the user is linked from site A to your site B, then forwarded to site C, however site C shows the referrer as site A instead of your site. but you want site C to see the referrer as your site B. is that correct?

very easy to do

 

Link to "Site C" goes to your site "Site B"

<a href="siteB.php?page=http://www.siteC.com">

page on your site "Site B"

SiteB.php

<?php
if(is_file($_GET['page'])){$page = $_GET['page'];}
else{$page = "DEFAULT.php";}
header("Location: ".$page);
?>

SiteC will think it came from Site B

Hi, thanks,

i am trying it out, but it goes to default.php

 

Here is a test link

 

http://www.ggstfu.com/test.php?page=http://www.my-i-p.com

 

it goe through www.ggstfu.com/test.php inside which i copied your code and should go out to www.my-i-p.com because my-i-p shows referer data.

 

I was trying to think of a fast way to verify the document requested is a valid doc
try
[code
<?php
$filename = "$_GET['page'];
if(fopen($filename, "r")){
$page = $_GET['page'];
}
else{$page = "DEFAULT.php";}
header("Location: ".$page);
?>

wud be nice if u had a page verification system.

but i wud set it within yer script as an array of valid pages instead of fetching the page from the site.

 

 

That is the better idea, and then u can pass integers vs full text

i.e

The link

siteB.php?page=1

SiteB.php

<?php
$pages = array("http://www.yahoo.com","http://www.google.com","http://www.phpfreaks.com");
if(intval($_GET['page']) < count($pages) && $pages >= 0){
$page = $pages[$_GET['pages']];
}
else{
$page = $pages[0]; 
#Default to 0 case
}
header("location: ".$page);
?>

it should work or its error somewhere and u are suppressing errors try this though

<?php
$pages = array("http://www.yahoo.com","http://www.google.com","http://www.phpfreaks.com");
if(intval($_GET['page']) < count($pages) && $pages >= 0){
$page = $pages[$_GET['pages']];
}
else{
$page = $pages[0]; 
#Default to 0 case
}
die(header("location: ".$page));
?>

I'm trying to play around with it, the issue is that the refer only comes when a "link" is clicked so somehow you gotta fake that.

I tried

<?php
session_start();
if(empty($_SESSION['refresh'])){
$_SESSION['refresh'] = 1;
echo "<html><head><meta http-equiv=\"refresh\" content=\"5\" /></head><body><h1>1 second...</h1></body></html>";
}
else{
$pages = array("http://my-i-p.com/","http://www.google.com","http://www.phpfreaks.com");
$page = $pages[$_GET['page']];
if(empty($page)){
	$page = $pages[0];
}
$_SESSION['refresh'] = "";
header("location: $page");
}
?>	

so the page actually "hits" and then reloads, but no good the header comes in unknown or the followed link

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.