作者 |
|
fwj3861 [个人空间] QQ名 越南-叶子(121305301)
   注册  2010-09-09 发贴数 579 精华贴 10 原创贴 20 来自 越南 状态 正常
级别 贵宾 |
|
|
孟老师有更新了【get_online_user()】函数可以用来查看在线用户,在【主窗口脚本定义】脚本添加【menu_add_csp("MainMenu",24,'xxxxxx','在线用户','在线用户');】创建在线用户菜单 新建一个【在线用户】脚本文件【或导入附件脚本文件后根据实际情况修改】,提取当前在线用户账号来查询在线用户最后的登录信息,在此感谢【十二个耳环】老师的在线用户ID拼接写法支持 为保障隐私,限制了非管理员权限账号只能查看本人的登录信息 【登录时间】分解为格式化后的【登录日期】和【登录时刻】显示,这样更直观一点 脚本还可以优化,关联显示操作员所在组织架构分组和上级账号能查看所有在线的下级账号的登录信息,待有空的时候再研究【2022.11.15已更新完成】 int test() { return 1; }; int main() { int i,yhsl,count,j; string sql,sql2,yhbh,userIds,uid; uid = get_user_id() get_online_user(); yhsl = db_row_count() userIds=""; for(i=0;i<yhsl;i++); { db_go_row(i) yhbh = db_res(0) if(userIds=="") { userIds="'"+yhbh+"'"; } else { userIds=userIds+",'"+yhbh+"'"; } }; if(is_super_user() == '1') { sql="select user_id as 用户账号,user_name as 用户名称,ip as 登录电脑名和IP,machine_id as 登录电脑机器标识,substring(login_time,0,9) as 登录日期,substring(login_time,9,15)"; sql=sql+" as 登录时刻 from mup_login_log as a where login_time = (select max(login_time) from mup_login_log as b where b.user_id = a.user_id) and user_id in("+ userIds +")"; db_run(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(4),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(5),"hh:mi:ss")) db_show('在线用户') }; }; if(is_super_user() == '0') { sql="select user_id as 用户账号,user_name as 用户名称,ip as 登录电脑名和IP,machine_id as 登录电脑机器标识,substring(login_time,0,9) as 登录日期,substring(login_time,9,15)"; sql=sql+" as 登录时刻 from mup_login_log as a where login_time = (select max(login_time) from mup_login_log as b where b.user_id = a.user_id) and user_id = '"+ uid +"'"; db_run(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(4),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(5),"hh:mi:ss")) db_show('登录信息') }; }; // msg('hello,world'); return 1; }; |
|
附件(登录后才可下载):2211111755_09.csp 说明: 原文件:在线用户.csp 大小:3922 Byte
 |
于 2022-11-15 17:44 被 fwj3861 修改

官方认证第三方服务团队 (越南-叶子) QQ:121305301 TEL:+84869350626
承接越南北部-河内周边省份-OIT部署和维护服务(24小时上门或远程服务)
服务介绍:http://www.onlyit.cn/onlyit_service.html
|
|
fwj3861 [个人空间] QQ名 越南-叶子(121305301)
   注册  2010-09-09 发贴数 579 精华贴 10 原创贴 20 来自 越南 状态 正常
