Jump to content

[SOLVED] Need Help here GURU! :(


Dwhistler

Recommended Posts

HI....

 

I got problem with this script...

 

<?php

//set this to true to rotate link offer or false to show fake website

$go=false;

 

//fake website

$site='http://www.example.com';

 

$sites=explode("\n",file_get_contents('sites.txt'));

$redirect = $sites[array_rand($sites)];

$aff_link = "$redirect";

 

if($go==true||$_REQUEST['trkid']==12){

if($_REQUEST['trkid']!=12){

echo '<meta http-equiv="refresh" content="0;url=track.php?trkid=12">';

}else{

$referer = $_SERVER['HTTP_REFERER'];

 

if($referer == "" || strpos($referer,$_SERVER['HTTP_HOST'])) {

echo '<meta http-equiv="refresh" content="0;url='.$aff_link.'">';

}else{

echo '<meta http-equiv="refresh" content="0;url='.$site.'">';

}

}

}else{

echo '<meta http-equiv="refresh" content="0;url='.$site.'">';

}

?>

 

basically the script work fine...

but it will double meta refresh the pages that listed in sites.txt

I just need the function of the script to go true or false working and redirect randomly picked site listed in sites.txt

 

please anyone could help?

Thanks!  ???

Link to comment
Share on other sites

Try this:

 

<?php
//set this to true to rotate link offer or false to show fake website
$go = false;

//fake website
$site = 'http://www.example.com';

$sites = explode("\n",file_get_contents('sites.txt'));
$aff_link = $sites[array_rand($sites)];

if (($go === true) || ($_REQUEST['trkid'] == 12))
{
if ($_REQUEST['trkid'] != 12 )
{
	echo '<meta http-equiv="refresh" content="0;url=track.php?trkid=12">';
} else {
	$referer = $_SERVER['HTTP_REFERER'];

	if (($referer == "") || (strpos($referer,$_SERVER['HTTP_HOST'])))
	{
		echo '<meta http-equiv="refresh" content="0;url='.$aff_link.'">';
	} else {
		echo '<meta http-equiv="refresh" content="0;url='.$site.'">';
	}
}
} else {
echo '<meta http-equiv="refresh" content="0;url='.$site.'">';
}
?>

Link to comment
Share on other sites

Using the value of HTTP_REFERER to show different content isn't a great idea. It can be spoofed to get around your checks - indeed using any information which came from the user can be altered. But worse, is doing this means potentially legitimate users will suffer - some firewalls prevent the referer from being send and browsers can be configured not to send it.

Link to comment
Share on other sites

Try this:

 

<?php
//set this to true to rotate link offer or false to show fake website
$go = false;

//fake website
$site = 'http://www.example.com';

$sites = explode("\n",file_get_contents('sites.txt'));
$aff_link = $sites[array_rand($sites)];

if (($go === true) || ($_REQUEST['trkid'] == 12))
{
if ($_REQUEST['trkid'] != 12 )
{
	echo '<meta http-equiv="refresh" content="0;url=track.php?trkid=12">';
} else {
	$referer = $_SERVER['HTTP_REFERER'];

	if (($referer == "") || (strpos($referer,$_SERVER['HTTP_HOST'])))
	{
		echo '<meta http-equiv="refresh" content="0;url='.$aff_link.'">';
	} else {
		echo '<meta http-equiv="refresh" content="0;url='.$site.'">';
	}
}
} else {
echo '<meta http-equiv="refresh" content="0;url='.$site.'">';
}
?>

 

 

Is this code will disable the double meta refresh and show the referrer from the site listed in sites.txt?

 

Thanks!

Link to comment
Share on other sites

Using the value of HTTP_REFERER to show different content isn't a great idea. It can be spoofed to get around your checks - indeed using any information which came from the user can be altered. But worse, is doing this means potentially legitimate users will suffer - some firewalls prevent the referer from being send and browsers can be configured not to send it.

 

 

 

Is there any better way to done this?  ???

Link to comment
Share on other sites

Using the value of HTTP_REFERER to show different content isn't a great idea. It can be spoofed to get around your checks - indeed using any information which came from the user can be altered. But worse, is doing this means potentially legitimate users will suffer - some firewalls prevent the referer from being send and browsers can be configured not to send it.

 

Is there any better way to done this?  ???

 

Well what exactly are you trying to achieve?

Link to comment
Share on other sites

Using the value of HTTP_REFERER to show different content isn't a great idea. It can be spoofed to get around your checks - indeed using any information which came from the user can be altered. But worse, is doing this means potentially legitimate users will suffer - some firewalls prevent the referer from being send and browsers can be configured not to send it.

 

Is there any better way to done this?  ???

 

Well what exactly are you trying to achieve?

 

I want the script function (go true or false and randomly picking site to load based on the sites.txt) to work without the double meta refresh.

but i really don't know how to do it :(

 

when it set to go=true it will randomly pick site to load from sites.txt and double meta refresh.

I don' want the script to double meta refresh when it pick site to load from sites.txt  ;D

 

echo '<meta http-equiv="refresh" content="0;url=track.php?trkid=12">';
}else{
$referer = $_SERVER['HTTP_REFERER'];

if($referer == "" || strpos($referer,$_SERVER['HTTP_HOST'])) {
echo '<meta http-equiv="refresh" content="0;url='.$aff_link.'">';
}else{
echo '<meta http-equiv="refresh" content="0;url='.$site.'">';
}
}
}else{
echo '<meta http-equiv="refresh" content="0;url='.$site.'">';
}
?>

 

I am sorry for my bad english as  :(

 

Thanks for helping me....

appreciate it!

 

Link to comment
Share on other sites

<?php
//set this to true to rotate link offer or false to show fake website
$go = false;

//fake website
$site = 'http://www.example.com';

$redirect = $site;

$sites = explode("\n",file_get_contents('sites.txt'));
$aff_link = $sites[array_rand($sites)];

if (($go === true) || ($_REQUEST['trkid'] == 12)) {
if ($_REQUEST['trkid'] != 12 ) {
	$redirect = "track.php?trkid=12";
} else {
	$referer = $_SERVER['HTTP_REFERER'];

	if (($referer == "") || (strpos($referer,$_SERVER['HTTP_HOST']))) {
		$redirect = $aff_link;
	}
}
}

echo '<meta http-equiv="refresh" content="0;url='.$redirect.'">';
exit;
?>

 

Give that code a try and see if it works right for you.

Link to comment
Share on other sites

<?php
//set this to true to rotate link offer or false to show fake website
$go = false;

//fake website
$site = 'http://www.example.com';

$redirect = $site;

$sites = explode("\n",file_get_contents('sites.txt'));
$aff_link = $sites[array_rand($sites)];

if (($go === true) || ($_REQUEST['trkid'] == 12)) {
if ($_REQUEST['trkid'] != 12 ) {
	$redirect = "track.php?trkid=12";
} else {
	$referer = $_SERVER['HTTP_REFERER'];

	if (($referer == "") || (strpos($referer,$_SERVER['HTTP_HOST']))) {
		$redirect = $aff_link;
	}
}
}

echo '<meta http-equiv="refresh" content="0;url='.$redirect.'">';
exit;
?>

 

Give that code a try and see if it works right for you.

 

Thanks a lot!

It works!  ;D ;D ;D

 

Thanks guys!

Link to comment
Share on other sites

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.