[support] Cookie/Visit Tracking + Redirection

lists at southernohio.net lists at southernohio.net
Fri Mar 17 03:54:13 UTC 2006


I hate to pester, but I'm very hopeful that someone could have some  
helpful input with regards to this issue since I've received no  
responses on it thus far and it is a pretty time sensitive issue:

On Mar 16, 2006, at 10:07 AM, lists at southernohio.net wrote:

I have a situation where I need to push visitors back to a welcoming  
page if they've not visited the site previously.  I have implemented  
it in the drupal index.php page, however it doesn't seem to be  
reliably working so I wanted to post this for review, comments and  
suggestions as to the proper way to control this.  Perhaps there is  
even a module that I'm missing that would be better suited so please  
advise as you see fit:

index.php:
*** BEGIN PASTE ***
<?php
//... First Drupal Comments ...
// BEGIN OUR FUNCTIONS
// if they're new, send them back to the welcome page, else, check if  
they come from signup and set has_visited

$referring_url = $_SERVER['HTTP_REFERER'];    // get the referring  
URL, looking for http://www.mydomain.com/welcome/
$position_result = strpos($referring_url, "welcome");

if ( ($position_result > 0) || isset( $_COOKIE['has_visited'] ) ) {
	setcookie("has_visited", true, time()+7776000);
	}
else { 	
	header('Location:/welcome/index_main_site_entry.php');
	}

// END OUR FUNCTIONS

echo $_SESSION['HTTP_REFERER'];
//... rest of index.php ...
*** END PASTE ***

ALSO, in the index_main_site_entry.php file I would like to test to  
see if has_visited has been set so that I can pass them on into the  
site, but I've not been able to make that one work reliably at all.


Thanks in advance for your input!

-George
-- 
[ Drupal support list | http://lists.drupal.org/ ]



More information about the support mailing list