php - Problem with code to show ads to search engine visitors only -


there plugin (for wordpress) show ads search engine visitors only.. person able modify code shows ads if land , click page...but doesnt appear on landing page. can me know whats wrong on code?

function wp_ozh_wsa_is_fromsearchengine($doset = false) { global $wp_ozh_wsa; $ref = $_server['http_referer']; $yes = false; if (isset($wp_ozh_wsa['my_search_engines'])) {     $se = $wp_ozh_wsa['my_search_engines']; } else {     $se = array('/search?', 'images.google.', 'web.info.com', 'search.', 'del.icio.us/search',     'soso.com', '/search/', '.yahoo.',     ); } foreach ($se $url) {     if (strpos($ref,$url)!==false) {         if ($doset) {             $url = parse_url(get_option('home'));             setcookie('wsas', 'yes', time() + 60*60, $url['path'] . '/');         }     } } if (isset($_cookie['wsas'])) {     return true; } return false; } 

as stated in ref setcookie on php.net:

once cookies have been set, can accessed on next page load $_cookie or $http_cookie_vars arrays.

simple fix, add following foreach:

foreach ($se $url) {     if (strpos($ref,$url)!==false) {         if ($doset) {             $url = parse_url(get_option('home'));             setcookie('wsas', 'yes', time() + 60*60, $url['path'] . '/');             return true;         }     } } 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -