From 98235ec76fe8f05fee4afe3f21131fa9ea51998f Mon Sep 17 00:00:00 2001 From: mattf Date: Thu, 22 Sep 2022 13:24:27 +0000 Subject: [PATCH] Added more "XDAY" options to add_lead duplicate checks in the Non-Agent API Added more failed login details for level 9 users to User Modify page Added User Logins Report Added webserver/URL logins section to User Stats report for level 9 users Added more failed login logging in user_authorization function.php scripts Added more failed login reason messages display to timeclock.php Added vicidial_user_logins_daily TEOD population to ADMIN keepalive script git-svn-id: svn://192.168.202.10@3642 3d104415-ff17-0410-8863-d5cf3c621b8a --- bin/ADMIN_keepalive_ALL.pl | 29 +- bin/AST_flush_DBqueue.pl | 17 +- docs/NON-AGENT_API.txt | 5 +- extras/MySQL_AST_CREATE_tables.sql | 21 +- extras/upgrade_2.14.sql | 21 ++ www/VERM/functions.php | 16 +- www/agc/functions.php | 22 +- www/agc/timeclock.php | 23 +- www/chat_customer/functions.php | 22 +- www/vicidial/admin.php | 30 ++- www/vicidial/functions.php | 18 +- www/vicidial/help_documentation.txt | 4 +- www/vicidial/non_agent_api.php | 15 +- www/vicidial/user_logins_report.php | 403 ++++++++++++++++++++++++++++ www/vicidial/user_stats.php | 62 ++++- 15 files changed, 672 insertions(+), 36 deletions(-) create mode 100644 www/vicidial/user_logins_report.php diff --git a/bin/ADMIN_keepalive_ALL.pl b/bin/ADMIN_keepalive_ALL.pl index 055bf772..0d5cc9a3 100644 --- a/bin/ADMIN_keepalive_ALL.pl +++ b/bin/ADMIN_keepalive_ALL.pl @@ -156,9 +156,10 @@ # 220310-0959 - Added purging of vicidial_sync_log table # 220312-0819 - Added CID Group Auto-Rotate to check for List use # 220526-1444 - Fix for CID auto-rotate functions +# 220921-1255 - Added vicidial_user_logins_daily TEOD population # -$build = '220526-1444'; +$build = '220921-1255'; $DB=0; # Debug flag $teodDB=0; # flag to log Timeclock End of Day processes to log file @@ -1668,6 +1669,32 @@ if ($timeclock_end_of_day_NOW > 0) if (!$Q) {print "$sthArows vicidial_inbound_groups rows closing_time_now_trigger value reset \n";} if ($teodDB) {$event_string = "$sthArows vicidial_inbound_groups rows closing_time_now_trigger value reset"; &teod_logger;} + # population of vicidial_user_logins_daily table and reset of vicidial_users table + if (!$Q) {print "\nProcessing vicidial_user_logins_daily/vicidial_users tables...\n";} + $stmtA = "INSERT IGNORE INTO vicidial_user_logins_daily(user,login_day,last_login_date,last_ip,failed_login_attempts_today,failed_login_count_today,failed_last_ip_today,failed_last_type_today) SELECT user,'$today_date',last_login_date,last_ip,failed_login_attempts_today,failed_login_count_today,failed_last_ip_today,failed_last_type_today from vicidial_users where last_login_date >= \"$RMSQLdate\";"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows = $sthA->rows; + $event_string = "$sthArows rows inserted into vicidial_user_logins_daily table"; + if (!$Q) {print "$event_string \n";} + if ($teodDB) {&teod_logger;} + + $rv = $sthA->err(); + if (!$rv) + { + $stmtA = "UPDATE vicidial_users SET failed_login_attempts_today=0,failed_login_count_today=0,failed_last_ip_today='',failed_last_type_today='';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows = $sthA->rows; + $event_string = "$sthArows rows reset in vicidial_users table"; + if (!$Q) {print "$event_string \n";} + if ($teodDB) {&teod_logger;} + + $stmtA = "optimize table vicidial_users;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + } + ##### BEGIN max stats end of day process ##### # set OPEN max stats records to CLOSING for processing $stmtA = "UPDATE vicidial_daily_max_stats SET stats_flag='CLOSING' where stats_flag='OPEN';"; diff --git a/bin/AST_flush_DBqueue.pl b/bin/AST_flush_DBqueue.pl index 324ac834..5464bf80 100644 --- a/bin/AST_flush_DBqueue.pl +++ b/bin/AST_flush_DBqueue.pl @@ -9,7 +9,7 @@ # !!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!! # THIS SCRIPT SHOULD ONLY BE RUN ON ONE SERVER ON YOUR CLUSTER # -# Copyright (C) 2019 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2022 Matt Florell LICENSE: AGPLv2 # # CHANGES # 60717-1214 - changed to DBI by Marin Blu @@ -30,6 +30,7 @@ # 190222-1321 - Added optional flushing of vicidial_sessions_recent table # 190503-1606 - Added flushing of vicidial_sip_event_recent table # 191029-1555 - Added flushing of vicidial_agent_vmm_overrides table +# 220921-1148 - Added optimize of vicidial_users table # $session_flush=0; @@ -457,6 +458,20 @@ if (!$T) if (!$Q) {print " - OPTIMIZE vicidial_inbound_groups \n";} +$stmtA = "OPTIMIZE table vicidial_users;"; +if($DB){print STDERR "\n|$stmtA|\n";} +if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } +if (!$Q) {print " - OPTIMIZE vicidial_users \n";} + + ### Gather active servers from the database $stmtA = "SELECT server_ip,server_id FROM servers where active='Y' and active_asterisk_server='Y';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; diff --git a/docs/NON-AGENT_API.txt b/docs/NON-AGENT_API.txt index b4a93593..9907a5db 100644 --- a/docs/NON-AGENT_API.txt +++ b/docs/NON-AGENT_API.txt @@ -1,4 +1,4 @@ -NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2022-09-02 +NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2022-09-20 This document describes the functions of an API(Application Programming Interface) for all functions NOT directly relating to the VICIDIAL Agent screen. @@ -203,6 +203,7 @@ Changes: 220307-0937 - Added 'update_presets' function 220310-0825 - Added DELETE action to the 'update_presets' function 220902-0823 - Added dial_status_add/dial_status_remove options to update_campaign function +220920-0814 - Added more "XDAY" options to add_lead duplicate checks API Functions use the 'function' variable @@ -1009,7 +1010,7 @@ duplicate_check - Check for duplicate records in the system, can select more tha DUPNAMEPHONELIST - check for duplicate first_name, last_name and phone_number in same list DUPNAMEPHONECAMP - check for duplicate first_name, last_name and phone_number in all lists for this list's campaign DUPNAMEPHONESYS - check for duplicate first_name, last_name and phone_number in entire system - " 30/60/90/180/360DAY - Added to one of the above duplicate checks(i.e. "DUPSYS90DAY"), only checks leads loaded in last 90 days + " 1/2/3/7/14/15/21/28/30/60/90/180/360DAY - Added to one of the above duplicate checks(i.e. "DUPSYS90DAY"), only checks leads loaded in last 90 days usacan_prefix_check - Y or N, default is N. Check for a valid 4th digit for USA and Canada phone numbers (cannot be 0 or 1) usacan_areacode_check - Y or N, default is N. Check for a valid areacode for USA and Canada phone numbers(also checks for 10-digit length) nanpa_ac_prefix_check - Y or N, default is N. Check for a valid NANPA areacode and prefix, if optional NANPA data is on the system diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 79a7d00f..cda7e35a 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -696,7 +696,11 @@ two_factor_override ENUM('NOT_ACTIVE','ENABLED','DISABLED') default 'NOT_ACTIVE manual_dial_filter VARCHAR(50) default 'DISABLED', user_location VARCHAR(100) default '', download_invalid_files ENUM('0','1') default '0', -user_group_two VARCHAR(20) default '' +user_group_two VARCHAR(20) default '', +failed_login_attempts_today MEDIUMINT(8) UNSIGNED default '0', +failed_login_count_today SMALLINT(6) UNSIGNED default '0', +failed_last_ip_today VARCHAR(50) default '', +failed_last_type_today VARCHAR(20) default '' ) ENGINE=MyISAM; CREATE UNIQUE INDEX user ON vicidial_users (user); @@ -4795,6 +4799,18 @@ CREATE TABLE `wallboard_reports` ( PRIMARY KEY (`wallboard_report_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +CREATE TABLE vicidial_user_logins_daily ( +user VARCHAR(20), +login_day DATE, +last_login_date DATETIME default '2001-01-01 00:00:01', +last_ip VARCHAR(50) default '', +failed_login_attempts_today MEDIUMINT(8) UNSIGNED default '0', +failed_login_count_today SMALLINT(6) UNSIGNED default '0', +failed_last_ip_today VARCHAR(50) default '', +failed_last_type_today VARCHAR(20) default '', +index (user) +) ENGINE=MyISAM; + ALTER TABLE vicidial_email_list MODIFY message text character set utf8; @@ -4936,6 +4952,7 @@ CREATE INDEX comment_a on live_inbound_log (comment_a); CREATE UNIQUE INDEX vicidial_campaign_statuses_key on vicidial_campaign_statuses(status, campaign_id); CREATE INDEX vlecc on vicidial_log_extended (caller_code); CREATE UNIQUE INDEX vvmmcount on vicidial_vmm_counts (lead_id,call_date); +CREATE UNIQUE INDEX vicidial_user_logins_daily_user on vicidial_user_logins_daily(login_day, user); CREATE INDEX vlali on vicidial_live_agents (lead_id); CREATE INDEX vlaus on vicidial_live_agents (user); @@ -5149,4 +5166,4 @@ INSERT INTO `wallboard_reports` VALUES ('AGENTS_AND_QUEUES','Agents and Queues', UPDATE system_settings set vdc_agent_api_active='1'; -UPDATE system_settings SET db_schema_version='1666',db_schema_update_date=NOW(),reload_timestamp=NOW(); +UPDATE system_settings SET db_schema_version='1667',db_schema_update_date=NOW(),reload_timestamp=NOW(); diff --git a/extras/upgrade_2.14.sql b/extras/upgrade_2.14.sql index c34f45d5..92cda557 100644 --- a/extras/upgrade_2.14.sql +++ b/extras/upgrade_2.14.sql @@ -2018,3 +2018,24 @@ ALTER TABLE vicidial_user_groups ADD script_id VARCHAR(20) default ''; ALTER TABLE vicidial_campaigns ADD user_group_script ENUM('DISABLED','ENABLED') default 'DISABLED'; UPDATE system_settings SET db_schema_version='1666',db_schema_update_date=NOW() where db_schema_version < 1666; + +ALTER TABLE vicidial_users ADD failed_login_attempts_today MEDIUMINT(8) UNSIGNED default '0'; +ALTER TABLE vicidial_users ADD failed_login_count_today SMALLINT(6) UNSIGNED default '0'; +ALTER TABLE vicidial_users ADD failed_last_ip_today VARCHAR(50) default ''; +ALTER TABLE vicidial_users ADD failed_last_type_today VARCHAR(20) default ''; + +CREATE TABLE vicidial_user_logins_daily ( +user VARCHAR(20), +login_day DATE, +last_login_date DATETIME default '2001-01-01 00:00:01', +last_ip VARCHAR(50) default '', +failed_login_attempts_today MEDIUMINT(8) UNSIGNED default '0', +failed_login_count_today SMALLINT(6) UNSIGNED default '0', +failed_last_ip_today VARCHAR(50) default '', +failed_last_type_today VARCHAR(20) default '', +index (user) +) ENGINE=MyISAM; + +CREATE UNIQUE INDEX vicidial_user_logins_daily_user on vicidial_user_logins_daily(login_day, user); + +UPDATE system_settings SET db_schema_version='1667',db_schema_update_date=NOW() where db_schema_version < 1667; diff --git a/www/VERM/functions.php b/www/VERM/functions.php index bf8262f8..6e156fea 100644 --- a/www/VERM/functions.php +++ b/www/VERM/functions.php @@ -40,6 +40,7 @@ # 210406-1740 - Moved 'dialable_leads' function to this script # 210615-0952 - Default security fix, CVE-2021-28854 # 220827-1943 - VERM version +# 220921-1224 - Added more failed login logging in user_authorization function # ##### BEGIN validate user login credentials, check for failed lock out ##### @@ -121,18 +122,22 @@ function user_authorization($user,$pass,$user_option,$user_update,$api_call) if ($failed_login_count < $LOCK_trigger_attempts) { - $stmt="UPDATE vicidial_users set failed_login_count=(failed_login_count+1),last_ip='$ip' where user='$user';"; + $stmt="UPDATE vicidial_users set failed_login_count=(failed_login_count+1),failed_login_attempts_today=(failed_login_attempts_today+1),failed_login_count_today=(failed_login_count_today+1),failed_last_ip_today='$ip',failed_last_type_today='vBAD' where user='$user';"; $rslt=mysql_to_mysqli($stmt, $link); } else { if ($LOCK_over > $last_login_date) { - $stmt="UPDATE vicidial_users set last_login_date=NOW(),failed_login_count=1,last_ip='$ip' where user='$user';"; + $stmt="UPDATE vicidial_users set last_login_date=NOW(),failed_login_count=1,failed_last_ip_today='$ip',failed_login_attempts_today=(failed_login_attempts_today+1),failed_login_count_today=(failed_login_count_today+1),failed_last_type_today='vBAD' where user='$user';"; $rslt=mysql_to_mysqli($stmt, $link); } else - {$auth_key='LOCK';} + { + $auth_key='LOCK'; + $stmt="UPDATE vicidial_users set failed_login_attempts_today=(failed_login_attempts_today+1),failed_last_type_today='vLOCK' where user='$user';"; + $rslt=mysql_to_mysqli($stmt, $link); + } } } if ($SSwebroot_writable > 0) @@ -257,6 +262,11 @@ function user_authorization($user,$pass,$user_option,$user_update,$api_call) } } } + else + { + $stmt="UPDATE vicidial_users set failed_login_attempts_today=(failed_login_attempts_today+1),failed_last_type_today='v$auth_key' where user='$user';"; + $rslt=mysql_to_mysqli($stmt, $link); + } } return $auth_key; } diff --git a/www/agc/functions.php b/www/agc/functions.php index e13ac097..9def29de 100644 --- a/www/agc/functions.php +++ b/www/agc/functions.php @@ -4,7 +4,7 @@ # # functions for agent scripts # -# Copyright (C) 2021 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2022 Matt Florell LICENSE: AGPLv2 # # # CHANGES: @@ -56,9 +56,10 @@ # 210404-0902 - Added function to refresh a single field # 210603-1616 - Fix for specific custom field values with a slash in them # 210615-1032 - Default security fixes, CVE-2021-28854 +# 220921-1204 - Added more failed login logging in user_authorization function # -# $mysql_queries = 26 +# $mysql_queries = 28 ##### BEGIN validate user login credentials, check for failed lock out ##### function user_authorization($user,$pass,$user_option,$user_update,$bcrypt,$return_hash,$api_call,$source) @@ -138,7 +139,7 @@ function user_authorization($user,$pass,$user_option,$user_update,$bcrypt,$retur if ($failed_login_count < $LOCK_trigger_attempts) { - $stmt="UPDATE vicidial_users set failed_login_count=(failed_login_count+1),last_ip='$ip' where user='$user';"; + $stmt="UPDATE vicidial_users set failed_login_count=(failed_login_count+1),failed_login_attempts_today=(failed_login_attempts_today+1),failed_login_count_today=(failed_login_count_today+1),failed_last_ip_today='$ip',failed_last_type_today='cBAD' where user='$user';"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05011',$user,$server_ip,$session_name,$one_mysql_log);} } @@ -146,12 +147,17 @@ function user_authorization($user,$pass,$user_option,$user_update,$bcrypt,$retur { if ($LOCK_over > $last_login_date) { - $stmt="UPDATE vicidial_users set last_login_date=NOW(),failed_login_count=1,last_ip='$ip' where user='$user';"; + $stmt="UPDATE vicidial_users set last_login_date=NOW(),failed_login_count=1,failed_last_ip_today='$ip',failed_login_attempts_today=(failed_login_attempts_today+1),failed_login_count_today=(failed_login_count_today+1),failed_last_type_today='cBAD' where user='$user';"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05012',$user,$server_ip,$session_name,$one_mysql_log);} } else - {$auth_key='LOCK';} + { + $auth_key='LOCK'; + $stmt="UPDATE vicidial_users set failed_login_attempts_today=(failed_login_attempts_today+1),failed_last_type_today='cLOCK' where user='$user';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05027',$user,$server_ip,$session_name,$one_mysql_log);} + } } } if ($SSwebroot_writable > 0) @@ -322,6 +328,12 @@ function user_authorization($user,$pass,$user_option,$user_update,$bcrypt,$retur if ( ($return_hash == '1') and ($SSpass_hash_enabled > 0) and (strlen($pass_hash) > 12) ) {$auth_key .= "|$pass_hash";} } + else + { + $stmt="UPDATE vicidial_users set failed_login_attempts_today=(failed_login_attempts_today+1),failed_last_type_today='c$auth_key' where user='$user';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05028',$user,$server_ip,$session_name,$one_mysql_log);} + } } return $auth_key; } diff --git a/www/agc/timeclock.php b/www/agc/timeclock.php index a87a3d96..1f111150 100644 --- a/www/agc/timeclock.php +++ b/www/agc/timeclock.php @@ -26,10 +26,11 @@ # 201117-2117 - Changes for better compatibility with non-latin data input # 210616-2101 - Added optional CORS support, see options.php for details # 220220-0934 - Added allow_web_debug system setting +# 220921-1702 - Added failed login reason messages # -$version = '2.14-21'; -$build = '220220-0934'; +$version = '2.14-22'; +$build = '220921-1702'; $php_script = 'timeclock.php'; $StarTtimE = date("U"); @@ -269,6 +270,24 @@ if ( ($stage == 'login') or ($stage == 'logout') ) { ### NOT A VALID USER/PASS $VDdisplayMESSAGE = _QXZ("The user and password you entered are not active in the system
Please try again:"); + if ($auth_message == 'LOCK') + {$VDdisplayMESSAGE = _QXZ("Too many login attempts, try again in 15 minutes")."
";} + if ($auth_message == 'ERRNETWORK') + {$VDdisplayMESSAGE = _QXZ("Too many network errors, please contact your administrator")."
";} + if ($auth_message == 'ERRSERVERS') + {$VDdisplayMESSAGE = _QXZ("No available servers, please contact your administrator")."
";} + if ($auth_message == 'ERRPHONES') + {$VDdisplayMESSAGE = _QXZ("No available phones, please contact your administrator")."
";} + if ($auth_message == 'ERRDUPLICATE') + {$VDdisplayMESSAGE = _QXZ("You are already logged in, please log out of your other session first")."
";} + if ($auth_message == 'ERRAGENTS') + {$VDdisplayMESSAGE = _QXZ("Too many agents logged in, please contact your administrator")."
";} + if ($auth_message == 'ERRCAMPAGENTS') + {$VDdisplayMESSAGE = _QXZ("Too many agents logged in to this campaign, please contact your manager")."
";} + if ($auth_message == 'ERRCASE') + {$VDdisplayMESSAGE = _QXZ("Login incorrect, user names are case sensitive")."
";} + if ($auth_message == 'IPBLOCK') + {$VDdisplayMESSAGE = _QXZ("Your IP Address is not allowed").": $ip
";} echo"\n"; echo""._QXZ("Agent Timeclock")."\n"; diff --git a/www/chat_customer/functions.php b/www/chat_customer/functions.php index 3c2f22c3..48e324b5 100644 --- a/www/chat_customer/functions.php +++ b/www/chat_customer/functions.php @@ -4,15 +4,16 @@ # # functions for agent scripts # -# Copyright (C) 2021 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2022 Matt Florell LICENSE: AGPLv2 # # # CHANGES: # 151212-0826 - First Build for customer chat, based on agc/functions.php # 210615-1044 - Default security fixes, CVE-2021-28854 +# 220921-1233 - Added more failed login logging in user_authorization function # -# $mysql_queries = 20 +# $mysql_queries = 22 ##### BEGIN validate user login credentials, check for failed lock out ##### function user_authorization($user,$pass,$user_option,$user_update,$bcrypt,$return_hash) @@ -90,7 +91,7 @@ function user_authorization($user,$pass,$user_option,$user_update,$bcrypt,$retur if ($failed_login_count < $LOCK_trigger_attempts) { - $stmt="UPDATE vicidial_users set failed_login_count=(failed_login_count+1),last_ip='$ip' where user='$user';"; + $stmt="UPDATE vicidial_users set failed_login_count=(failed_login_count+1),failed_login_attempts_today=(failed_login_attempts_today+1),failed_login_count_today=(failed_login_count_today+1),failed_last_ip_today='$ip',failed_last_type_today='hBAD' where user='$user';"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05011',$user,$server_ip,$session_name,$one_mysql_log);} } @@ -98,12 +99,17 @@ function user_authorization($user,$pass,$user_option,$user_update,$bcrypt,$retur { if ($LOCK_over > $last_login_date) { - $stmt="UPDATE vicidial_users set last_login_date=NOW(),failed_login_count=1,last_ip='$ip' where user='$user';"; + $stmt="UPDATE vicidial_users set last_login_date=NOW(),failed_login_count=1,failed_last_ip_today='$ip',failed_login_attempts_today=(failed_login_attempts_today+1),failed_login_count_today=(failed_login_count_today+1),failed_last_type_today='hBAD' where user='$user';"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05012',$user,$server_ip,$session_name,$one_mysql_log);} } else - {$auth_key='LOCK';} + { + $auth_key='LOCK'; + $stmt="UPDATE vicidial_users set failed_login_attempts_today=(failed_login_attempts_today+1),failed_last_type_today='hLOCK' where user='$user';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05021',$user,$server_ip,$session_name,$one_mysql_log);} + } } } if ($SSwebroot_writable > 0) @@ -200,6 +206,12 @@ function user_authorization($user,$pass,$user_option,$user_update,$bcrypt,$retur if ( ($return_hash == '1') and ($SSpass_hash_enabled > 0) and (strlen($pass_hash) > 12) ) {$auth_key .= "|$pass_hash";} } + else + { + $stmt="UPDATE vicidial_users set failed_login_attempts_today=(failed_login_attempts_today+1),failed_last_type_today='h$auth_key' where user='$user';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05022',$user,$server_ip,$session_name,$one_mysql_log);} + } } return $auth_key; } diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index 7b3b633e..1086fa33 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -125,9 +125,9 @@ $PHP_SELF = preg_replace('/\.php.*/i','.php',$PHP_SELF); $QUERY_STRING = getenv("QUERY_STRING"); $groups=array(); -$Vreports = 'NONE, Real-Time Main Report, Real-Time Campaign Summary, Real-Time Whiteboard Report, VERM Reports, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound DID Detail Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Callmenu Survey Report, Outbound Lead Source Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Carrier Log Report, Campaign Debug, Shared Debug, Asterisk Debug, Hangup Cause Report, Lists Pass Report, Called Counts List IDs Report, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report, AMD Log Report, SIP Event Report, Caller ID Log Report, Quality Control Report, Settings Compare, Phone Stats, Hopper List Report, In-Group User List, Webserver-URL Report, VDAD Debug Log Report, URL Log Report, Medialog Inventory Report, Asterisk Debug, SPH Report, Shared Debug, Process Report, Group Alias Report, Hangup Cause Report, IVR Filter Report, LAGGED Agent Log Report, Agent Disposition Report, Agent Performance Report, Carrier Log Report, Dial Log Report, Inbound Extension Stats, Agents Time On Calls, Callbacks Export'; +$Vreports = 'NONE, Real-Time Main Report, Real-Time Campaign Summary, Real-Time Whiteboard Report, VERM Reports, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound DID Detail Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Callmenu Survey Report, Outbound Lead Source Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Carrier Log Report, Campaign Debug, Shared Debug, Asterisk Debug, Hangup Cause Report, Lists Pass Report, Called Counts List IDs Report, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report, AMD Log Report, SIP Event Report, Caller ID Log Report, Quality Control Report, Settings Compare, Phone Stats, Hopper List Report, In-Group User List, Webserver-URL Report, VDAD Debug Log Report, URL Log Report, Medialog Inventory Report, Asterisk Debug, SPH Report, Shared Debug, Process Report, Group Alias Report, Hangup Cause Report, IVR Filter Report, LAGGED Agent Log Report, Agent Disposition Report, Agent Performance Report, Carrier Log Report, Dial Log Report, Inbound Extension Stats, Agents Time On Calls, Callbacks Export, User Logins Report'; -$UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summary, Real-Time Whiteboard Report, VERM Reports, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound DID Detail Report, Inbound Email Report, Inbound Chat Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Callmenu Survey Report, Outbound Lead Source Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Custom Reports Links, CallCard Search, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Lists Pass Report, Called Counts List IDs Report, Front Page System Summary, Report Page Servers Summary, Admin Utilities Page, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report, AMD Log Report, SIP Event Report, Caller ID Log Report, Quality Control Report, Settings Compare, Phone Stats, Hopper List Report, In-Group User List, Webserver-URL Report, VDAD Debug Log Report, URL Log Report, Medialog Inventory Report, Asterisk Debug, SPH Report, Shared Debug, Process Report, Group Alias Report, Hangup Cause Report, IVR Filter Report, LAGGED Agent Log Report, Agent Disposition Report, Agent Performance Report, Carrier Log Report, Dial Log Report, Inbound Extension Stats, Agents Time On Calls, Callbacks Export, VERM QA Links'; +$UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summary, Real-Time Whiteboard Report, VERM Reports, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound DID Detail Report, Inbound Email Report, Inbound Chat Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Callmenu Survey Report, Outbound Lead Source Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Custom Reports Links, CallCard Search, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Lists Pass Report, Called Counts List IDs Report, Front Page System Summary, Report Page Servers Summary, Admin Utilities Page, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report, AMD Log Report, SIP Event Report, Caller ID Log Report, Quality Control Report, Settings Compare, Phone Stats, Hopper List Report, In-Group User List, Webserver-URL Report, VDAD Debug Log Report, URL Log Report, Medialog Inventory Report, Asterisk Debug, SPH Report, Shared Debug, Process Report, Group Alias Report, Hangup Cause Report, IVR Filter Report, LAGGED Agent Log Report, Agent Disposition Report, Agent Performance Report, Carrier Log Report, Dial Log Report, Inbound Extension Stats, Agents Time On Calls, Callbacks Export, User Logins Report, VERM QA Links'; $Vtables = 'NONE,log_noanswer,did_agent_log,contact_information'; @@ -5933,12 +5933,13 @@ if ($SSscript_remove_js > 0) # 220827-0855 - Added BETA support for ConfBridge in Servers and Conferences # 220829-1036 - Added testing code for VERM(VICIdial Enhanced Reporting Module) # 220831-0850 - Added Campaign user_group_script override option, with User Group script option +# 220921-1319 - Added more User failed login details for level 9 users # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 to access this page the first time -$admin_version = '2.14-865a'; -$build = '220831-0850'; +$admin_version = '2.14-866a'; +$build = '220921-1319'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -24548,7 +24549,7 @@ if ($ADD==3) echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; $MAIN.="\n"; $MAIN.="\n"; + if ($LOGuser_level==9) + { + if ($total_logins%2==0) + {$url_bgcolor='bgcolor="#'. $SSstd_row2_background .'"';} + else + {$url_bgcolor='bgcolor="#'. $SSstd_row1_background .'"';} + + + $webserver_txt=""; + $url_txt=""; + if ($row[12]>0) + { + $webserver_stmt="select webserver, hostname from vicidial_webservers where webserver_id='$row[12]'"; + $webserver_rslt=mysql_to_mysqli($webserver_stmt, $link); + $webserver_row=mysqli_fetch_row($webserver_rslt); + $webserver_txt="$webserver_row[0] - $webserver_row[1]"; + $webserver_txt=preg_replace('/^\s\-\s|\s\-\s$/', '', $webserver_txt); + } + if ($row[13]>0) + { + $login_url_stmt="select url from vicidial_urls where url_id='$row[13]'"; + $login_url_rslt=mysql_to_mysqli($login_url_stmt, $link); + $login_url_row=mysqli_fetch_row($login_url_rslt); + $url_txt=trim("$login_url_row[0]"); + } + + $URL_MAIN.=""; + $URL_MAIN.="\n"; + $URL_MAIN.="\n"; + $URL_MAIN.="\n"; + $URL_MAIN.="\n"; + $URL_MAIN.="\n"; + $URL_MAIN.="\n"; + $URL_MAIN.="\n"; + $CSV_text15.="\"$row[2]\",\"$row[3]\",\"$row[4]\",\"$row[6]\",\"$webserver_txt\",\"$url_txt\"\n"; + } $MAIN.="\n"; $CSV_text2.="\"\",\"$row[0]\",$row[2]\",\"$row[3]\",\"$row[4]\",\"\",\"$row[5]\",\"$row[6]\",\"$row[7]\",\"$row[8]\",\"$row[9]\",\"$row[10]\"\n"; + + $total_logins++; } if (preg_match('/LOGOUT/', $row[0])) { @@ -873,6 +916,23 @@ else $MAIN.="
\n"; echo ""; - $stmt="SELECT user_id,user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,shift_override_flag,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five,voicemail_id,agent_call_log_view_override,callcard_admin,agent_choose_blended,realtime_block_user_info,custom_fields_modify,force_change_password,agent_lead_search_override,modify_shifts,modify_phones,modify_carriers,modify_labels,modify_statuses,modify_voicemail,modify_audiostore,modify_moh,modify_tts,preset_contact_search,modify_contacts,modify_same_user_level,admin_hide_lead_data,admin_hide_phone_data,agentcall_email,modify_email_accounts,failed_login_count,last_login_date,last_ip,alter_admin_interface_options,max_inbound_calls,modify_custom_dialplans,wrapup_seconds_override,modify_languages,selected_language,user_choose_language,ignore_group_on_search,api_list_restrict,api_allowed_functions,lead_filter_id,agentcall_chat,admin_cf_show_hidden,user_hide_realtime,access_recordings,modify_colors,user_nickname,user_new_lead_limit,api_only_user,modify_auto_reports,modify_ip_lists,ignore_ip_list,ready_max_logout,export_gdpr_leads,pause_code_approval,max_hopper_calls,max_hopper_calls_hour,mute_recordings,hide_call_log_info,next_dial_my_callbacks,user_admin_redirect_url,max_inbound_filter_enabled,max_inbound_filter_statuses,max_inbound_filter_ingroups,max_inbound_filter_min_sec,status_group_id,mobile_number,two_factor_override,manual_dial_filter,user_location,download_invalid_files,user_group_two from vicidial_users where user='$user' $LOGadmin_viewable_groupsSQL;"; + $stmt="SELECT user_id,user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,shift_override_flag,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five,voicemail_id,agent_call_log_view_override,callcard_admin,agent_choose_blended,realtime_block_user_info,custom_fields_modify,force_change_password,agent_lead_search_override,modify_shifts,modify_phones,modify_carriers,modify_labels,modify_statuses,modify_voicemail,modify_audiostore,modify_moh,modify_tts,preset_contact_search,modify_contacts,modify_same_user_level,admin_hide_lead_data,admin_hide_phone_data,agentcall_email,modify_email_accounts,failed_login_count,last_login_date,last_ip,alter_admin_interface_options,max_inbound_calls,modify_custom_dialplans,wrapup_seconds_override,modify_languages,selected_language,user_choose_language,ignore_group_on_search,api_list_restrict,api_allowed_functions,lead_filter_id,agentcall_chat,admin_cf_show_hidden,user_hide_realtime,access_recordings,modify_colors,user_nickname,user_new_lead_limit,api_only_user,modify_auto_reports,modify_ip_lists,ignore_ip_list,ready_max_logout,export_gdpr_leads,pause_code_approval,max_hopper_calls,max_hopper_calls_hour,mute_recordings,hide_call_log_info,next_dial_my_callbacks,user_admin_redirect_url,max_inbound_filter_enabled,max_inbound_filter_statuses,max_inbound_filter_ingroups,max_inbound_filter_min_sec,status_group_id,mobile_number,two_factor_override,manual_dial_filter,user_location,download_invalid_files,user_group_two,failed_login_attempts_today,failed_login_count_today,failed_last_ip_today,failed_last_type_today from vicidial_users where user='$user' $LOGadmin_viewable_groupsSQL;"; $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $user_id = $row[0]; @@ -24694,6 +24695,10 @@ if ($ADD==3) $user_location = $row[142]; $download_invalid_files=$row[143]; $user_group_two = $row[144]; + $failed_login_attempts_today=$row[145]; + $failed_login_count_today=$row[146]; + $failed_last_ip_today = $row[147]; + $failed_last_type_today=$row[148]; ##### latest 2FA auth record data $last_auth=''; @@ -24742,7 +24747,19 @@ if ($ADD==3) echo "
"._QXZ("Force Change Password").": $NWB#users-force_change_password$NWE
"._QXZ("Last Login Info").": $last_login_date - $failed_login_count - $last_ip $last_auth$NWB#users-last_login_date$NWE
"._QXZ("Last Login Info").": $last_login_date - $failed_login_count - $last_ip $last_auth$NWB#users-last_login_date$NWE   "; + if ($LOGuser_level > 8) + { + if ($failed_login_attempts_today > 0) + { + echo " "._QXZ("Failed logins today").": $failed_login_attempts_today - $failed_login_count_today - $failed_last_ip_today - $failed_last_type_today"; + } + else + { + echo " "._QXZ("Logins summary").""; + } + } + echo "
"._QXZ("Full Name").": $NWB#users-full_name$NWE
"._QXZ("User Level").":
"; +echo "
\n"; +echo "\n"; +echo "\n"; +if ( ($user != '--MOST-RECENT-ACTIVE-ARCHIVE--') and ($user != '--MOST-RECENT-ACTIVE-TODAY--') ) + {echo "           "._QXZ("MODIFY")." \n";} +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$user)
+	{
+	echo "\n\n";
+	echo _QXZ("PLEASE SELECT A USER ABOVE AND CLICK SUBMIT")."\n";
+	}
+
+else
+	{
+	$multi_user=0;
+	$stmt="select user,login_day,last_login_date,last_ip,failed_login_attempts_today,failed_login_count_today,failed_last_ip_today,failed_last_type_today from vicidial_user_logins_daily where user='" . mysqli_real_escape_string($link, $user) . "' order by login_day desc limit 1000;";
+	if ($user == '--MOST-RECENT-ACTIVE-ARCHIVE--')
+		{
+		$multi_user=1;
+		$stmt="select user,login_day,last_login_date,last_ip,failed_login_attempts_today,failed_login_count_today,failed_last_ip_today,failed_last_type_today from vicidial_user_logins_daily order by login_day desc, last_login_date desc limit 1000;";
+		}
+	if ($user == '--MOST-RECENT-ACTIVE-TODAY--')
+		{
+		$multi_user=1;
+		$stmt="select user,'TODAY',last_login_date,last_ip,failed_login_attempts_today,failed_login_count_today,failed_last_ip_today,failed_last_type_today from vicidial_users where last_login_date >= \"$last_midnight\" order by last_login_date desc limit 1000;";
+		}
+	$rslt=mysql_to_mysqli($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$shortages_to_print = mysqli_num_rows($rslt);
+	if ($shortages_to_print > 0)
+		{
+		echo _QXZ("User Logins Summary").":\n";
+		echo "| "._QXZ("USER", 20)." ! "._QXZ("LOG DATE", 10)." ! "._QXZ("LAST LOGIN DATE", 20)." ! "._QXZ("LAST IP", 20)." ! "._QXZ("FAIL ATMPT", 10)." ! "._QXZ("FAIL COUNT", 10)." ! "._QXZ("LAST FAIL IP", 20)." ! "._QXZ("LAST FAIL TYPE", 20)." |\n";
+		echo "+----------------------+------------+----------------------+----------------------+------------+------------+----------------------+----------------------+\n";
+		}
+	$i=0;   $archive_output='';
+	while ($shortages_to_print > $i)
+		{
+		$row=mysqli_fetch_row($rslt);
+
+		$archive_output .= "| ".sprintf("%-20s", $row[0])." |";
+		$archive_output .= " ".sprintf("%-10s", $row[1])." |";
+		$archive_output .= " ".sprintf("%-20s", $row[2])." |";
+		$archive_output .= " ".sprintf("%-20s", $row[3])." |";
+		$archive_output .= " ".sprintf("%-10s", $row[4])." |";
+		$archive_output .= " ".sprintf("%-10s", $row[5])." |";
+		$archive_output .= " ".sprintf("%-20s", $row[6])." |";
+		$archive_output .= " ".sprintf("%-20s", $row[7])." |\n";
+
+		$i++;
+		}
+	if ($multi_user < 1)
+		{
+		$stmt="select user,'TODAY',last_login_date,last_ip,failed_login_attempts_today,failed_login_count_today,failed_last_ip_today,failed_last_type_today from vicidial_users where user='" . mysqli_real_escape_string($link, $user) . "' and last_login_date >= \"$last_midnight\" order by last_login_date desc limit 1000;";
+		$rslt=mysql_to_mysqli($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$shortages_to_print = mysqli_num_rows($rslt);
+		$i=0;
+		while ($shortages_to_print > $i)
+			{
+			$row=mysqli_fetch_row($rslt);
+
+			echo "| ".sprintf("%-20s", $row[0])." |";
+			echo " ".sprintf("%-10s", $row[1])." |";
+			echo " ".sprintf("%-20s", $row[2])." |";
+			echo " ".sprintf("%-20s", $row[3])." |";
+			echo " ".sprintf("%-10s", $row[4])." |";
+			echo " ".sprintf("%-10s", $row[5])." |";
+			echo " ".sprintf("%-20s", $row[6])." |";
+			echo " ".sprintf("%-20s", $row[7])." |\n";
+
+			$i++;
+			}
+		}
+	echo $archive_output;
+	echo "\n";
+	}
+
+if ($db_source == 'S')
+	{
+	mysqli_close($link);
+	$use_slave_server=0;
+	$db_source = 'M';
+	require("dbconnect_mysqli.php");
+	}
+
+$endMS = microtime();
+$startMSary = explode(" ",$startMS);
+$endMSary = explode(" ",$endMS);
+$runS = ($endMSary[0] - $startMSary[0]);
+$runM = ($endMSary[1] - $startMSary[1]);
+$TOTALrun = ($runS + $runM);
+
+$stmt="UPDATE vicidial_report_log set run_time='$TOTALrun' where report_log_id='$report_log_id';";
+if ($DB) {echo "|$stmt|\n";}
+$rslt=mysql_to_mysqli($stmt, $link);
+
+?>
+
+
+ +
+ + diff --git a/www/vicidial/user_stats.php b/www/vicidial/user_stats.php index 17597064..70402a8d 100644 --- a/www/vicidial/user_stats.php +++ b/www/vicidial/user_stats.php @@ -67,6 +67,7 @@ # 220122-1701 - Added more variable filtering # 220221-0916 - Added allow_web_debug system setting # 220310-1427 - Fix for LOGOUT/LOGIN events sharing the same timedate +# 220916-1744 - Added reporting section for webserver/URL logins # $startMS = microtime(); @@ -789,11 +790,15 @@ else $CSV_text2.="\""._QXZ("Agent Login and Logout Time")."\"\n"; $CSV_text2.="\"\",\""._QXZ("EVENT")."\",\""._QXZ("DATE")."\",\""._QXZ("CAMPAIGN")."\",\""._QXZ("GROUP")."\",\""._QXZ("HOURS:MM:SS")."\",\""._QXZ("SESSION")."\",\""._QXZ("SERVER")."\",\""._QXZ("PHONE")."\",\""._QXZ("COMPUTER")."\",\""._QXZ("PHONE_LOGIN")."\",\""._QXZ("PHONE_IP")."\"\n"; - $stmt="SELECT event,event_epoch,event_date,campaign_id,user_group,session_id,server_ip,extension,computer_ip,phone_login,phone_ip,if(event='LOGOUT' or event='TIMEOUTLOGOUT', 1, 0) as LOGpriority from ".$vicidial_user_log_table." where user='" . mysqli_real_escape_string($link, $user) . "' and event_date >= '" . mysqli_real_escape_string($link, $begin_date) . " 0:00:01' and event_date <= '" . mysqli_real_escape_string($link, $end_date) . " 23:59:59' order by event_date, LOGpriority asc;"; + $CSV_text15.="\""._QXZ("Agent Webserver and URL Login Time")."\"\n"; + $CSV_text15.="\""._QXZ("DATE")."\",\""._QXZ("CAMPAIGN")."\",\""._QXZ("GROUP")."\",\""._QXZ("DIALER SERVER")."\",\""._QXZ("WEB SERVER")."\",\""._QXZ("LOGIN URL")."\"\n"; + + $stmt="SELECT event,event_epoch,event_date,campaign_id,user_group,session_id,server_ip,extension,computer_ip,phone_login,phone_ip,if(event='LOGOUT' or event='TIMEOUTLOGOUT', 1, 0) as LOGpriority, webserver, login_url from ".$vicidial_user_log_table." where user='" . mysqli_real_escape_string($link, $user) . "' and event_date >= '" . mysqli_real_escape_string($link, $begin_date) . " 0:00:01' and event_date <= '" . mysqli_real_escape_string($link, $end_date) . " 23:59:59' order by event_date, LOGpriority asc;"; $rslt=mysql_to_mysqli($stmt, $link); $events_to_print = mysqli_num_rows($rslt); $total_calls=0; + $total_logins=0; $o=0; $event_start_seconds=''; $event_stop_seconds=''; @@ -820,8 +825,46 @@ else $MAIN.="
$row[8] $row[9] $row[10]
$row[2] $row[3] $row[4] $row[6] ".(!$webserver_txt ? " " : "$webserver_txt")." ".(!$url_txt ? " " : "$url_txt")."
\n"; + + ##### webserver and url login records for user ##### + + if ($LOGuser_level==9) + { + $MAIN.="

\n"; + + $MAIN.="
\n"; + + $MAIN.=""._QXZ("Agent Webserver and URL Logins").": $NWB#user_stats-agent_webserver_url_logins$NWE      ["._QXZ("DOWNLOAD")."]\n"; + $MAIN.="\n"; + $MAIN.="\n"; + + $MAIN.=$URL_MAIN; + + $MAIN.="
"._QXZ("DATE")." "._QXZ("CAMPAIGN")." "._QXZ("GROUP").""._QXZ("DIALER SERVER").""._QXZ("WEB SERVER").""._QXZ("LOGIN URL")."
\n"; + }