I'm not sure how well this would work, as it would depend at least somewhat on your site's ability to continue to function without a session, but you could extend the sessions library in a similar fashion to the library you linked by creating a file in /application/libraries/Session/MY_Session.php:
PHP Code:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class MY_Session extends CI_Session
{
public function __construct(array $params = array())
{
$CI = get_instance();
$CI->load->library('user_agent');
if ($CI->agent->is_robot()) {
log_message('debug', 'Session: Robot detected, initialization aborted.');
return;
}
parent::__construct($params);
}
}
This also depends on the ability to access the loader (and, in turn, the user_agent library) at the time the session library is loaded.
Note that this should be the entire contents of the new file. All it does is load the user_agent library to check whether it can identify a robot. If it identifies a robot, it logs a debug message and exits. Otherwise, it turns control back over to the parent, making sure to pass along any parameters which may have been passed by the loader.