级别 贵宾 |
|
|
改【在线用户】菜单为【在线信息】,增加6个子菜单,【管理员权限账号查看所有在线用户登录信息】,【非管理员账号查看本人登录信息】。 1.【在线用户信息】 2.【今日登录信息】 3.【本周登录信息】 4.【本月登录信息】 5.【最近一周登录】 6.【最近30天登录】 在【主窗口脚本定义】添加新建菜单脚本 int main() { menu_add_csp("MainMenu",26,'x26','在线信息',''); menu_add_csp("x26",1,'x2601','1】 在线用户信息','在线用户'); menu_add_csp("x26",2,'x2602','2】 今日登录信息','今日登录'); menu_add_csp("x26",3,'x2603','3】 本周登录信息','本周登录'); menu_add_csp("x26",4,'x2604','4】 本月登录信息','本月登录'); menu_add_csp("x26",5,'x2605','5】 最近一周登录','一周登录'); menu_add_csp("x26",6,'x2606','6】 最近30天登录','30天登录'); return 1; }; 增加6个子菜单脚本定义文件【或导入附件脚本文件后自行修改】 1.【在线用户】脚本文件 int test() { return 1; }; int main() { int i,yhsl,count,j; string sql,sql2,yhbh,userIds,uid; uid = get_user_id() get_online_user(); yhsl = db_row_count() userIds=""; for(i=0;i<yhsl;i++); { db_go_row(i) yhbh = db_res(0) if(userIds=="") { userIds="'"+yhbh+"'"; } else { userIds=userIds+",'"+yhbh+"'"; } }; if(is_super_user() == '1') { sql="select user_id as 用户账号,user_name as 用户名称,ip as 登录电脑名和IP,machine_id as 登录电脑机器标识,substring(login_time,0,9) as 登录日期,substring(login_time,9,15)"; sql=sql+" as 登录时刻 from mup_login_log as a where login_time = (select max(login_time) from mup_login_log as b where b.user_id = a.user_id) and user_id in("+ userIds +")"; db_run(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(4),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(5),"hh:mi:ss")) db_show('【在线用户】登录信息') }; }; if(is_super_user() == '0') { sql="select user_id as 用户账号,user_name as 用户名称,ip as 登录电脑名和IP,machine_id as 登录电脑机器标识,substring(login_time,0,9) as 登录日期,substring(login_time,9,15)"; sql=sql+" as 登录时刻 from mup_login_log as a where login_time = (select max(login_time) from mup_login_log as b where b.user_id = a.user_id) and user_id = '"+ uid +"'"; db_run(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(4),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(5),"hh:mi:ss")) db_show('【本次登录】信息') }; }; // msg('hello,world'); return 1; }; 2.【今日登录信息】脚本文件 int test() { return 1; }; int main() { int i,yhsl,count,j; string sql,sql2,yhbh,userIds,uid,dlrq; dlrq = get_serv_date() + '%' uid = get_user_id() get_online_user(); yhsl = db_row_count() userIds=""; for(i=0;i<yhsl;i++); { db_go_row(i) yhbh = db_res(0) if(userIds=="") { userIds="'"+yhbh+"'"; } else { userIds=userIds+",'"+yhbh+"'"; } }; if(is_super_user() == '1') { sql="select user_id as 用户账号,user_name as 用户名称,ip as 登录电脑名和IP,machine_id as 登录电脑机器标识,substring(login_time,0,9) as 登录日期,substring(login_time,9,15)"; sql=sql+" as 登录时刻 from mup_login_log as a where login_time like '"+dlrq+"' and user_id in("+ userIds +") order by user_id,login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(4),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(5),"hh:mi:ss")) db_show('在线用户【今日登录】信息') }; }; if(is_super_user() == '0') { sql="select user_id as 用户账号,user_name as 用户名称,ip as 登录电脑名和IP,machine_id as 登录电脑机器标识,substring(login_time,0,9) as 登录日期,substring(login_time,9,15)"; sql=sql+" as 登录时刻 from mup_login_log as a where login_time like '"+dlrq+"' and user_id = '"+ uid +"' order by user_id,login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(4),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(5),"hh:mi:ss")) db_show('【今日登录】信息') }; }; // msg('hello,world'); return 1; }; 3.【本周登录信息】脚本文件 int test() { return 1; }; int main() { int i,yhsl,count,j; string sql,sql2,yhbh,userIds,uid,dlrq; dlrq = get_serv_date()-get_week_id(get_serv_date()) uid = get_user_id() get_online_user(); yhsl = db_row_count() userIds=""; for(i=0;i<yhsl;i++); { db_go_row(i) yhbh = db_res(0) if(userIds=="") { userIds="'"+yhbh+"'"; } else { userIds=userIds+",'"+yhbh+"'"; } }; if(is_super_user() == '1') { sql="select user_id as 用户账号,user_name as 用户名称,ip as 登录电脑名和IP,machine_id as 登录电脑机器标识,substring(login_time,0,9) as 登录日期,substring(login_time,9,15)"; sql=sql+" as 登录时刻 from mup_login_log as a where login_time >= '"+dlrq+"' and user_id in("+ userIds +") order by user_id,login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(4),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(5),"hh:mi:ss")) db_show('在线用户【本周登录】信息') }; }; if(is_super_user() == '0') { sql="select user_id as 用户账号,user_name as 用户名称,ip as 登录电脑名和IP,machine_id as 登录电脑机器标识,substring(login_time,0,9) as 登录日期,substring(login_time,9,15)"; sql=sql+" as 登录时刻 from mup_login_log as a where login_time >= '"+dlrq+"' and user_id = '"+ uid +"' order by user_id,login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(4),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(5),"hh:mi:ss")) db_show('【本周登录】信息') }; }; // msg('hello,world'); return 1; }; 4.【本月登录信息】脚本文件 int test() { return 1; }; int main() { int i,yhsl,count,j; string sql,sql2,yhbh,userIds,uid,dlrq; dlrq = get_cur_month()+'01' uid = get_user_id() get_online_user(); yhsl = db_row_count() userIds=""; for(i=0;i<yhsl;i++); { db_go_row(i) yhbh = db_res(0) if(userIds=="") { userIds="'"+yhbh+"'"; } else { userIds=userIds+",'"+yhbh+"'"; } }; if(is_super_user() == '1') { sql="select user_id as 用户账号,user_name as 用户名称,ip as 登录电脑名和IP,machine_id as 登录电脑机器标识,substring(login_time,0,9) as 登录日期,substring(login_time,9,15)"; sql=sql+" as 登录时刻 from mup_login_log as a where login_time >= '"+dlrq+"' and user_id in("+ userIds +") order by user_id,login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(4),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(5),"hh:mi:ss")) db_show('在线用户【本月登录】信息') }; }; if(is_super_user() == '0') { sql="select user_id as 用户账号,user_name as 用户名称,ip as 登录电脑名和IP,machine_id as 登录电脑机器标识,substring(login_time,0,9) as 登录日期,substring(login_time,9,15)"; sql=sql+" as 登录时刻 frommup_login_log as a where login_time >= '"+dlrq+"' and user_id = '"+ uid +"' order by user_id,login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(4),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(5),"hh:mi:ss")) db_show('【本月登录】信息') }; }; // msg('hello,world'); return 1; }; 5.【最近一周登录】脚本文件 int test() { return 1; }; int main() { int i,yhsl,count,j; string sql,sql2,yhbh,userIds,uid,dlrq; dlrq = get_last_date(date_add(get_cur_date_std(),-7)) uid = get_user_id() get_online_user(); yhsl = db_row_count() userIds=""; for(i=0;i<yhsl;i++); { db_go_row(i) yhbh = db_res(0) if(userIds=="") { userIds="'"+yhbh+"'"; } else { userIds=userIds+",'"+yhbh+"'"; } }; if(is_super_user() == '1') { sql="select user_id as 用户账号,user_name as 用户名称,ip as 登录电脑名和IP,machine_id as 登录电脑机器标识,substring(login_time,0,9) as 登录日期,substring(login_time,9,15)"; sql=sql+" as 登录时刻 from mup_login_log as a where login_time >= '"+dlrq+"' and user_id in("+ userIds +") order by user_id,login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(4),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(5),"hh:mi:ss")) db_show('在线用户【一周登录】信息') }; }; if(is_super_user() == '0') { sql="select user_id as 用户账号,user_name as 用户名称,ip as 登录电脑名和IP,machine_id as 登录电脑机器标识,substring(login_time,0,9) as 登录日期,substring(login_time,9,15)";sql=sql+" as 登录时刻 from mup_login_log as a where login_time >= '"+dlrq+"' and user_id = '"+ uid +"' order by user_id,login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(4),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(5),"hh:mi:ss")) db_show('【一周登录】信息') }; }; // msg('hello,world'); return 1; }; 6.【最近30天登录】脚本文件 int test() { return 1; }; int main() { int i,yhsl,count,j; string sql,sql2,yhbh,userIds,uid,dlrq; dlrq = get_last_date(date_add(get_cur_date_std(),-29)) uid = get_user_id() get_online_user(); yhsl = db_row_count() userIds=""; for(i=0;i<yhsl;i++); { db_go_row(i) yhbh = db_res(0) if(userIds=="") { userIds="'"+yhbh+"'"; } else { userIds=userIds+",'"+yhbh+"'"; } }; if(is_super_user() == '1') { sql="select user_id as 用户账号,user_name as 用户名称,ip as 登录电脑名和IP,machine_id as 登录电脑机器标识,substring(login_time,0,9) as 登录日期,substring(login_time,9,15)"; sql=sql+" as 登录时刻 from mup_login_log as a where login_time >= '"+dlrq+"' and user_id in("+ userIds +") order by user_id,login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(4),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(5),"hh:mi:ss")) db_show('在线用户【30天登录】信息') }; }; if(is_super_user() == '0') { sql="select user_id as 用户账号,user_name as 用户名称,ip as 登录电脑名和IP,machine_id as 登录电脑机器标识,substring(login_time,0,9) as 登录日期,substring(login_time,9,15)"; sql=sql+" as 登录时刻 from mup_login_log as a where login_time >= '"+dlrq+"' and user_id = '"+ uid+"' order by user_id,login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(4),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(5),"hh:mi:ss")) db_show('【30天登录】信息') }; }; // msg('hello,world'); return 1; }; |
|
 |
