Skip to content

Instantly share code, notes, and snippets.

@slant
Created August 2, 2008 19:40
Show Gist options
  • Save slant/3761 to your computer and use it in GitHub Desktop.
Save slant/3761 to your computer and use it in GitHub Desktop.
if ( isset($_GET['id']) && !isset($_COOKIE['campaign']) ) {
# preg_match('/-/', $_GET['id']) == true ? list($campaign, $publisher) = split("-", $_GET['id']) : $campaign = $_GET['id'];
# in_array($_GET['id'], $ads) ? $campaign_valid = true : $campaign_valid = false;
if ( in_array($_GET['id'], $ads) ) {
setcookie("campaign", $_GET['id'], time() + 60*60*24*45, "", ".idwatchdog.com");
setcookie("ipaddress", $_SERVER['REMOTE_ADDR'], time() + 60*60*24*45, "", ".idwatchdog.com");
setcookie("accessed_at", date('Y-m-d H:i:s'), time() + 60*60*24*45, "", ".idwatchdog.com");
}
}
# Will set SESSION data if a campaign code is present
if ( isset($_GET['id']) && !isset($_SESSION['campaign']) ) {
if ( in_array($_GET['id'], $ads) ) {
$_SESSION['campaign'] = $_GET['id'];
$_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR'];
$_SESSION['accessed_at'] = date('Y-m-d H:i:s');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment