infoscigeek
3/8/2017 - 5:20 AM

Affiliate Code

Affiliate Code

<?php
if (!session_id()) {
 session_start();
}
//read variables from the URL
function add_query_vars($aVars) {
 $aVars[] = "group"; // represents the name of the affiliate
 return $aVars;
}
if(isset($wp_query->query_vars['group'])) {
 $group = urldecode($wp_query->query_vars['group']);
 }
add_filter('query_vars', 'add_query_vars');
//set the session variable
if (isset($_GET['group'])) {
 $_SESSION['group'] = $_GET['group'];
}
session_write_close();
?>
<?php
if (!session_id()) {
 session_start();
}
//read variables from the URL
function add_query_vars($aVars) {
 $aVars[] = "type"; // represents the name of the affiliate
 $aVars[] = "lawyer";
 $aVars[] = "city";
 return $aVars;
}
 if(isset($wp_query->query_vars['type'])) {
 $type = urldecode($wp_query->query_vars['type']);
 }
 if(isset($wp_query->query_vars['lawyer'])) {
 $lawyer = urldecode($wp_query->query_vars['lawyer']);
 }
 if(isset($wp_query->query_vars['city'])) {
 $city = urldecode($wp_query->query_vars['city']);
 }
add_filter('query_vars', 'add_query_vars');
//set the session variable
if (isset($_GET['type'])) {
 $_SESSION['type'] = $_GET['type'];
}
if (isset($_GET['lawyer'])) {
 $_SESSION['lawyer'] = $_GET['lawyer'];
}
if (isset($_GET['city'])) {
 $_SESSION['city'] = $_GET['city'];
}
session_write_close();
?>