cookie php code help?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rcarden
Forum Newbie
Posts: 2
Joined: Wed Apr 22, 2009 9:06 am

cookie php code help?

Post by rcarden »

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!
rcarden
Forum Newbie
Posts: 2
Joined: Wed Apr 22, 2009 9:06 am

Re: cookie php code help?

Post by rcarden »

the error i keep getting it:

Parse error: syntax error, unexpected T_VARIABLE in /home/rcarden/public_html/templates/rt_mixxmag_j15/index.php on line 73
Post Reply