Camper Community Forums banner
1 - 5 of 5 Posts

·
Registered
Joined
·
122 Posts
Discussion Starter · #1 ·
You have a problem

<?php
/**
* This class will be used for ad testing where we're going to test out dropping cookies on users based on what we think
* they're interested in
*/
include('RedisPHP.php');

class CookieBuckets {

public function __construct($userGuid) {
$this->enabled = true;
$this->redis = null;

$this->cookieImage = "";
$this->sendCookie = false;

try {
$this->redis = new RedisPHP("grv-crawl09");
$this->redis->ping();

$this->userGuid = $userGuid;

$this->currentDay = (int) date('z') + 1;

} catch (Exception $e) {
$this->enabled = false;
}
}


// give up the redis resources, close the socket
function __destruct() {

if (!is_null($this->redis)) {
$this->redis->disconnect();
}
}


public function isEnabled() {
return $this->enabled;
}

public function getSendCookie() {
return $this->sendCookie;
}

public function dropTheHottness() {
// check to see if we need to drop cookies on this person or not

$key = "ads_b_{$this->userGuid}";
$dayKey = "ads_b_{$this->currentDay}_{$this->userGuid}";
$bucket = $this->redis->get($dayKey);
if (is_null($bucket)) {
$this->setCookieForNewUserToday($key, $dayKey, $bucket);
}

}

public function getCookie() {
return $this->cookieImage;
}

/**
* this is what happens when we see a new user for the first time today
*/
private function setCookieForNewUserToday($key, $dayKey, $bucket) {

// check if eligible for ad test
$adBucket = $this->redis->get($key);
if (is_null($adBucket)) {
// set the fact we don't want to give this guy anything
$this->redis->set($dayKey, '0');
$this->redis->incr("ads_daily_{$this->currentDay}_nonbucketusers");
return false;
}

$this->redis->incr("ads_daily_{$this->currentDay}_bucketedusers");
$this->setCookieImage($adBucket, $dayKey);

}

private function setCookieImage($adBucket, $dayKey) {


$tokens = explode("-", $adBucket);
$category = $tokens[0];
$bucket = (int) $tokens[1];

$buckets = array(
'Jim Test' => array(
1 => '<img src="http://plushimages.net/temp/scripts/dropcookie.php?b1" width="1" height="1" border="0">',
2 => '<img src="http://plushimages.net/temp/scripts/dropcookie.php?b2" width="1" height="1" border="0">',
3 => '<img src="http://plushimages.net/temp/scripts/dropcookie.php?b3" width="1" height="1" border="0">',
4 => '<img src="http://plushimages.net/temp/scripts/dropcookie.php?b4" width="1" height="1" border="0">'
),

'Fashion' => array(
1 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD01" width="1" height="1" border="0">',
2 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD02" width="1" height="1" border="0">',
3 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD03" width="1" height="1" border="0">',
4 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD04" width="1" height="1" border="0">',
),

'Cars' => array(

1 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD05" width="1" height="1" border="0">',
2 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD06" width="1" height="1" border="0">',
3 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD07" width="1" height="1" border="0">',
4 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD08" width="1" height="1" border="0">',

),

'Finance' => array(
1 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD09" width="1" height="1" border="0">',
2 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD10" width="1" height="1" border="0">',
3 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD11" width="1" height="1" border="0">',
4 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD12" width="1" height="1" border="0">',
),

'High Level Food and Drink' => array(
1 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD13" width="1" height="1" border="0">',
2 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD14" width="1" height="1" border="0">',
3 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD15" width="1" height="1" border="0">',
4 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD16" width="1" height="1" border="0">',
),

'Fitness' => array(
1 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD17" width="1" height="1" border="0">',
2 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD18" width="1" height="1" border="0">',
3 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD19" width="1" height="1" border="0">',
4 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD20" width="1" height="1" border="0">',
),
I get a download prompt for a cb_render.php file and that is what is stored within..... Figured you guys should know that we can download part of your file set.
 

·
Registered
Joined
·
122 Posts
Discussion Starter · #2 ·
'Medicine' => array(
1 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD21" width="1" height="1" border="0">',
2 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD22" width="1" height="1" border="0">',
3 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD23" width="1" height="1" border="0">',
4 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD24" width="1" height="1" border="0">',
),

'Household' => array(

1 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD25" width="1" height="1" border="0">',
2 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD26" width="1" height="1" border="0">',
3 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD27" width="1" height="1" border="0">',
4 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD28" width="1" height="1" border="0">',
),

'Outdoor Recreation' => array(
1 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD29" width="1" height="1" border="0">',
2 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD30" width="1" height="1" border="0">',
3 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD31" width="1" height="1" border="0">',
4 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD32" width="1" height="1" border="0">',
),

'Culture' => array(
1 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD33" width="1" height="1" border="0">',
2 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD34" width="1" height="1" border="0">',
3 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD35" width="1" height="1" border="0">',
4 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD36" width="1" height="1" border="0">',
),

'History' => array(
1 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD37" width="1" height="1" border="0">',
2 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD38" width="1" height="1" border="0">',
3 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD39" width="1" height="1" border="0">',
4 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD40" width="1" height="1" border="0">',
),

'Law' => array(
1 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD41" width="1" height="1" border="0">',
2 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD42" width="1" height="1" border="0">',
3 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD43" width="1" height="1" border="0">',
4 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD44" width="1" height="1" border="0">',
),

'Politics' => array(
1 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD45" width="1" height="1" border="0">',
2 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD46" width="1" height="1" border="0">',
3 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD47" width="1" height="1" border="0">',
4 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD48" width="1" height="1" border="0">',
),
'Popular Culture' => array(
1 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD49" width="1" height="1" border="0">',
2 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD50" width="1" height="1" border="0">',
3 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD51" width="1" height="1" border="0">',
4 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD52" width="1" height="1" border="0">',
),

'High Level Sports' => array(
1 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD53" width="1" height="1" border="0">',
2 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD54" width="1" height="1" border="0">',
3 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD55" width="1" height="1" border="0">',
4 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD56" width="1" height="1" border="0">',
),

'Computers' => array(
1 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD57" width="1" height="1" border="0">',
2 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD58" width="1" height="1" border="0">',
3 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD59" width="1" height="1" border="0">',
4 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD60" width="1" height="1" border="0">',
),

'Mobile' => array(
1 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD61" width="1" height="1" border="0">',
2 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD62" width="1" height="1" border="0">',
3 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD63" width="1" height="1" border="0">',
4 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD64" width="1" height="1" border="0">',
),

'Places' => array(
1 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD65" width="1" height="1" border="0">',
2 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD66" width="1" height="1" border="0">',
3 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD67" width="1" height="1" border="0">',
4 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD68" width="1" height="1" border="0">',
),

'Tourism' => array(
1 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD69" width="1" height="1" border="0">',
2 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD70" width="1" height="1" border="0">',
3 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD71" width="1" height="1" border="0">',
4 => '<img src="http://bh.contextweb.com/bh/set.aspx?action=add&advid=3020&token=GAD72" width="1" height="1" border="0">',
),


);


if (isset($buckets[@$category])) {
$adTarget = $buckets[$category][$bucket];

$this->sendCookie = true;
$this->cookieImage = $adTarget;
$adBucket = str_replace(" ", "-", $adBucket);
$bucketKey = "ads_daily_{$this->currentDay}_{$adBucket}";
$this->redis->incr($bucketKey);

$bucketKey2 = "ads_daily_alltime_{$adBucket}";
$this->redis->incr($bucketKey2);


} else {

$this->redis->incr("ads_daily_{$this->currentDay}_invalidcategories");
}

// set the fact we hit this user:
$this->redis->set($dayKey, '1');


}

}

?>
<?php

$cb = new CookieBuckets($_GET['g']);

if ($cb->isEnabled()) {
$cb->dropTheHottness();
if ($cb->getSendCookie()) {

$wrapper = "<html><head></head><body>" . $cb->getCookie() . "</body></html>";
echo $wrapper;
} else {
$wrapper = "<html><head></head><body>null</body></html>";
echo $wrapper;

}
}
?>
That is the rest of the code from the bottom of the file.
 

·
Camping Fanatic
Joined
·
1,188 Posts
I think i know what was causing this and have disabled it. Let me know if you still see it happen. I had some free statistical software running and others have complained of this same issue until they disabled it.
 
1 - 5 of 5 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top