于 2022-11-12 12:49 被 fwj3861 修改

官方认证第三方服务团队 (越南-叶子) QQ:121305301 TEL:+84869350626
承接越南北部-河内周边省份-OIT部署和维护服务(24小时上门或远程服务)
服务介绍:http://www.onlyit.cn/onlyit_service.html
|
|
fwj3861 [个人空间] QQ名 越南-叶子(121305301)
   注册  2010-09-09 发贴数 579 精华贴 10 原创贴 20 来自 越南 状态 正常
级别 贵宾 |
|
fwj3861 [个人空间] QQ名 越南-叶子(121305301)
   注册  2010-09-09 发贴数 579 精华贴 10 原创贴 20 来自 越南 状态 正常
级别 贵宾 |
|
fwj3861 [个人空间] QQ名 越南-叶子(121305301)
   注册  2010-09-09 发贴数 579 精华贴 10 原创贴 20 来自 越南 状态 正常
级别 贵宾 |
|
fwj3861 [个人空间] QQ名 越南-叶子(121305301)
   注册  2010-09-09 发贴数 579 精华贴 10 原创贴 20 来自 越南 状态 正常
级别 贵宾 |
|
|
修正【本周登录信息】脚本的BUG,使用【取上一天】函数来定位到星期一 int test() { return 1; }; int main() { int i,yhsl,count,j; string sql,sql2,yhbh,userIds,uid,dlrq; string xqs,xq2,xq3,xq4,xq5,xq6,xq7; xqs = get_week_id(get_serv_date()) xq2 = get_last_date(get_serv_date()) xq3 = get_last_date(xq2) xq4 = get_last_date(xq3) xq5 = get_last_date(xq4) xq6 = get_last_date(xq5) xq7 = get_last_date(xq6) if(xqs == '1'){ dlrq = get_serv_date() }if(xqs == '2'){ dlrq = xq2 }if(xqs == '3'){ dlrq = xq3 }if(xqs == '4'){ dlrq = xq4 }if(xqs == '5'){ dlrq = xq5 }if(xqs == '6'){ dlrq = xq6 }if(xqs == '7'){ dlrq = xq7 }; uid = get_user_id() get_online_user(); yhsl = db_row_count() userIds=""; for(i=0;i<yhsl;i++); { db_go_row(i) yhbh = db_res(0) if(userIds=="") { userIds="'"+yhbh+"'"; } else { userIds=userIds+",'"+yhbh+"'"; } }; if(is_super_user() == '1') { sql="select user_id as 用户账号,user_name as 用户名称,ip as 登录电脑名和IP,machine_id as 登录电脑机器标识,substring(login_time,0,9) as 登录日期,substring(login_time,9,15)"; sql=sql+" as 登录时刻 from mup_login_log as a where login_time >= '"+dlrq+"' and user_id in("+ userIds +") order by user_id,login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(4),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(5),"hh:mi:ss")) db_show('在线用户【本周登录】信息') }; }; if(is_super_user() == '0') { sql="select user_id as 用户账号,user_name as 用户名称,ip as 登录电脑名和IP,machine_id as 登录电脑机器标识,substring(login_time,0,9) as 登录日期,substring(login_time,9,15)"; sql=sql+" as 登录时刻 from mup_login_log as a where login_time >= '"+dlrq+"' and user_id = '"+ uid +"' order by user_id,login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(4),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(5),"hh:mi:ss")) db_show('【本周登录】信息') }; }; // msg('hello,world'); return 1; }; |
|
附件(登录后才可下载):2211121701_19.csp 说明: 原文件:本周登录.csp 大小:4474 Byte
|

