general_sessionclear_method and nasXX_sessionclear_method
* Create a new function da_sql_limit() and use that to pass LIMIT arguments to the database layer
since the syntax is different between db vendors
+* Rename the badusers date field to incidentdate to avoid reserved words in databases. Bug found by
+ Peter Nixon
Ver 1.78:
* Add a snmp_clearsession which can disconnect a user by using the Cisco AAA Session MIB
* Add a configuration directive general_sessionclear_bin
if ($link){
$search = @da_sql_query($link,$config,
"SELECT da_sql_limit($limit,0,$config) * FROM $config[sql_badusers_table]
- WHERE username $usercheck $extra_query AND date <= '$now_str'
- AND date >= '$prev_str' da_sql_limit($limit,1,$config) ORDER BY date $order da_sql_limit($limit,2,$config);");
+ WHERE username $usercheck $extra_query AND incidentdate <= '$now_str'
+ AND incidentdate >= '$prev_str' da_sql_limit($limit,1,$config)
+ ORDER BY incidentdate $order da_sql_limit($limit,2,$config);");
if ($search){
while( $row = @da_sql_fetch_array($search,$config) ){
$num++;
$id = $row[id];
$user = "$row[username]";
$User = urlencode($user);
- $date = "$row[date]";
+ $date = "$row[incidentdate]";
$reason = "$row[reason]";
$admin = "$row[admin]";
if ($admin == $auth_user || $admin == '-')
$link = @da_sql_host_connect($server,$config);
if ($link){
$r = da_sql_query($link,$config,
- "INSERT INTO $config[sql_badusers_table] (username,date,admin,reason)
+ "INSERT INTO $config[sql_badusers_table] (username,incidentdate,admin,reason)
VALUES ('$login','$date','$admin','$msg');");
if (!$r)
echo "<b>SQL Error:" . da_sql_error($link,$config) . "</b><br>\n";
CREATE TABLE badusers (
id int(10) DEFAULT '0' NOT NULL auto_increment,
UserName varchar(30),
- Date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
+ IncidentDate datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
Reason varchar(200),
Admin varchar(30) DEFAULT '-',
PRIMARY KEY (id),
CREATE TABLE badusers (
id INT PRIMARY KEY,
username VARCHAR(30) DEFAULT '' NOT NULL,
- actiondate TIMESTAMP WITH TIME ZONE DEFAULT sysdate NOT NULL,
+ incidentdate TIMESTAMP WITH TIME ZONE DEFAULT sysdate NOT NULL,
reason VARCHAR(128) DEFAULT '' NOT NULL,
admin VARCHAR(128) DEFAULT '-' NOT NULL
);
CREATE SEQUENCE badusers_seq START WITH 1 INCREMENT BY 1;
-CREATE INDEX badusers_actiondate_idx ON badusers (actiondate);
+CREATE INDEX badusers_incidentdate_idx ON badusers (incidentdate);
CREATE INDEX badusers_username_idx ON badusers (username);
/* Trigger to emulate a serial # on the primary key */
CREATE TABLE badusers (
id BIGSERIAL PRIMARY KEY,
username TEXT NOT NULL,
- date timestamp with time zone DEFAULT 'now' NOT NULL,
+ incidentdate timestamp with time zone DEFAULT 'now' NOT NULL,
reason TEXT,
admin TEXT DEFAULT '-'
);
-CREATE INDEX badusers_actiondate_idx ON badusers USING btree (actiondate);
+CREATE INDEX badusers_incidentdate_idx ON badusers USING btree (incidentdate);
CREATE INDEX badusers_username_idx ON badusers USING btree (username);