cookie php code help?
Posted: Wed Apr 22, 2009 9:24 am
I'm trying to write some php code to set a cookie for traffic being reffered from a search engine. I'm a PHP novice and when I try to implement the following code I keep getting syntax errors. Do you guys (and gals) see any obvious problems with the code?
<?php
$ref = $_SERVER['HTTP_REFERER'];
$SE = array('/search?', 'images.google.', 'web.info.com', 'search.', 'del.icio.us/search', 'soso.com', '/search/', '.yahoo.');
foreach ($SE as $source) {
if (strpos($ref,$source)!==false) {
setcookie("sevisitor", 1, time()+3600, "/", ".scooter-news.com");
$sevisitor=true;
}
}
?>
thanks!
<?php
$ref = $_SERVER['HTTP_REFERER'];
$SE = array('/search?', 'images.google.', 'web.info.com', 'search.', 'del.icio.us/search', 'soso.com', '/search/', '.yahoo.');
foreach ($SE as $source) {
if (strpos($ref,$source)!==false) {
setcookie("sevisitor", 1, time()+3600, "/", ".scooter-news.com");
$sevisitor=true;
}
}
?>
thanks!