官方认证第三方服务团队 (越南-叶子) QQ:121305301 TEL:+84869350626
承接越南北部-河内周边省份-OIT部署和维护服务(24小时上门或远程服务)
服务介绍:http://www.onlyit.cn/onlyit_service.html
|
|
ihr2013 [个人空间]
    注册  2013-05-01 发贴数 459 精华数 0 原创贴 0 来自 状态 正常
级别 会员 |
|
xwb514 [个人空间] QQ名 福建流浪(340298101)
   注册  2010-03-19 发贴数 576 精华贴 7 原创贴 7 来自 状态 正常
级别 会员 |
|
|
自定义报表,1.【在线用户信息】 2.【今日登录信息】 3.【本周登录信息】 4.【本月登录信息】 5.【最近一周登录】 6.【最近30天登录】 这些作为筛选条件 |
|
|

官方认证第三方服务团队 徐文标(福建-流浪) QQ:340298101 V&P :177-5046-4787
服务介绍:http://www.onlyit.cn/onlyit_service.html
|
|
fwj3861 [个人空间] QQ名 越南-叶子(121305301)
   注册  2010-09-09 发贴数 579 精华贴 10 原创贴 20 来自 越南 状态 正常
级别 贵宾 |
|
|
修复【一周登录】脚本的BUG,使用【取上一天】函数来定位到六天前 int test() { return 1; }; int main() { int i,yhsl,count,j; string sql,yhbh,userIds,uid,dlrq; dlrq = get_last_date(get_last_date(get_last_date(get_last_date(get_last_date(get_last_date(get_serv_date())))))) uid = get_user_id() get_online_user(); yhsl = db_row_count() userIds=""; for(i=0;i<yhsl;i++); { db_go_row(i) yhbh = db_res(0) if(userIds=="") { userIds="'"+yhbh+"'"; } else { userIds=userIds+",'"+yhbh+"'"; } }; if(is_super_user() == '1') { sql="select user_id as 用户账号,user_name as 用户名称,ip as 登录电脑名和IP,machine_id as 登录电脑机器标识,substring(login_time,0,9) as 登录日期,substring(login_time,9,15)"; sql=sql+" as 登录时刻 from mup_login_log as a where login_time >= '"+dlrq+"' and user_id in("+ userIds +") order by user_id,login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(4),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(5),"hh:mi:ss")) db_show('在线用户【一周登录】信息') }; }; if(is_super_user() == '0') { sql="select user_id as 用户账号,user_name as 用户名称,ip as 登录电脑名和IP,machine_id as 登录电脑机器标识,substring(login_time,0,9) as 登录日期,substring(login_time,9,15)"; sql=sql+" as 登录时刻 from mup_login_log as a where login_time >= '"+dlrq+"' and user_id = '"+ uid +"' order by user_id,login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(4),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(5),"hh:mi:ss")) db_show('【一周登录】信息') }; }; // msg('hello,world'); return 1; }; |
|
附件(登录后才可下载):2211141244_40.csp 说明: 原文件:一周登录.csp 大小:7632 Byte
|
于 2022-11-14 12:44 被 fwj3861 修改

