Return to Snippet

Revision: 64779
at September 19, 2013 17:47 by nickian


Updated Code
<?php

// Check to see if this is an incoming link from an email campaign with an email address in the URL string
if (isset($_GET['e']) && filter_var($_GET['e'], FILTER_VALIDATE_EMAIL)) {

	$expire = time() + (10 * 365 * 24 * 60 * 60);
	setcookie("identity",$_GET['e'], $expire);
	$identity = $_COOKIE['identity'];

// Otherwise, look to see if a Gravity Form has been submitted ("input_3" being the email field)
} elseif ( isset($_POST['input_3']) && filter_var($_POST['input_3'], FILTER_VALIDATE_EMAIL) ) {

	$expire = time() + (10 * 365 * 24 * 60 * 60);
	setcookie("identity",$_POST['input_3'], $expire);
	$identity = $_COOKIE['identity'];

// If neither of the above, check to see if an identity cookie has previously been set (returning user).
} elseif ( isset($_COOKIE['identity']) ) {
	
	$identity = $_COOKIE['identity'];

// We don't know their identity yet.
} else {

	$identity="";
	
}

?>

Revision: 64778
at September 19, 2013 17:44 by nickian


Updated Code
<?php

// Check to see if this is an incoming link from an email campaign with an email address in the URL string
if (isset($_GET['e']) && filter_var($_GET['e'], FILTER_VALIDATE_EMAIL)) {

	$expire = time() + (10 * 365 * 24 * 60 * 60);
	setcookie("identity",$_GET['e'], $expire);
	$identity = $_COOKIE['identity'];

// Otherwise, look to see if a Gravity Form has been submitted ("input_3" being the email field)
} elseif ( isset($_POST['input_3'] ) && filter_var($_POST['input_3'], FILTER_VALIDATE_EMAIL) ) {

	$expire = time() + (10 * 365 * 24 * 60 * 60);
	setcookie("identity",$_POST['input_3'], $expire);
	$identity = $_COOKIE['identity'];

// If neither of the above, check to see if an identity cookie has previously been set (returning user).
} elseif ( isset($_COOKIE['identity']) ) {
	
	$identity = $_COOKIE['identity'];

// We don't know their identity yet.
} else {

	$identity="";
	
}

?>

Revision: 64777
at September 19, 2013 09:16 by nickian


Updated Code
<?php

// Check to see if this is an incoming link from an email campaign with an email address in the URL string
if (isset($_GET['e']) && filter_var($_GET['e'], FILTER_VALIDATE_EMAIL)) {

	$expire = time() + (10 * 365 * 24 * 60 * 60);
	setcookie("identity",$_GET['e'], $expire);
	$identity = $_COOKIE['identity'];

// Otherwise, look to see if a Gravity Form has been submitted ("input_3" being the email field)
} elseif ( isset($_POST['input_3'] && filter_var($_POST['input_3'], FILTER_VALIDATE_EMAIL) ) {

	$expire = time() + (10 * 365 * 24 * 60 * 60);
	setcookie("identity",$_POST['input_3'], $expire);
	$identity = $_COOKIE['identity'];

// If neither of the above, check to see if an identity cookie has previously been set (returning user).
} elseif ( isset($_COOKIE['identity']) ) {
	
	$identity = $_COOKIE['identity'];

// We don't know their identity yet.
} else {

	$identity="";
	
}

?>

Revision: 64776
at September 19, 2013 09:04 by nickian


Updated Code
<?php

// Check to see if this is an incoming link with an email address in the URL string
if (isset($_GET['e']) && filter_var($_GET['e'], FILTER_VALIDATE_EMAIL)) {

	$expire = time() + (10 * 365 * 24 * 60 * 60);
	setcookie("identity",$_GET['e'], $expire);
	$identity = $_COOKIE['identity'];

// Otherwise, look to see if a Gravity Form has been submitted ("input_3" being the email field)
} elseif ( isset($_POST['input_3'] && filter_var($_POST['input_3'], FILTER_VALIDATE_EMAIL) ) {

	$expire = time() + (10 * 365 * 24 * 60 * 60);
	setcookie("identity",$_POST['input_3'], $expire);
	$identity = $_COOKIE['identity'];

// If neither of the above, check to see if an identity cookie has already been previously set.
} elseif ( isset($_COOKIE['identity']) ) {
	
	$identity = $_COOKIE['identity'];

// We don't know their identity yet.
} else {

	$identity="";
	
}

?>

Revision: 64775
at September 19, 2013 08:59 by nickian


Initial Code
<?php

if (isset($_GET['e']) && filter_var($_GET['e'], FILTER_VALIDATE_EMAIL)) {

	$expire = time() + (10 * 365 * 24 * 60 * 60);
	setcookie("identity",$_GET['e'], $expire);
	$identity = $_COOKIE['identity'];
	
} elseif ( isset($_POST['input_3'] && filter_var($_POST['input_3'], FILTER_VALIDATE_EMAIL) ) {

	$expire = time() + (10 * 365 * 24 * 60 * 60);
	setcookie("identity",$_POST['input_3'], $expire);
	$identity = $_COOKIE['identity'];
	
} elseif ( isset($_COOKIE['identity']) ) {
	
	$identity = $_COOKIE['identity'];

} else {

	$identity="";
	
}

?>

Initial URL


Initial Description
VisiStat Identities with Gravity Forms

Initial Title
VisiStat Identities with Gravity Forms

Initial Tags


Initial Language
PHP