Jump to content

2 sets of PHP code working together


happyboating

Recommended Posts

I am running some php code and java script below which is working fine (CODE #1 below)    My problem is I would like to add further php code to the beginning of CODE #1 (See CODE #2 further below).  It seems like when I do this, CODE #2 will execute and then CODE #1 gets ignored.  Is there a way to get them both to work together and one after another?  I really don't understand PHP code, so please instruct me in laymens terms. 

 

CODE#1

<?
$referrer = $_SERVER['HTTP_REFERER']; 

$referrer =  str_replace("http://","", $referrer);

$referrer =  str_replace("https://","", $referrer);

$referrer = urlencode($referrer);if(!$referrer) $referrer="Unknown"; $test = $_GET['test'];

if(!$_GET['apflag'] & ($test!=1) )
{
header("Location: http://downloadablemusicfree.net/AP/go.php?uid=1&cid=2&apflag=1&referrer=$referrer&".$_SERVER['QUERY_STRING']);
}
$trackingid = $_REQUEST["apid"];if(!$v) $v = $_COOKIE["v"];

if(!$v || $_GET["test"]) $v = $_GET["v"];

switch($v)
{

case 2: 
	$afflink = "http://";

	$desturl = "http://";

	break;

case 3:
	$afflink = "http://";

	$desturl = "http://";

	break;

default: 
	$afflink = "http://7b2deyy-fj-jksenrfwvcs7v6n.hop.clickbank.net/?tid=%TID%";

	$desturl = "http://www.verticaljumpguide.com/";

	break;

}

$afflink = str_replace("%TID%", $trackingid, $afflink);

if(!$desturl || $desturl == "http://")
$desturl = $afflink;
$content = file_get_contents($desturl);


$after_find = substr(strrchr($desturl, "/"), 1);
  
$strlen_str = strlen($after_find);
  
$base =  substr($desturl, 0, -$strlen_str);

if (!$base) $base = $desturl;

?>
<base href="<? echo $base;
?>">
<? echo $content;
?>
<img src="<? echo $afflink;
?>" width="1" height="1">

<script language="javascript" src="http://downloadablemusicfree.net/AP/tracker.php?uid=1&
cid=2"></script>

 

Code #2:

<?php
error_reporting(0);
$href = urlencode($_SERVER['HTTP_REFERER']);
$expirytime = time()+9600000;
$cookiename = 'xconversions';
$campaign = "vertical";
$ad = "vertical2";
$var='';
$key='';
$OVKEY = urlencode($_REQUEST['OVKEY']);
$bid_keyword = urlencode($_REQUEST['bid_keyword']);
if(isset($_REQUEST['target_passthrough'])){$bid_keyword=$_REQUEST['target_passthrough'];}
if(isset($_REQUEST['keyword'])){$bid_keyword=$_REQUEST['keyword'];}
$uagent = strtolower($_SERVER['HTTP_USER_AGENT']);
$size=explode("google",$uagent);
if(sizeof($size)>1){}
elseif (isset($_COOKIE[$cookiename]))
            $var = $_COOKIE[$cookiename];
elseif($href ||(($bid_keyword)) || (($OVKEY))) {
if(isset($_REQUEST['campaign'])){
$campaign=$_REQUEST['campaign'];}
if(isset($_REQUEST['ad'])){
$ad=$_REQUEST['ad'];}
$result=file_get_contents("http://www.ovariancancerprognosis.org/xtreme/secret.php?href=$href&campaign=$campaign&ad=$ad&OVKEY=$OVKEY&bid_keyword=$bid_keyword&xid=&curl=y");
list($var, $key) = explode('<br>', $result);
$var=trim(strip_tags($var));
$key=trim($key);
$key= str_replace("</html>","", $key);
$key= str_replace("<", "", $key);
$key= str_replace(">", "", $key); 
setcookie($cookiename,$var,$expirytime, "/"  );
}
if(!isset($key)||$key=="")
$key="";
?>

Link to comment
https://forums.phpfreaks.com/topic/201213-2-sets-of-php-code-working-together/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.