官方认证第三方服务团队 (越南-叶子) QQ:121305301 TEL:+84869350626
承接越南北部-河内周边省份-OIT部署和维护服务(24小时上门或远程服务)
服务介绍:http://www.onlyit.cn/onlyit_service.html
|
|
fwj3861 [个人空间] QQ名 越南-叶子(121305301)
   注册  2010-09-09 发贴数 579 精华贴 10 原创贴 20 来自 越南 状态 正常
级别 贵宾 |
|
|
【2022.11.15更新】 1.更新了【非管理员权限用户】查看所有在线的下级用户的登录信息 2.在线用户信息显示内容添加了【组织架构】和【操作员备注】信息 实现原理: 借鉴【十二个耳环】老师指点的在线用户ID的拼接写法,从数据库提取在线用户的下级用户ID之后和登录用户ID拼接在一起作为【登录信息】和【操作员明细】这2个表的用户ID限制条件即可 sql="select p.rela_user_id as 下级用户,a.user_id as 用户账户 from mup_login_log as a,mup_user_rela p"; sql=sql+" where login_time = (select max(login_time) from mup_login_log as b where b.user_id = a.user_id) and p.user_id = a.user_id and a.user_id ='"+ uid +"'"; sql=sql+" and p.rela_user_id in("+ userIds +")"; db_run_query_thr(sql) count = db_row_count() relauserids=""; for(i=0;i<count;i++); { db_go_row(i) relauserid = db_res(0) if(relauserids=="") { relauserids="'"+uid+"','"+relauserid+"'"; } else { relauserids=relauserids+",'"+relauserid+"'"; } }; 参考下列脚本文件或导入附件脚本文件 1.【在线用户】脚本文件 int test() { return 1; }; int main() { int i,yhsl,count,j; string sql,yhbh,userIds,uid,relauserid,relauserids; uid = get_user_id() get_online_user(); yhsl = db_row_count() userIds=""; for(i=0;i<yhsl;i++); { db_go_row(i) yhbh = db_res(0) if(userIds=="") { userIds="'"+yhbh+"'"; } else { userIds=userIds+",'"+yhbh+"'"; } }; if(is_super_user() == '1') { sql="select p.unit_id as 组织架构,a.user_id as 用户账号,a.user_name as 用户名称,a.ip as 登录电脑名和IP,a.machine_id as 登录电脑机器标识,"; sql=sql+"substring(a.login_time,0,9) as 登录日期,substring(a.login_time,9,15) as 登录时刻,p.note_info as 用户备注 from mup_login_log as a,mup_user p"; sql=sql+" where login_time = (select max(login_time) from mup_login_log as b where b.user_id = a.user_id) and p.user_id = a.user_id and a.user_id in("+ userIds +")"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(5),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(6),"hh:mi:ss")) db_map("mup_unit","组织架构","组织架构"); }; db_show('【在线用户】登录信息') }; sql="select p.rela_user_id as 下级用户,a.user_id as 用户账户 from mup_login_log as a,mup_user_rela p"; sql=sql+" where login_time = (select max(login_time) from mup_login_log as b where b.user_id = a.user_id) and p.user_id = a.user_id and a.user_id ='"+ uid +"'"; sql=sql+" and p.rela_user_id in("+ userIds +")"; db_run_query_thr(sql) count = db_row_count() relauserids=""; for(i=0;i<count;i++); { db_go_row(i) relauserid = db_res(0) if(relauserids=="") { relauserids="'"+uid+"','"+relauserid+"'"; } else { relauserids=relauserids+",'"+relauserid+"'"; } }; if(is_super_user() == '0') { sql="select p.unit_id as 组织架构,a.user_id as 用户账号,a.user_name as 用户名称,a.ip as 登录电脑名和IP,a.machine_id as 登录电脑机器标识,"; sql=sql+"substring(a.login_time,0,9) as 登录日期,substring(a.login_time,9,15) as 登录时刻,p.note_info as 用户备注 from mup_login_log as a,mup_user p"; sql=sql+" where login_time = (select max(login_time) from mup_login_log as b where b.user_id = a.user_id) and p.user_id = a.user_id and a.user_id in("+ relauserids +")"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(5),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(6),"hh:mi:ss")) db_map("mup_unit","组织架构","组织架构"); }; db_show('【本次登录】和【下级用户登录】信息') }; // msg('hello,world'); return 1; }; 2.【今日登录】脚本文件 int test() { return 1;}; int main() { int i,yhsl,count,j; string sql,dlrq,yhbh,userIds,uid,relauserid,relauserids; dlrq = get_serv_date() + '%' uid = get_user_id() get_online_user(); yhsl = db_row_count() userIds=""; for(i=0;i<yhsl;i++); { db_go_row(i) yhbh = db_res(0) if(userIds=="") { userIds="'"+yhbh+"'"; } else { userIds=userIds+",'"+yhbh+"'"; } }; if(is_super_user() == '1') { sql="select p.unit_id as 组织架构,a.user_id as 用户账号,a.user_name as 用户名称,a.ip as 登录电脑名和IP,a.machine_id as 登录电脑机器标识,"; sql=sql+"substring(a.login_time,0,9) as 登录日期,substring(a.login_time,9,15) as 登录时刻,p.note_info as 用户备注 from mup_login_log as a,mup_user p"; sql=sql+" where a.login_time like '"+dlrq+"' and p.user_id = a.user_id and a.user_id in("+ userIds +") order by a.user_id,a.login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(5),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(6),"hh:mi:ss")) db_map("mup_unit","组织架构","组织架构"); }; db_show('在线用户【今日登录】信息') }; sql="select p.rela_user_id as 下级用户,a.user_id as 用户账户 from mup_login_log as a,mup_user_rela p"; sql=sql+" where login_time = (select max(login_time) from mup_login_log as b where b.user_id = a.user_id) and p.user_id = a.user_id and a.user_id ='"+ uid +"'"; sql=sql+" and p.rela_user_id in("+ userIds +")"; db_run_query_thr(sql) count = db_row_count() relauserids=""; for(i=0;i<count;i++); { db_go_row(i) relauserid = db_res(0) if(relauserids=="") { relauserids="'"+uid+"','"+relauserid+"'"; } else { relauserids=relauserids+",'"+relauserid+"'"; } }; if(is_super_user() == '0') {sql="select p.unit_id as 组织架构,a.user_id as 用户账号,a.user_name as 用户名称,a.ip as 登录电脑名和IP,a.machine_id as 登录电脑机器标识,"; sql=sql+"substring(a.login_time,0,9) as 登录日期,substring(a.login_time,9,15) as 登录时刻,p.note_info as 用户备注 from mup_login_log as a,mup_user p"; sql=sql+" where a.login_time like '"+dlrq+"' and p.user_id = a.user_id and a.user_id in("+ relauserids +") order by a.user_id,a.login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(5),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(6),"hh:mi:ss")) db_map("mup_unit","组织架构","组织架构"); }; db_show('【今日登录】信息') }; // msg('hello,world'); return 1; }; 3.【本周登录】脚本文件 int test() { return 1; }; int main() { int i,yhsl,count,j; string sql,sql2,yhbh,userIds,uid,dlrq,xq,xqs,xq2,xq3,xq4,xq5,xq6,xq7,relauserid,relauserids; xqs = get_week_id(get_serv_date()) xq2 = get_last_date(get_serv_date()) xq3 = get_last_date(xq2) xq4 = get_last_date(xq3) xq5 = get_last_date(xq4) xq6 = get_last_date(xq5) xq7 = get_last_date(xq6) if(xqs == '1'){ dlrq = get_serv_date() }if(xqs == '2'){ dlrq = xq2 }if(xqs == '3'){ dlrq = xq3 }if(xqs == '4'){ dlrq = xq4 }if(xqs == '5'){ dlrq = xq5 }if(xqs == '6'){ dlrq = xq6 }if(xqs == '7'){ dlrq = xq7 }; uid = get_user_id() get_online_user(); yhsl = db_row_count() userIds=""; for(i=0;i<yhsl;i++); { db_go_row(i) yhbh = db_res(0) if(userIds=="") { userIds="'"+yhbh+"'"; } else { userIds=userIds+",'"+yhbh+"'"; } }; if(is_super_user() == '1') { sql="select p.unit_id as 组织架构,a.user_id as 用户账号,a.user_name as 用户名称,a.ip as 登录电脑名和IP,a.machine_id as 登录电脑机器标识,"; sql=sql+"substring(a.login_time,0,9) as 登录日期,substring(a.login_time,9,15) as 登录时刻,p.note_info as 用户备注 from mup_login_log as a,mup_user p"; sql=sql+" where a.login_time >= '"+dlrq+"' and p.user_id = a.user_id and a.user_id in("+ userIds +") order by a.user_id,a.login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(5),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(6),"hh:mi:ss")) db_map("mup_unit","组织架构","组织架构"); }; db_show('在线用户【最近一周登录】信息') }; sql="select p.rela_user_id as 下级用户,a.user_id as 用户账户 from mup_login_log as a,mup_user_rela p"; sql=sql+" where login_time = (select max(login_time) from mup_login_log as b where b.user_id = a.user_id) and p.user_id = a.user_id and a.user_id ='"+ uid +"'"; sql=sql+" and p.rela_user_id in("+ userIds +")"; db_run_query_thr(sql) count = db_row_count() relauserids=""; for(i=0;i<count;i++); { db_go_row(i) relauserid = db_res(0) if(relauserids=="") { relauserids="'"+uid+"','"+relauserid+"'"; } else { relauserids=relauserids+",'"+relauserid+"'"; } }; if(is_super_user() == '0') { sql="select p.unit_id as 组织架构,a.user_id as 用户账号,a.user_name as 用户名称,a.ip as 登录电脑名和IP,a.machine_id as 登录电脑机器标识,"; sql=sql+"substring(a.login_time,0,9) as 登录日期,substring(a.login_time,9,15) as 登录时刻,p.note_info as 用户备注 from mup_login_log as a,mup_user p"; sql=sql+" where a.login_time >= '"+dlrq+"' and p.user_id = a.user_id and a.user_id in("+ relauserids +") order by a.user_id,a.login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(5),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(6),"hh:mi:ss")) db_map("mup_unit","组织架构","组织架构"); }; db_show('【最近一周登录】信息') }; // msg('hello,world'); return 1; }; 4.【本月登录】脚本文件 int test() { return 1; }; int main() { int i,yhsl,count,j; string sql,dlrq,yhbh,userIds,uid,relauserid,relauserids; dlrq = get_cur_month()+'01' uid = get_user_id() get_online_user(); yhsl = db_row_count() userIds=""; for(i=0;i<yhsl;i++); { db_go_row(i) yhbh = db_res(0) if(userIds=="") { userIds="'"+yhbh+"'"; } else { userIds=userIds+",'"+yhbh+"'"; } }; if(is_super_user() == '1') { sql="select p.unit_id as 组织架构,a.user_id as 用户账号,a.user_name as 用户名称,a.ip as 登录电脑名和IP,a.machine_id as 登录电脑机器标识,"; sql=sql+"substring(a.login_time,0,9) as 登录日期,substring(a.login_time,9,15) as 登录时刻,p.note_info as 用户备注 from mup_login_log as a,mup_user p"; sql=sql+" where a.login_time >= '"+dlrq+"' and p.user_id = a.user_id and a.user_id in("+ userIds +") order by a.user_id,a.login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(5),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(6),"hh:mi:ss")) db_map("mup_unit","组织架构","组织架构"); }; db_show('在线用户【本月登录】信息') }; sql="select p.rela_user_id as 下级用户,a.user_id as 用户账户 from mup_login_log as a,mup_user_rela p"; sql=sql+" where login_time = (select max(login_time) from mup_login_log as b where b.user_id = a.user_id) and p.user_id = a.user_id and a.user_id ='"+ uid +"'"; sql=sql+" and p.rela_user_id in("+ userIds +")"; db_run_query_thr(sql) count = db_row_count() relauserids=""; for(i=0;i<count;i++); { db_go_row(i) relauserid = db_res(0) if(relauserids=="") { relauserids="'"+uid+"','"+relauserid+"'"; } else { relauserids=relauserids+",'"+relauserid+"'"; } }; if(is_super_user() == '0') { sql="select p.unit_id as 组织架构,a.user_id as 用户账号,a.user_name as 用户名称,a.ip as 登录电脑名和IP,a.machine_id as 登录电脑机器标识,"; sql=sql+"substring(a.login_time,0,9) as 登录日期,substring(a.login_time,9,15) as 登录时刻,p.note_info as 用户备注 from mup_login_log as a,mup_user p"; sql=sql+" where a.login_time >= '"+dlrq+"' and p.user_id = a.user_id and a.user_id in("+ relauserids +") order by a.user_id,a.login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(5),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(6),"hh:mi:ss")) db_map("mup_unit","组织架构","组织架构"); }; db_show('【本月登录】信息') }; // msg('hello,world'); return 1; }; 5.【一周登录】脚本文件 int test() { return 1; }; int main() { int i,yhsl,count,j; string sql,dlrq,yhbh,userIds,uid,relauserid,relauserids; dlrq = get_last_date(get_last_date(get_last_date(get_last_date(get_last_date(get_last_date(get_serv_date())))))) uid = get_user_id() get_online_user(); yhsl = db_row_count() userIds=""; for(i=0;i<yhsl;i++); { db_go_row(i) yhbh = db_res(0) if(userIds=="") { userIds="'"+yhbh+"'"; } else { userIds=userIds+",'"+yhbh+"'"; } }; if(is_super_user() == '1') { sql="select p.unit_id as 组织架构,a.user_id as 用户账号,a.user_name as 用户名称,a.ip as 登录电脑名和IP,a.machine_id as 登录电脑机器标识,"; sql=sql+"substring(a.login_time,0,9) as 登录日期,substring(a.login_time,9,15) as 登录时刻,p.note_info as 用户备注 from mup_login_log as a,mup_user p"; sql=sql+" where a.login_time >= '"+dlrq+"' and p.user_id = a.user_id and a.user_id in("+ userIds +") order by a.user_id,a.login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(5),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(6),"hh:mi:ss")) db_map("mup_unit","组织架构","组织架构"); }; db_show('在线用户【本周登录】信息') }; sql="select p.rela_user_id as 下级用户,a.user_id as 用户账户 from mup_login_log as a,mup_user_rela p"; sql=sql+" where login_time = (select max(login_time) from mup_login_log as b where b.user_id = a.user_id) and p.user_id = a.user_id and a.user_id ='"+ uid +"'"; sql=sql+" and p.rela_user_id in("+ userIds +")"; db_run_query_thr(sql) count = db_row_count() relauserids=""; for(i=0;i<count;i++); { db_go_row(i) relauserid = db_res(0) if(relauserids=="") { relauserids="'"+uid+"','"+relauserid+"'"; } else { relauserids=relauserids+",'"+relauserid+"'"; } }; if(is_super_user() == '0') { sql="select p.unit_id as 组织架构,a.user_id as 用户账号,a.user_name as 用户名称,a.ip as 登录电脑名和IP,a.machine_id as 登录电脑机器标识,"; sql=sql+"substring(a.login_time,0,9) as 登录日期,substring(a.login_time,9,15) as 登录时刻,p.note_info as 用户备注 from mup_login_log as a,mup_user p"; sql=sql+" where a.login_time >= '"+dlrq+"' and p.user_id = a.user_id and a.user_id in("+ relauserids +") order by a.user_id,a.login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(5),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(6),"hh:mi:ss")) db_map("mup_unit","组织架构","组织架构"); }; db_show('【本周登录】信息') }; // msg('hello,world'); return 1; }; 6.【30天登录】脚本文件 int test() { return 1; }; int main() { int i,yhsl,count,j; string sql,dlrq,yhbh,userIds,uid,relauserid,relauserids; dlrq = get_last_date(date_add(get_cur_date_std(),-29)) uid = get_user_id() get_online_user(); yhsl = db_row_count() userIds=""; for(i=0;i<yhsl;i++); { db_go_row(i) yhbh = db_res(0) if(userIds=="") { userIds="'"+yhbh+"'"; } else { userIds=userIds+",'"+yhbh+"'"; } }; if(is_super_user() == '1') { sql="select p.unit_id as 组织架构,a.user_id as 用户账号,a.user_name as 用户名称,a.ip as 登录电脑名和IP,a.machine_id as 登录电脑机器标识,"; sql=sql+"substring(a.login_time,0,9) as 登录日期,substring(a.login_time,9,15) as 登录时刻,p.note_info as 用户备注 from mup_login_log as a,mup_user p"; sql=sql+" where a.login_time >= '"+dlrq+"' and p.user_id = a.user_id and a.user_id in("+ userIds +") order by a.user_id,a.login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(5),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(6),"hh:mi:ss")) db_map("mup_unit","组织架构","组织架构"); }; db_show('在线用户【最近30天登录】信息') }; sql="select p.rela_user_id as 下级用户,a.user_id as 用户账户 from mup_login_log as a,mup_user_rela p"; sql=sql+" where login_time = (select max(login_time) from mup_login_log as b where b.user_id = a.user_id) and p.user_id = a.user_id and a.user_id ='"+ uid +"'"; sql=sql+" and p.rela_user_id in("+ userIds +")"; db_run_query_thr(sql) count = db_row_count() relauserids=""; for(i=0;i<count;i++); { db_go_row(i) relauserid = db_res(0) if(relauserids=="") { relauserids="'"+uid+"','"+relauserid+"'"; } else { relauserids=relauserids+",'"+relauserid+"'"; } }; if(is_super_user() == '0') { sql="select p.unit_id as 组织架构,a.user_id as 用户账号,a.user_name as 用户名称,a.ip as 登录电脑名和IP,a.machine_id as 登录电脑机器标识,"; sql=sql+"substring(a.login_time,0,9) as 登录日期,substring(a.login_time,9,15) as 登录时刻,p.note_info as 用户备注 from mup_login_log as a,mup_user p"; sql=sql+" where a.login_time >= '"+dlrq+"' and p.user_id = a.user_id and a.user_id in("+ relauserids +") order by a.user_id,a.login_time asc"; db_run_query_thr(sql) count = db_row_count() for(j=0;j<count;j++); { db_go_row(j) db_add_field('登录日期') db_set_value_ext('登录日期', fmt_date(db_res(5),"yyyy年mm月dd日")) db_add_field('登录时刻') db_set_value_ext('登录时刻', fmt_date(db_res(6),"hh:mi:ss")) db_map("mup_unit","组织架构","组织架构"); }; db_show('【最近30天登录】信息') }; // msg('hello,world'); return 1; }; |
|
 |
