Last active
March 13, 2017 12:08
-
-
Save infoscigeek/cf96f8f45efb50bea2670baa626c2d17 to your computer and use it in GitHub Desktop.
Affiliate Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment