Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Issues with FORCE_COOKIE usae and BLOCK_SPIDERS


Guest

Recommended Posts

Hi,

 

I've been trying to trace a very strange problem with my site (which I won't go into here) and was looking at the code regarding cookies/spider sessions, and unless I'm going mad, there seems to be a problem with it. The code I'm talking about is this:

 

// start the session

$session_started = false;

if (SESSION_FORCE_COOKIE_USE == 'True') {

tep_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, $cookie_path, $cookie_domain);

 

if (isset($HTTP_COOKIE_VARS['cookie_test'])) {

tep_session_start();

$session_started = true;

}

} elseif (SESSION_BLOCK_SPIDERS == 'True') {

$user_agent = strtolower(getenv('HTTP_USER_AGENT'));

$spider_flag = false;

 

if (tep_not_null($user_agent)) {

$spiders = file(DIR_WS_INCLUDES . 'spiders.txt');

 

for ($i=0, $n=sizeof($spiders); $i<$n; $i++) {

if (tep_not_null($spiders[$i])) {

if (is_integer(strpos($user_agent, trim($spiders[$i])))) {

$spider_flag = true;

break;

}

}

}

}

 

if ($spider_flag == false) {

tep_session_start();

$session_started = true;

}

} else {

tep_session_start();

$session_started = true;

}

 

Which means that is FORCE_COOKIE_USE is True, it will start a session irrespective of the BLOCK_SPIDERS value.

 

So, is it me or can someone explain why the code is like this?

 

Thanks

Davin

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...