Jump to content

php redirect issue

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
10 replies to this topic

#1
gotdmw

gotdmw

    Newbie

  • Members
  • Pip
  • 6 posts
below is a Full page Iframe to display the offer URL and prevent bots from following the link to the final destination URL

the problem is it directs to r-decode.php which is a code that masks the url somehow, and is striping my tracking.

why is it killing my tracking?

how could i just bypass r-decode.php and go to another file?

if one of u scholars can tell me how to do this be much appreciated.

<?php

$offerURL = "http://www.hostgatorxcom/";//put your offer's affiliate jump link here


$offerURL = trim($offerURL);//do not edit this line

$thisRedirectUrl = base64_encode($offerURL);//do not edit this line

$thisRedirectUrl = "r-decode.php?{$thisRedirectUrl}";//do not edit this line

?>

Edited by James.H, 07 March 2010 - 05:42 AM.


#2
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
Everything depends on how r-decode is built up, and how $thisRedirectUrl is used in your code.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#3
Guest_Jaan_*

Guest_Jaan_*
  • Guests
Yea, can you show us that r-decode.php file ?

#4
gotdmw

gotdmw

    Newbie

  • Members
  • Pip
  • 6 posts
thx for replies

this is the bottom of the php code, so i guess this is what $thisRedirectUrl is used for

?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
  <title>Edit Me</title>
<META name="description" content="">
<META name="keywords" content="">
</head>
<frameset rows="100%,*" border="0">
  <frame src="<? echo $thisRedirectUrl; ?>" frameborder="0" />
  <frame src="UntitledFrame-2" frameborder="0" noresize />

  <noframes>
    Put content here...
    
  </noframes>

</frameset>

</html>

and here is the r-decode.php

<?php
// Note: there's no need to modify this file. Just upload it to your server along with the iframe file.
// this file redirects the user to your link while hiding the refer information from the destination URL


$thisReferringUrl = @$_SERVER["HTTP_REFERER"];//use default in case the requested url is invalid
$clientIPNumber = @$_SERVER["REMOTE_ADDR"];
$clitentBrowserUserAgent = @$_SERVER["HTTP_USER_AGENT"];

if (empty($clitentBrowserUserAgent)){
    //no useragent means it's a bot
    header("HTTP/1.0 301 Permanent Redirect");
    header("Location: http://127.0.0.1",true,301);
    exit;
}

$topMargin = rand(10,111);
$thisRedirectUrl = null;


$imagePropertiesArr = array();
if (!empty($imagesArr)){
    $rand_key = array_rand($imagesArr, 1);
    $imageProperties = $imagesArr[$rand_key];
    $imagePropertiesArr = explode("|",$imageProperties);
}

$url_encoded = @$_SERVER["QUERY_STRING"];
if (!empty($url_encoded)){
    $url_encoded = trim($url_encoded);
    $url_decoded = base64_decode($url_encoded);
    if (checkValidURL($url_decoded)){
        $thisRedirectUrl = $url_decoded;
    }
}


function checkValidURL($siteurl){
	$siteurl = trim($siteurl);
	$siteurlVal = $siteurl;
	$siteurlVal = ereg_replace("[^a-zA-Z0-9?:=,;@#$|&+%\/._-]", "", $siteurlVal);//strip out invalid chars
	if ($siteurl != $siteurlVal) return  false;
	if(ereg("^http://.+\\..+$", $siteurl) || ereg("^https://.+\\..+$", $siteurl))
		return true;
	else
		return false;
}

if (empty($thisRedirectUrl)){

    header("HTTP/1.1 404");
    header("Location: 404");
    exit;
}





//echo $thisRedirectUrl;
//exit;


//header("Expires: " . gmdate("D, d M Y H:i:s") . " GMT");
//header("Pragma: no-cache");
//header("HTTP/1.0 301 Permanent Redirect");
?><html>
<head>
<meta name="robots" content="noindex,nofollow">
<meta http-equiv="refresh" content="0;url=<? echo $thisRedirectUrl; ?>" />
</head>
<body>
<script language="JavaScript" type="text/javascript">
function go(){
	document.location.href="<? echo $thisRedirectUrl; ?>";
}
setTimeout ('go()', 1);
</script>
</body>
</html>

Edited by Orjan, 07 March 2010 - 12:34 PM.
Please use code tags!


#5
gotdmw

gotdmw

    Newbie

  • Members
  • Pip
  • 6 posts
can i take the out r-decode somehow?

is there a way to do this but not blank to referrer everything comes up blank in tracking?

#6
gotdmw

gotdmw

    Newbie

  • Members
  • Pip
  • 6 posts
well i got the tracking to work,

but this code is blanking the refferrer, which i do not want it to do.

does anybody know how to cure this?

thx

#7
Guest_Jaan_*

Guest_Jaan_*
  • Guests
 <?php 
$offerURL = "http://www.hostgatorxcom/";//put your offer's affiliate jump link here 

$offerURL = trim($offerURL);//do not edit this line 
$thisRedirectUrl = base64_encode($offerURL);//do not edit this line 
$thisRedirectUrl = "r-decode.php?{$thisRedirectUrl}";//do not edit this line 
?>  

This
$thisRedirectUrl = "r-decode.php?{$thisRedirectUrl}";//do not edit this line 

Is gonna be something like this:

Quote


?

If you want it to work like this then http://www.hostgatorxcom must be defined in your code..
so..

if($_GET['http://www.hostgatorxcom']){

// do somethign

}

I guess it's missing something like ?url=

And your redirect address would be:

Quote

r-decode.php?url=http://www.hostgatorxcom/

Then it should be like this in your file:
if($_GET['url'] == "http://www.hostgatorxcom/"){

// do something

}

Or something like that..

#8
gotdmw

gotdmw

    Newbie

  • Members
  • Pip
  • 6 posts
how can i keep the i frame but lose the r-decode, just shoot it to another domain?

or do i have to have that?

#9
Guest_Jaan_*

Guest_Jaan_*
  • Guests
I guess you have to build a new file for it or.. just yea redirect them directly to another site..

#10
gotdmw

gotdmw

    Newbie

  • Members
  • Pip
  • 6 posts
yeah i would just want to hit the iframe page then redirect from that page to another url.

does this look like it would work?

#11
Guest_Jaan_*

Guest_Jaan_*
  • Guests
Don't use frames.. they are not nice