于 2022-11-15 17:39 被 fwj3861 修改

官方认证第三方服务团队 (越南-叶子) QQ:121305301 TEL:+84869350626
承接越南北部-河内周边省份-OIT部署和维护服务(24小时上门或远程服务)
服务介绍:http://www.onlyit.cn/onlyit_service.html
|
|
fwj3861 [个人空间] QQ名 越南-叶子(121305301)
   注册  2010-09-09 发贴数 579 精华贴 10 原创贴 20 来自 越南 状态 正常
级别 贵宾 |
|
fwj3861 [个人空间] QQ名 越南-叶子(121305301)
   注册  2010-09-09 发贴数 579 精华贴 10 原创贴 20 来自 越南 状态 正常
级别 贵宾 |
|
fwj3861 [个人空间] QQ名 越南-叶子(121305301)
   注册  2010-09-09 发贴数 579 精华贴 10 原创贴 20 来自 越南 状态 正常
级别 贵宾 |
|
ihr2013 [个人空间]
    注册  2013-05-01 发贴数 459 精华数 0 原创贴 0 来自 状态 正常
级别 会员 |
|
fwj3861 [个人空间] QQ名 越南-叶子(121305301)
   注册  2010-09-09 发贴数 579 精华贴 10 原创贴 20 来自 越南 状态 正常
级别 贵宾 |
|
|
管理员权限用户查看所有在线用户,公司领导或部门领导查看下属在线,不用到小秘书那里去看在线用户,是否用得上,因人而异 |
|
|

官方认证第三方服务团队 (越南-叶子) QQ:121305301 TEL:+84869350626
承接越南北部-河内周边省份-OIT部署和维护服务(24小时上门或远程服务)
服务介绍:http://www.onlyit.cn/onlyit_service.html
|
|
|