LICENSE: GPLv2 ### # CHANGES # # 60619-1743 - Added variable filtering to eliminate SQL injection attack threat # header ("Content-type: text/html; charset=utf-8"); require("dbconnect.php"); $PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; $PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; $PHP_SELF=$_SERVER['PHP_SELF']; if (isset($_GET["begin_date"])) {$begin_date=$_GET["begin_date"];} elseif (isset($_POST["begin_date"])) {$begin_date=$_POST["begin_date"];} if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} if (isset($_GET["user"])) {$user=$_GET["user"];} elseif (isset($_POST["user"])) {$user=$_POST["user"];} if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];} elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} if (isset($_GET["submit"])) {$submit=$_GET["submit"];} elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); $STARTtime = date("U"); $TODAY = date("Y-m-d"); if (!isset($begin_date)) {$begin_date = $TODAY;} if (!isset($end_date)) {$end_date = $TODAY;} $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $auth=$row[0]; $fp = fopen ("./project_auth_entries.txt", "a"); $date = date("r"); $ip = getenv("REMOTE_ADDR"); $browser = getenv("HTTP_USER_AGENT"); if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) { Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); Header("HTTP/1.0 401 Unauthorized"); echo "Unzulässiges Username/Kennwort:|$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; exit; } else { if($auth>0) { $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $LOGfullname=$row[0]; fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); fclose($fp); } else { fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); fclose($fp); } $stmt="SELECT full_name from vicidial_users where user='$user';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $full_name = $row[0]; } ?> VICIDIAL ADMIN: User Stats \n"; ?>
\n"; echo "
  VICIDIAL ADMIN: User Stats for  
  \n"; echo "
\n"; echo "\n"; echo " to \n"; echo "  \n"; echo "\n"; echo "           $user - $full_name\n"; echo "
\n"; $stmt="SELECT count(*),status, sum(length_in_sec) from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' group by status order by status"; $rslt=mysql_query($stmt, $link); $statuses_to_print = mysql_num_rows($rslt); echo "
\n"; echo "GESPRÄCH ZEIT UND STATUS:\n"; echo "
\n"; echo "\n"; $total_calls=0; $o=0; while ($statuses_to_print > $o) { $row=mysql_fetch_row($rslt); if (eregi("1$|3$|5$|7$|9$", $o)) {$bgcolor='bgcolor="#B9CBFD"';} else {$bgcolor='bgcolor="#9BB9FB"';} $call_seconds = $row[2]; $call_hours = ($call_seconds / 3600); $call_hours = round($call_hours, 2); $call_hours_int = intval("$call_hours"); $call_minutes = ($call_hours - $call_hours_int); $call_minutes = ($call_minutes * 60); $call_minutes_int = round($call_minutes, 0); if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} echo ""; echo "\n"; echo "\n"; $total_calls = ($total_calls + $row[0]); $call_seconds=0; $o++; } $stmt="SELECT sum(length_in_sec) from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59'"; $rslt=mysql_query($stmt, $link); $counts_to_print = mysql_num_rows($rslt); $row=mysql_fetch_row($rslt); $call_seconds = $row[0]; $call_hours = ($call_seconds / 3600); $call_hours = round($call_hours, 2); $call_hours_int = intval("$call_hours"); $call_minutes = ($call_hours - $call_hours_int); $call_minutes = ($call_minutes * 60); $call_minutes_int = round($call_minutes, 0); if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} echo "\n"; echo "
STATUSZÄHLIMPULSHOURS:MINUTES
$row[1] $row[0] $call_hours_int:$call_minutes_int
GESAMTANRUFE $total_calls $call_hours_int:$call_minutes_int
\n"; echo "

\n"; echo "
\n"; echo "LOGIN/LOGOUT ZEIT:\n"; echo "\n"; echo "\n"; $stmt="SELECT event,event_epoch,event_date,campaign_id from vicidial_user_log where user='" . mysql_real_escape_string($user) . "' and event_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and event_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59'"; $rslt=mysql_query($stmt, $link); $events_to_print = mysql_num_rows($rslt); $total_calls=0; $o=0; $event_start_seconds=''; $event_stop_seconds=''; while ($events_to_print > $o) { $row=mysql_fetch_row($rslt); if (eregi("LOGIN", $row[0])) {$bgcolor='bgcolor="#B9CBFD"';} else {$bgcolor='bgcolor="#9BB9FB"';} if (ereg("LOGIN", $row[0])) { $event_start_seconds = $row[1]; echo ""; echo "\n"; echo "\n"; echo "\n"; } if (ereg("LOGOUT", $row[0])) { if ($event_start_seconds) { $event_stop_seconds = $row[1]; $event_seconds = ($event_stop_seconds - $event_start_seconds); $total_login_time = ($total_login_time + $event_seconds); $event_hours = ($event_seconds / 3600); $event_hours = round($event_hours, 2); $event_hours_int = intval("$event_hours"); $event_minutes = ($event_hours - $event_hours_int); $event_minutes = ($event_minutes * 60); $event_minutes_int = round($event_minutes, 0); if ($event_minutes_int < 10) {$event_minutes_int = "0$event_minutes_int";} echo ""; echo "\n"; echo "\n"; echo "\n"; $event_start_seconds=''; $event_stop_seconds=''; } else { echo ""; echo "\n"; echo "\n"; echo "\n"; } } $total_calls = ($total_calls + $row[0]); $call_seconds=0; $o++; } $total_login_hours = ($total_login_time / 3600); $total_login_hours = round($total_login_hours, 2); $total_login_hours_int = intval("$total_login_hours"); $total_login_minutes = ($total_login_hours - $total_login_hours_int); $total_login_minutes = ($total_login_minutes * 60); $total_login_minutes_int = round($total_login_minutes, 0); if ($total_login_minutes_int < 10) {$total_login_minutes_int = "0$total_login_minutes_int";} echo ""; echo "\n"; echo "\n"; echo "\n"; echo "
FALL DATUM KAMPAGNEHOURS:MINUTES
$row[0] $row[2] $row[3]
$row[0] $row[2] $row[3] $event_hours_int:$event_minutes_int
$row[0] $row[2] $row[3]
GESAMTMENGE $total_login_hours_int:$total_login_minutes_int
\n"; echo "

\n"; echo "
\n"; echo "ANRUFE DES LETZT-50:\n"; echo "\n"; echo "\n"; $stmt="select * from vicidial_log where user='" . mysql_real_escape_string($user) . "' order by uniqueid desc limit 50;"; $rslt=mysql_query($stmt, $link); $logs_to_print = mysql_num_rows($rslt); $u=0; while ($logs_to_print > $u) { $row=mysql_fetch_row($rslt); if (eregi("1$|3$|5$|7$|9$", $u)) {$bgcolor='bgcolor="#B9CBFD"';} else {$bgcolor='bgcolor="#9BB9FB"';} echo ""; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; $u++; } echo "
DATE/TIME LENGTH STATUS PHONE KAMPAGNE LIST LEAD
$row[4] $row[7] $row[8] $row[10] $row[3] $row[2] $row[1]
\n"; $ENDtime = date("U"); $RUNtime = ($ENDtime - $STARTtime); echo "\n\n\n


\n\n"; echo "\n\n\n


\nIndexlaufzeit: $RUNtime seconds
"; ?>