If you want to track some basic info on who is trying to log in to your web apps, you can use the tracking function that Alpha has already included in the Web Security system. Using this feature allows you to see what IP addresses are trying to login, if a given IP is always failing, then perhaps it is a hacker and you can block that IP. Or maybe a user is having trouble, then you see that pattern and of course, you can do other analysis of the data.
In the Web Security Settings, under Login Options, check the "Login activity file" box. Then you have the option to save the login file to data folder, project data folder or a user defined function. The first 2 options work, but it saves the info in a text file in the respective data folder, meaning that you have to import the data into something else to do analysis. Consider using the 'User Defined Function'. Then the data is saved in a table, making the analysis much easier.
Be sure to check the next 2 boxes, 'Login activity include failed' and 'Login activity include logout' so you have more complete trail of login's.
Oh yeah, don't forget to publish the security files when you are done....
I implemented this is in our system to do the tracking in a MySQL table.
Here is the MySQL code to create the table:
CREATE TABLE `login_log` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`USERID` varchar(20) DEFAULT NULL,
`ACTION_TIME` datetime DEFAULT NULL,
`IP` varchar(20) DEFAULT NULL,
`PASSEXP` datetime DEFAULT NULL,
`LOGINEXP` datetime DEFAULT NULL,
`LOGINERROR` varchar(50) DEFAULT NULL,
`LOGOUT` tinyint(1) DEFAULT NULL,
`ULINK` varchar(40) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
Here is the code to place in the user defined function on the web security settings:
dim cn as sql::Connection
dim args as sql::Arguments
args.set("userid",e.userid)
args.set("action_time",now())
args.set("ulink",e.ulink)
args.set("passexp",e.passexp)
args.set("loginexp",e.loginexp)
args.set("loginerror",e.loginerror)
args.set("ip",e.ip)
args.set("logout",e.logout)
sqlinsert = <<%A%
insert into login_log
(
userid,
action_time,
ulink,
passexp,
loginexp,
loginerror,
ip,
logout
)
values
(
:userid,
:action_time,
:ulink,
:passexp,
:loginexp,
:loginerror,
:ip,
:logout
)
%A%
cn_open = cn.open("your connection string")
cn_exec = cn.execute(sqlinsert, args)
cn.FreeResult()
cn.Close()
Mike
In the Web Security Settings, under Login Options, check the "Login activity file" box. Then you have the option to save the login file to data folder, project data folder or a user defined function. The first 2 options work, but it saves the info in a text file in the respective data folder, meaning that you have to import the data into something else to do analysis. Consider using the 'User Defined Function'. Then the data is saved in a table, making the analysis much easier.
Be sure to check the next 2 boxes, 'Login activity include failed' and 'Login activity include logout' so you have more complete trail of login's.
Oh yeah, don't forget to publish the security files when you are done....
I implemented this is in our system to do the tracking in a MySQL table.
Here is the MySQL code to create the table:
CREATE TABLE `login_log` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`USERID` varchar(20) DEFAULT NULL,
`ACTION_TIME` datetime DEFAULT NULL,
`IP` varchar(20) DEFAULT NULL,
`PASSEXP` datetime DEFAULT NULL,
`LOGINEXP` datetime DEFAULT NULL,
`LOGINERROR` varchar(50) DEFAULT NULL,
`LOGOUT` tinyint(1) DEFAULT NULL,
`ULINK` varchar(40) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
Here is the code to place in the user defined function on the web security settings:
dim cn as sql::Connection
dim args as sql::Arguments
args.set("userid",e.userid)
args.set("action_time",now())
args.set("ulink",e.ulink)
args.set("passexp",e.passexp)
args.set("loginexp",e.loginexp)
args.set("loginerror",e.loginerror)
args.set("ip",e.ip)
args.set("logout",e.logout)
sqlinsert = <<%A%
insert into login_log
(
userid,
action_time,
ulink,
passexp,
loginexp,
loginerror,
ip,
logout
)
values
(
:userid,
:action_time,
:ulink,
:passexp,
:loginexp,
:loginerror,
:ip,
:logout
)
%A%
cn_open = cn.open("your connection string")
cn_exec = cn.execute(sqlinsert, args)
cn.FreeResult()
cn.Close()
Mike
Comment