CREATE TABLE IF NOT EXISTS `intrusions` (
`id` int(11) unsigned NOT null auto_increment,
`name` varchar(128) NOT null,
`value` text NOT null,
`page` varchar(255) NOT null,
`tags` varchar(128) NOT null,
`ip` varchar(15) NOT null,
`impact` int(11) unsigned NOT null,
`origin` varchar(15) NOT null,
`created` datetime NOT null,
PRIMARY KEY (`id`)
) ENGINE=MyISAM ;$this->statement = $this->handle->prepare('
INSERT INTO ' . $this->table . ' (
name,
value,
page,
tags,
ip,
impact,
origin,
created
)
VALUES (
:name,
:value,
:page,
:tags,
:ip,
:impact,
:origin,
now()
)
');foreach ($data as $event) {
$page = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
$ip = $this->ip;
$tags = implode(", ",$event->getTags());
$this->statement->bindParam('name', $event->getName());
$this->statement->bindParam('value', $event->getValue());
$this->statement->bindParam('page', $page);
$this->statement->bindParam('tags', $tags);
$this->statement->bindParam('ip', $ip);
$this->statement->bindParam('impact', $data->getImpact());
$this->statement->bindParam('origin', $_SERVER['SERVER_ADDR']);
if (!$this->statement->execute()) {
$info = $this->statement->errorInfo();
throw new Exception(
$this->statement->errorCode() . ', ' . $info[1] . ', ' . $info[2]
);
}
}CREATE TABLE IF NOT EXISTS `intrusions` (
`id` int(11) unsigned NOT null auto_increment,
`name` varchar(128) NOT null,
`value` text NOT null,
`page` varchar(255) NOT null,
`tags` varchar(128) NOT null,
`filterid` varchar(128) NOT null,
`ip` varchar(15) NOT null,
`impact` int(11) unsigned NOT null,
`origin` varchar(15) NOT null,
`created` datetime NOT null,
PRIMARY KEY (`id`)
) ENGINE=MyISAM ;$this->statement = $this->handle->prepare('
INSERT INTO ' . $this->table . ' (
name,
value,
page,
tags,
filterid,
ip,
impact,
origin,
created
)
VALUES (
:name,
:value,
:page,
:tags,
:filterid,
:ip,
:impact,
:origin,
now()
)
');foreach ($data as $event) {
$page = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
$ip = $this->ip;
$tags = implode(", ",$event->getTags());
$filters = $event->getFilters();
$filter= $filters[0]->id;
$this->statement->bindParam('name', $event->getName());
$this->statement->bindParam('value', $event->getValue());
$this->statement->bindParam('page', $page);
$this->statement->bindParam('tags', $tags);
$this->statement->bindParam('filterid', $filter);
$this->statement->bindParam('ip', $ip);
$this->statement->bindParam('impact', $data->getImpact());
$this->statement->bindParam('origin', $_SERVER['SERVER_ADDR']);
if (!$this->statement->execute()) {
$info = $this->statement->errorInfo();
throw new Exception(
$this->statement->errorCode() . ', ' . $info[1] . ', ' . $info[2]
);
}
}1 to 4 of 4