added new welcome_demo.php page

added agc_sk directory for new Slovak agent translation
changed _en directories to redirects that go to main agc and vicidial web directories
language translation files corrections

git-svn-id: svn://192.168.202.10@972 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2008-10-12 14:31:28 +00:00
parent 39901265ff
commit 1acacc3b80
55 changed files with 112 additions and 45097 deletions
-482
View File
@@ -1,482 +0,0 @@
<?
### active_list_refresh.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
### This script is designed purely to serve updates of the live data to the display scripts
### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
###
### required variables:
### - $server_ip
### - $session_name
### - $user
### - $pass
### optional variables:
### - $ADD - ('1','2','3','4','5')
### - $order - ('asc','desc')
### - $format - ('text','table','menu','selectlist','textarea')
### - $bgcolor - ('#123456','white','black','etc...')
### - $txtcolor - ('#654321','black','white','etc...')
### - $txtsize - ('1','2','3','etc...')
### - $selectsize - ('2','3','4','etc...')
### - $selectfontsize - ('8','10','12','etc...')
### - $selectedext - ('cc100')
### - $selectedtrunk - ('Zap/25-1')
### - $selectedlocal - ('SIP/cc100')
### - $textareaheight - ('8','10','12','etc...')
### - $textareawidth - ('8','10','12','etc...')
### - $field_name - ('extension','busyext','extension_xfer','etc...')
###
# changes
# 50323-1147 - First build of script
# 50401-1132 - small formatting changes
# 50502-1402 - added field_name as modifiable variable
# 50503-1213 - added session_name checking for extra security
# 50503-1311 - added conferences list
# 50610-1155 - Added NULL check on MySQL results to reduced errors
# 50711-1209 - removed HTTP authentication in favor of user/pass vars
# 60421-1155 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60619-1118 - Added variable filters to close security holes for login form
#
require("dbconnect.php");
### If you have globals turned off uncomment these lines
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
if (isset($_GET["format"])) {$format=$_GET["format"];}
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];}
elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];}
if (isset($_GET["order"])) {$order=$_GET["order"];}
elseif (isset($_POST["order"])) {$order=$_POST["order"];}
if (isset($_GET["bgcolor"])) {$bgcolor=$_GET["bgcolor"];}
elseif (isset($_POST["bgcolor"])) {$bgcolor=$_POST["bgcolor"];}
if (isset($_GET["txtcolor"])) {$txtcolor=$_GET["txtcolor"];}
elseif (isset($_POST["txtcolor"])) {$txtcolor=$_POST["txtcolor"];}
if (isset($_GET["txtsize"])) {$txtsize=$_GET["txtsize"];}
elseif (isset($_POST["txtsize"])) {$txtsize=$_POST["txtsize"];}
if (isset($_GET["selectsize"])) {$selectsize=$_GET["selectsize"];}
elseif (isset($_POST["selectsize"])) {$selectsize=$_POST["selectsize"];}
if (isset($_GET["selectfontsize"])) {$selectfontsize=$_GET["selectfontsize"];}
elseif (isset($_POST["selectfontsize"])) {$selectfontsize=$_POST["selectfontsize"];}
if (isset($_GET["selectedext"])) {$selectedext=$_GET["selectedext"];}
elseif (isset($_POST["selectedext"])) {$selectedext=$_POST["selectedext"];}
if (isset($_GET["selectedtrunk"])) {$selectedtrunk=$_GET["selectedtrunk"];}
elseif (isset($_POST["selectedtrunk"])) {$selectedtrunk=$_POST["selectedtrunk"];}
if (isset($_GET["selectedlocal"])) {$selectedlocal=$_GET["selectedlocal"];}
elseif (isset($_POST["selectedlocal"])) {$selectedlocal=$_POST["selectedlocal"];}
if (isset($_GET["textareaheight"])) {$textareaheight=$_GET["textareaheight"];}
elseif (isset($_POST["textareaheight"])) {$textareaheight=$_POST["textareaheight"];}
if (isset($_GET["textareawidth"])) {$textareawidth=$_GET["textareawidth"];}
elseif (isset($_POST["textareawidth"])) {$textareawidth=$_POST["textareawidth"];}
if (isset($_GET["field_name"])) {$field_name=$_GET["field_name"];}
elseif (isset($_POST["field_name"])) {$field_name=$_POST["field_name"];}
### security strip all non-alphanumeric characters out of the variables ###
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
$ADD=ereg_replace("[^0-9]","",$ADD);
$order=ereg_replace("[^0-9a-zA-Z]","",$order);
$format=ereg_replace("[^0-9a-zA-Z]","",$format);
$bgcolor=ereg_replace("[^\#0-9a-zA-Z]","",$bgcolor);
$txtcolor=ereg_replace("[^\#0-9a-zA-Z]","",$txtcolor);
$txtsize=ereg_replace("[^0-9a-zA-Z]","",$txtsize);
$selectsize=ereg_replace("[^0-9a-zA-Z]","",$selectsize);
$selectfontsize=ereg_replace("[^0-9a-zA-Z]","",$selectfontsize);
$selectedext=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedext);
$selectedtrunk=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedtrunk);
$selectedlocal=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedlocal);
$textareaheight=ereg_replace("[^0-9a-zA-Z]","",$textareaheight);
$textareawidth=ereg_replace("[^0-9a-zA-Z]","",$textareawidth);
$field_name=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$field_name);
# default optional vars if not set
if (!isset($ADD)) {$ADD="1";}
if (!isset($order)) {$order='desc';}
if (!isset($format)) {$format="text";}
if (!isset($bgcolor)) {$bgcolor='white';}
if (!isset($txtcolor)) {$txtcolor='black';}
if (!isset($txtsize)) {$txtsize='2';}
if (!isset($selectsize)) {$selectsize='4';}
if (!isset($selectfontsize)) {$selectfontsize='10';}
if (!isset($textareaheight)) {$textareaheight='10';}
if (!isset($textareawidth)) {$textareawidth='20';}
$version = '0.0.8';
$build = '60619-1118';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
{
echo "Invalid Username/Password: |$user|$pass|\n";
exit;
}
else
{
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
{
echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n";
exit;
}
else
{
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$SNauth=$row[0];
if($SNauth==0)
{
echo "Invalid session_name: |$session_name|$server_ip|\n";
exit;
}
else
{
# do nothing for now
}
}
}
if ($format=='table')
{
echo "<html>\n";
echo "<head>\n";
echo "<!-- VERSION: $version BUILD: $build ADD: $ADD server_ip: $server_ip-->\n";
echo "<title>List Display: ";
if ($ADD==1) {echo "Live Extensions";}
if ($ADD==2) {echo "Busy Extensions";}
if ($ADD==3) {echo "Outside Lines";}
if ($ADD==4) {echo "Local Extensions";}
if ($ADD==5) {echo "Conferences";}
if ($ADD==99999) {echo "HELP";}
echo "</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
}
######################
# ADD=1 display all live extensions on a server
######################
if ($ADD==1)
{
$pt='pt';
if (!$field_name) {$field_name = 'extension';}
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
if ($format=='selectlist')
{
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
}
if ($format=='textarea')
{
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
}
$stmt="SELECT extension,fullname FROM phones where server_ip = '$server_ip' order by extension $order";
if ($format=='table') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
$o=0;
while ($phones_to_print > $o) {
$row=mysql_fetch_row($rslt);
if ($format=='table')
{
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
echo "$row[0] - $row[1]";
echo "</TD></TR>\n";
}
if ( ($format=='text') or ($format=='textarea') )
{
echo "$row[0] - $row[1]\n";
}
if ( ($format=='menu') or ($format=='selectlist') )
{
echo "<OPTION ";
if ($row[0]=="$selectedext") {echo "SELECTED ";}
echo "VALUE=\"$row[0]\">";
echo "$row[0] - $row[1]";
echo "</OPTION>\n";
}
$o++;
}
if ($format=='table') {echo "</TABLE>\n";}
if ($format=='menu') {echo "</SELECT>\n";}
if ($format=='selectlist') {echo "</SELECT>\n";}
if ($format=='textarea') {echo "</TEXTAREA>\n";}
}
######################
# ADD=2 display all busy extensions on a server
######################
if ($ADD==2)
{
if (!$field_name) {$field_name = 'busyext';}
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
if ($format=='selectlist')
{
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
}
if ($format=='textarea')
{
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
}
$stmt="SELECT extension FROM live_channels where server_ip = '$server_ip' order by extension $order";
if ($format=='table') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
$o=0;
while ($busys_to_print > $o) {
$row=mysql_fetch_row($rslt);
if ($format=='table')
{
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
echo "$row[0]";
echo "</TD></TR>\n";
}
if ( ($format=='text') or ($format=='textarea') )
{
echo "$row[0]\n";
}
if ( ($format=='menu') or ($format=='selectlist') )
{
echo "<OPTION ";
if ($row[0]=="$selectedext") {echo "SELECTED ";}
echo "VALUE=\"$row[0]\">";
echo "$row[0]";
echo "</OPTION>\n";
}
$o++;
}
if ($format=='table') {echo "</TABLE>\n";}
if ($format=='menu') {echo "</SELECT>\n";}
if ($format=='selectlist') {echo "</SELECT>\n";}
if ($format=='textarea') {echo "</TEXTAREA>\n";}
}
######################
# ADD=3 display all busy outside lines(trunks) on a server
######################
if ($ADD==3)
{
if (!$field_name) {$field_name = 'trunk';}
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
if ($format=='selectlist')
{
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
}
if ($format=='textarea')
{
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
}
$stmt="SELECT channel, extension FROM live_channels where server_ip = '$server_ip' order by channel $order";
if ($format=='table') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
$o=0;
while ($busys_to_print > $o) {
$row=mysql_fetch_row($rslt);
if ($format=='table')
{
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
echo "$row[0] - $row[1]";
echo "</TD></TR>\n";
}
if ( ($format=='text') or ($format=='textarea') )
{
echo "$row[0] - $row[1]\n";
}
if ( ($format=='menu') or ($format=='selectlist') )
{
echo "<OPTION ";
if ($row[0]=="$selectedtrunk") {echo "SELECTED ";}
echo "VALUE=\"$row[0]\">";
echo "$row[0] - $row[1]";
echo "</OPTION>\n";
}
$o++;
}
if ($format=='table') {echo "</TABLE>\n";}
if ($format=='menu') {echo "</SELECT>\n";}
if ($format=='selectlist') {echo "</SELECT>\n";}
if ($format=='textarea') {echo "</TEXTAREA>\n";}
}
######################
# ADD=4 display all busy Local lines on a server
######################
if ($ADD==4)
{
if (!$field_name) {$field_name = 'local';}
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
if ($format=='selectlist')
{
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
}
if ($format=='textarea')
{
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
}
$stmt="SELECT channel, extension FROM live_sip_channels where server_ip = '$server_ip' order by channel $order";
if ($format=='table') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
$o=0;
while ($busys_to_print > $o) {
$row=mysql_fetch_row($rslt);
if ($format=='table')
{
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
echo "$row[0] - $row[1]";
echo "</TD></TR>\n";
}
if ( ($format=='text') or ($format=='textarea') )
{
echo "$row[0] - $row[1]\n";
}
if ( ($format=='menu') or ($format=='selectlist') )
{
echo "<OPTION ";
if ($row[0]=="$selectedlocal") {echo "SELECTED ";}
echo "VALUE=\"$row[0]\">";
echo "$row[0] - $row[1]";
echo "</OPTION>\n";
}
$o++;
}
if ($format=='table') {echo "</TABLE>\n";}
if ($format=='menu') {echo "</SELECT>\n";}
if ($format=='selectlist') {echo "</SELECT>\n";}
if ($format=='textarea') {echo "</TEXTAREA>\n";}
}
######################
# ADD=5 display all agc-usable conferences on a server
######################
if ($ADD==5)
{
$pt='pt';
if (!$field_name) {$field_name = 'conferences';}
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
if ($format=='selectlist')
{
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
}
if ($format=='textarea')
{
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
}
$stmt="SELECT conf_exten,extension FROM conferences where server_ip = '$server_ip' order by conf_exten $order";
if ($format=='table') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
$o=0;
while ($phones_to_print > $o) {
$row=mysql_fetch_row($rslt);
if ($format=='table')
{
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
echo "$row[0] - $row[1]";
echo "</TD></TR>\n";
}
if ( ($format=='text') or ($format=='textarea') )
{
echo "$row[0] - $row[1]\n";
}
if ( ($format=='menu') or ($format=='selectlist') )
{
echo "<OPTION ";
if ($row[0]=="$selectedext") {echo "SELECTED ";}
echo "VALUE=\"$row[0]\">";
echo "$row[0] - $row[1]";
echo "</OPTION>\n";
}
$o++;
}
if ($format=='table') {echo "</TABLE>\n";}
if ($format=='menu') {echo "</SELECT>\n";}
if ($format=='selectlist') {echo "</SELECT>\n";}
if ($format=='textarea') {echo "</TEXTAREA>\n";}
}
$ENDtime = date("U");
$RUNtime = ($ENDtime - $StarTtime);
if ($format=='table') {echo "\n<!-- script runtime: $RUNtime seconds -->";}
if ($format=='table') {echo "\n</body>\n</html>\n";}
exit;
?>
File diff suppressed because it is too large Load Diff
-196
View File
@@ -1,196 +0,0 @@
<?
### call_log_display.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
### This script is designed purely to send the inbound and outbound calls for a specific phone
### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
###
### required variables:
### - $server_ip
### - $session_name
### - $user
### - $pass
### optional variables:
### - $format - ('text','debug')
### - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
### - $protocol - ('SIP','Zap','IAX2',...)
### - $in_limit - ('10','20','50','100',...)
### - $out_limit - ('10','20','50','100',...)
###
# changes
# 50406-1013 - First build of script
# 50407-1452 - Added definable limits
# 50503-1236 - added session_name checking for extra security
# 50610-1158 - Added NULL check on MySQL results to reduced errors
# 50711-1202 - removed HTTP authentication in favor of user/pass vars
# 60323-1550 - added option for showing different number dialed in log
# 60421-1401 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60619-1202 - Added variable filters to close security holes for login form
#
require("dbconnect.php");
### If you have globals turned off uncomment these lines
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
if (isset($_GET["format"])) {$format=$_GET["format"];}
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
# default optional vars if not set
if (!isset($format)) {$format="text";}
if (!isset($in_limit)) {$in_limit="100";}
if (!isset($out_limit)) {$out_limit="100";}
$number_dialed = 'number_dialed';
#$number_dialed = 'extension';
$version = '0.0.8';
$build = '60619-1202';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
{
echo "Invalid Username/Password: |$user|$pass|\n";
exit;
}
else
{
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
{
echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n";
exit;
}
else
{
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$SNauth=$row[0];
if($SNauth==0)
{
echo "Invalid session_name: |$session_name|$server_ip|\n";
exit;
}
else
{
# do nothing for now
}
}
}
if ($format=='debug')
{
echo "<html>\n";
echo "<head>\n";
echo "<!-- VERSION: $version BUILD: $build EXTEN: $exten server_ip: $server_ip-->\n";
echo "<title>Call Log Display";
echo "</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
}
$row=''; $rowx='';
$channel_live=1;
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
{
$channel_live=0;
echo "Exten $exten is not valid or protocol $protocol is not valid\n";
exit;
}
else
{
##### print outbound calls from the call_log table
$stmt="SELECT uniqueid,start_time,$number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$out_calls_count = mysql_num_rows($rslt);}
echo "$out_calls_count|";
$loop_count=0;
while ($out_calls_count>$loop_count)
{
$loop_count++;
$row=mysql_fetch_row($rslt);
$call_time_M = ($row[3] / 60);
$call_time_M = round($call_time_M, 2);
$call_time_M_int = intval("$call_time_M");
$call_time_SEC = ($call_time_M - $call_time_M_int);
$call_time_SEC = ($call_time_SEC * 60);
$call_time_SEC = round($call_time_SEC, 0);
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
$call_time_MS = "$call_time_M_int:$call_time_SEC";
if ($number_dialed == 'extension') {$row[2] = substr($row[2],-10);}
echo "$row[0] ~$row[1] ~$row[2] ~$call_time_MS|";
}
echo "\n";
##### print inbound calls from the live_inbound_log table
$stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$in_calls_count = mysql_num_rows($rslt);}
echo "$in_calls_count|";
$loop_count=0;
while ($in_calls_count>$loop_count)
{
$loop_count++;
$row=mysql_fetch_row($rslt);
$call_time_M = ($row[4] / 60);
$call_time_M = round($call_time_M, 2);
$call_time_M_int = intval("$call_time_M");
$call_time_SEC = ($call_time_M - $call_time_M_int);
$call_time_SEC = ($call_time_SEC * 60);
$call_time_SEC = round($call_time_SEC, 0);
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
$call_time_MS = "$call_time_M_int:$call_time_SEC";
$callerIDnum = $row[3]; $callerIDname = $row[3];
$callerIDnum = preg_replace("/.*<|>.*/","",$callerIDnum);
$callerIDname = preg_replace("/\"| <\d*>/","",$callerIDname);
echo "$row[0] ~$row[1] ~$row[2] ~$callerIDnum ~$callerIDname ~$call_time_MS|";
}
echo "\n";
}
if ($format=='debug')
{
$ENDtime = date("U");
$RUNtime = ($ENDtime - $StarTtime);
echo "\n<!-- script runtime: $RUNtime seconds -->";
echo "\n</body>\n</html>\n";
}
exit;
?>
-297
View File
@@ -1,297 +0,0 @@
<?
# conf_exten_check.php
#
# Copyright (C) 2007 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
# This script is designed purely to send whether the meetme conference has live channels connected and which they are
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
#
# required variables:
# - $server_ip
# - $session_name
# - $user
# - $pass
# optional variables:
# - $format - ('text','debug')
# - $ACTION - ('refresh','register')
# - $client - ('agc','vdc')
# - $conf_exten - ('8600011',...)
# - $exten - ('123test',...)
# - $auto_dial_level - ('0','1','1.2',...)
# - $campagentstdisp - ('YES',...)
#
# changes
# 50509-1054 - First build of script
# 50511-1112 - Added ability to register a conference room
# 50610-1159 - Added NULL check on MySQL results to reduced errors
# 50706-1429 - script changed to not use HTTP login vars, user/pass instead
# 50706-1525 - Added date-time display for vicidial client display
# 50816-1500 - Added random update to vicidial_live_agents table for vdc users
# 51121-1353 - Altered echo statements for several small PHP speed optimizations
# 60410-1424 - Added ability to grab calls-being-placed and agent status
# 60421-1405 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60619-1201 - Added variable filters to close security holes for login form
# 61128-2255 - Added update for manual dial vicidial_live_agents
# 70319-1542 - Added agent disabled display function
# 71122-0205 - Added vicidial_live_agent status output
#
require("dbconnect.php");
### If you have globals turned off uncomment these lines
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
if (isset($_GET["format"])) {$format=$_GET["format"];}
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
if (isset($_GET["ACTION"])) {$ACTION=$_GET["ACTION"];}
elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];}
if (isset($_GET["client"])) {$client=$_GET["client"];}
elseif (isset($_POST["client"])) {$client=$_POST["client"];}
if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];}
elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];}
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
if (isset($_GET["auto_dial_level"])) {$auto_dial_level=$_GET["auto_dial_level"];}
elseif (isset($_POST["auto_dial_level"])) {$auto_dial_level=$_POST["auto_dial_level"];}
if (isset($_GET["campagentstdisp"])) {$campagentstdisp=$_GET["campagentstdisp"];}
elseif (isset($_POST["campagentstdisp"])) {$campagentstdisp=$_POST["campagentstdisp"];}
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
# default optional vars if not set
if (!isset($format)) {$format="text";}
if (!isset($ACTION)) {$ACTION="refresh";}
if (!isset($client)) {$client="agc";}
$version = '2.0.4-12';
$build = '71122-0205';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$FILE_TIME = date("Ymd_His");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$random = (rand(1000000, 9999999) + 10000000);
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
{
echo "Invalid Username/Password: |$user|$pass|\n";
exit;
}
else
{
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
{
echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n";
exit;
}
else
{
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$SNauth=$row[0];
if($SNauth==0)
{
echo "Invalid session_name: |$session_name|$server_ip|\n";
exit;
}
else
{
# do nothing for now
}
}
}
if ($format=='debug')
{
echo "<html>\n";
echo "<head>\n";
echo "<!-- VERSION: $version BUILD: $build MEETME: $conf_exten server_ip: $server_ip-->\n";
echo "<title>Conf Extension Check";
echo "</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
}
if ($ACTION == 'refresh')
{
$MT[0]='';
$row=''; $rowx='';
$channel_live=1;
if (strlen($conf_exten)<1)
{
$channel_live=0;
echo "Conf Exten $conf_exten is not valid\n";
exit;
}
else
{
if ($client == 'vdc')
{
$Acount=0;
$AexternalDEAD=0;
### see if the agent has a record in the vicidial_live_agents table
$stmt="SELECT count(*) from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$Acount=$row[0];
if ($Acount > 0)
{
$stmt="SELECT status from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$Astatus=$row[0];
}
# ### find out if external table shows agent should be disabled
# $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';";
# if ($DB) {echo "|$stmt|\n";}
# $rslt=mysql_query($stmt, $link);
# $row=mysql_fetch_row($rslt);
# $AexternalDEAD=$row[0];
if ($auto_dial_level > 0)
{
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($campagentstdisp == 'YES')
{
### grab the status of this agent to display
$stmt="SELECT status,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$Alogin=$row[0];
$Acampaign=$row[1];
### grab the number of calls being placed from this server and campaign
$stmt="SELECT count(*) from vicidial_auto_calls where server_ip='$server_ip' and status NOT IN('XFER') and campaign_id='$Acampaign';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$RingCalls=$row[0];
}
else
{
$Alogin='N';
$RingCalls='N';
}
}
else
{
$Alogin='N';
$RingCalls='N';
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
}
if ($Acount < 1) {$Alogin='DEAD_VLA';}
if ($AexternalDEAD > 0) {$Alogin='DEAD_EXTERNAL';}
echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . "|\n";
}
$total_conf=0;
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$sip_list = mysql_num_rows($rslt);}
# echo "$sip_list|";
$loop_count=0;
while ($sip_list>$loop_count)
{
$loop_count++; $total_conf++;
$row=mysql_fetch_row($rslt);
$ChannelA[$total_conf] = "$row[0]";
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
}
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
# echo "$channels_list|";
$loop_count=0;
while ($channels_list>$loop_count)
{
$loop_count++; $total_conf++;
$row=mysql_fetch_row($rslt);
$ChannelA[$total_conf] = "$row[0]";
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
}
}
$channels_list = ($channels_list + $sip_list);
echo "$channels_list|";
$counter=0;
$countecho='';
while($total_conf > $counter)
{
$counter++;
$countecho = "$countecho$ChannelA[$counter] ~";
# echo "$ChannelA[$counter] ~";
}
echo "$countecho\n";
}
if ($ACTION == 'register')
{
$MT[0]='';
$row=''; $rowx='';
$channel_live=1;
if ( (strlen($conf_exten)<1) || (strlen($exten)<1) )
{
$channel_live=0;
echo "Conf Exten $conf_exten is not valid or Exten $exten is not valid\n";
exit;
}
else
{
$stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
}
echo "Conference $conf_exten has been registered to $exten\n";
}
if ($format=='debug')
{
$ENDtime = date("U");
$RUNtime = ($ENDtime - $StarTtime);
echo "\n<!-- script runtime: $RUNtime seconds -->";
echo "\n</body>\n</html>\n";
}
exit;
?>
-48
View File
@@ -1,48 +0,0 @@
<?
#
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
if ( file_exists("/etc/astguiclient.conf") )
{
$DBCagc = file("/etc/astguiclient.conf");
foreach ($DBCagc as $DBCline)
{
$DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline);
if (ereg("^PATHlogs", $DBCline))
{$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);}
if (ereg("^PATHweb", $DBCline))
{$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);}
if (ereg("^VARDB_server", $DBCline))
{$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);}
if (ereg("^VARDB_database", $DBCline))
{$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);}
if (ereg("^VARDB_user", $DBCline))
{$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);}
if (ereg("^VARDB_pass", $DBCline))
{$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);}
if (ereg("^VARDB_port", $DBCline))
{$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);}
}
}
else
{
#defaults for DB connection
$VARDB_server = 'localhost';
$VARDB_user = 'cron';
$VARDB_pass = '1234';
$VARDB_database = '1234';
$WeBServeRRooT = '/usr/local/apache2/htdocs';
}
$link=mysql_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass");
mysql_select_db("$VARDB_database");
$local_DEF = 'Local/';
$conf_silent_prefix = '7';
$local_AMP = '@';
$ext_context = 'demo';
$recording_exten = '8309';
$WeBRooTWritablE = '1';
?>
-351
View File
@@ -1,351 +0,0 @@
<?
### inbound_popup.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
### This script is designed to open up when a live_inbound call comes in giving the user
### options of what to do with the call or options to lookup the callerID on various web sites
### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
###
### required variables:
### - $server_ip
### - $session_name
### - $uniqueid - ('1234567890.123456',...)
### - $user
### - $pass
### optional variables:
### - $format - ('text','debug')
### - $vmail_box - ('101','1234',...)
### - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
### - $ext_context - ('default','demo',...)
### - $ext_priority - ('1','2',...)
### - $voicemail_dump_exten - ('85026666666666')
### - $local_web_callerID_URL_enc - ( rawurlencoded custom callerid lookup URL)
###
# changes
# 50428-1500 - First build of script display only
# 50429-1241 - some formatting, hangup and Vmail redirect, 30s timeout on actions, and CID web lookup links
# 50503-1244 - added session_name checking for extra security
# 50711-1203 - removed HTTP authentication in favor of user/pass vars
# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60619-1205 - Added variable filters to close security holes for login form
#
require("dbconnect.php");
### If you have globals turned off uncomment these lines
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
if (isset($_GET["format"])) {$format=$_GET["format"];}
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];}
elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];}
if (isset($_GET["ext_priority"])) {$ext_priority=$_GET["ext_priority"];}
elseif (isset($_POST["ext_priority"])) {$ext_priority=$_POST["ext_priority"];}
if (isset($_GET["voicemail_dump_exten"])) {$voicemail_dump_exten=$_GET["voicemail_dump_exten"];}
elseif (isset($_POST["voicemail_dump_exten"])) {$voicemail_dump_exten=$_POST["voicemail_dump_exten"];}
if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_GET["local_web_callerID_URL_enc"];}
elseif (isset($_POST["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_POST["local_web_callerID_URL_enc"];}
if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL = rawurldecode($local_web_callerID_URL_enc);}
else {$local_web_callerID_URL = '';}
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
# default optional vars if not set
if (!isset($format)) {$format="text";}
$version = '0.0.6';
$build = '60619-1205';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$DO = '-1';
if ( (eregi("^Zap",$channel)) and (!eregi("-",$channel)) ) {$channel = "$channel$DO";}
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
{
echo "Invalid Username/Password: |$user|$pass|\n";
exit;
}
else
{
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
{
echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n";
exit;
}
else
{
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$SNauth=$row[0];
if($SNauth==0)
{
echo "Invalid session_name: |$session_name|$server_ip|\n";
exit;
}
else
{
# do nothing for now
}
}
}
if ($format=='debug')
{
$forever_stop=0;
$user_abb = "$user$user$user$user";
while ( (strlen($user_abb) > 4) and ($forever_stop < 200) )
{$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;}
echo "<html>\n";
echo "<head>\n";
echo "<!-- VERSION: $version BUILD: $build UNIQUEID: $uniqueid server_ip: $server_ip-->\n";
?>
<script language="Javascript">
var server_ip = '<? echo $server_ip ?>';
var epoch_sec = '<? echo $StarTtime ?>';
var user_abb = '<? echo $user_abb ?>';
var vmail_box = '<? echo $vmail_box ?>';
var ext_context = '<? echo $ext_context ?>';
var ext_priority = '<? echo $ext_priority ?>';
var voicemail_dump_exten = '<? echo $voicemail_dump_exten ?>';
var session_name = '<? echo $session_name ?>';
var user = '<? echo $user ?>';
var pass = '<? echo $pass ?>';
// ################################################################################
// Send Hangup command for Live call connected to phone now to Manager
function livehangup_send_hangup(taskvar)
{
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
{
xmlhttp = new XMLHttpRequest();
}
if (xmlhttp)
{
var queryCID = "HLagcP" + epoch_sec + user_abb;
var hangupvalue = taskvar;
livehangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Hangup&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID;
xmlhttp.open('POST', 'manager_send.php');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp.send(livehangup_query);
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
Nactiveext = null;
Nactiveext = xmlhttp.responseText;
alert(xmlhttp.responseText);
}
}
delete xmlhttp;
}
call_action_link_clear();
}
// ################################################################################
// Send Redirect command for ringing call to go directly to your voicemail
function liveredirect_send_vmail(taskvar,taskbox)
{
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
{
xmlhttp = new XMLHttpRequest();
}
if (xmlhttp)
{
var queryCID = "RVagcP" + epoch_sec + user_abb;
var hangupvalue = taskvar;
var mailboxvalue = taskbox;
liveredirect_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Redirect&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID + "&exten=" + voicemail_dump_exten + "" + mailboxvalue + "&ext_context=" + ext_context + "&ext_priority=" + ext_priority;
xmlhttp.open('POST', 'manager_send.php');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp.send(liveredirect_query);
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
Nactiveext = null;
Nactiveext = xmlhttp.responseText;
alert(xmlhttp.responseText);
}
}
delete xmlhttp;
}
call_action_link_clear();
}
// ################################################################################
// timeout to deactivate the call action links after 30 seconds
function link_timeout()
{
window.focus();
setTimeout("call_action_link_clear()", 30000);
}
// ################################################################################
// deactivates the call action links
function call_action_link_clear()
{
document.getElementById("callactions").innerHTML = "";
}
</script>
<?
echo "<title>LIVE INBOUND CALL";
echo "</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=\"#CCC2E0\" marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 onload=\"link_timeout();\">\n";
echo "<CENTER><H2>LIVE INBOUND CALL</H2>\n";
echo "<B>$NOW_TIME</B><BR><BR>\n";
}
$MT[0]='';
$row=''; $rowx='';
$channel_live=1;
if (strlen($uniqueid)<9)
{
$channel_live=0;
echo "Uniqueid $uniqueid is not valid\n";
exit;
}
else
{
$stmt="SELECT * FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$channels_list = mysql_num_rows($rslt);
if ($channels_list>0)
{
$row=mysql_fetch_row($rslt);
# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt|||||
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
echo "<table width=95% cellpadding=1 cellspacing=3>\n";
echo "<tr bgcolor=\"#DDDDFF\"><td>Channel: </td><td align=left>$row[1]</td></tr>\n";
echo "<tr bgcolor=\"#DDDDFF\"><td>CallerID: </td><td align=left>$row[3]</td></tr>\n";
echo "<tr bgcolor=\"#DDDDFF\"><td colspan=2 align=center>\n";
$phone = eregi_replace(".*\<","",$row[3]);
$phone = eregi_replace("\>.*","",$phone);
$NPA = substr($phone, 0, 3);
$NXX = substr($phone, 3, 3);
$XXXX = substr($phone, 6, 4);
$D='-';
echo "<a href=\"http://www.google.com/search?hl=en&lr=&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial_s&q=$NPA+$NXX+$XXXX&btnG=Search\" target=\"_blank\">GOOGLE</a> - \n";
echo "<a href=\"http://www.anywho.com/qry/wp_rl?npa=$NPA&telephone=$NXX$XXXX\" target=\"_blank\">ANYWHO</a> - \n";
echo "<a href=\"http://www.switchboard.com/bin/cgirlookup.dll?SR=&MEM=1&LNK=32%3A36&type=BOTH&at=$NPA&e=$NXX&n=$XXXX&search.x=55&search.y=20\" target=\"_blank\">SWITCHBOARD</a> - \n";
echo "<a href=\"http://yellowpages.superpages.com/listings.jsp?SRC=&STYPE=&PG=L&CB=&C=&N=&E=&T=&S=&Z=&A=727&X=533&P=8730&AXP=$NPA$NXX$XXXX&R=N&PS=15&search=Find+It\" target=\"_blank\">VERIZON</a> - \n";
echo "<a href=\"http://www.whitepages.com/1014/log_click/search/Reverse_Phone?npa=$NPA&phone=$NXX$XXXX\" target=\"_blank\">WHITEPAGES</a> - \n";
echo "<a href=\"http://www.411.com/10742/search/Reverse_Phone?phone=%28$NPA%29+$NXX$D$XXXX\" target=\"_blank\">411.COM</a> - \n";
echo "<a href=\"http://www.phonenumber.com/10006/search/Reverse_Phone?npa=$NPA&phone=$NXX$XXXX\" target=\"_blank\">411.COM</a> - \n";
$local_web_callerID_QUERY_STRING ='';
$local_web_callerID_QUERY_STRING.="?callerID_areacode=$NPA";
$local_web_callerID_QUERY_STRING.="&callerID_prefix=$NXX";
$local_web_callerID_QUERY_STRING.="&callerID_last4=$XXXX";
$local_web_callerID_QUERY_STRING.="&callerID_Time=$row[6]";
$local_web_callerID_QUERY_STRING.="&callerID_Channel=$row[1]";
$local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$row[0]";
$local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$row[5]";
$local_web_callerID_QUERY_STRING.="&callerID_server_ip=$row[2]";
$local_web_callerID_QUERY_STRING.="&callerID_extension=$row[4]";
$local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$row[8]";
$local_web_callerID_QUERY_STRING.="&callerID_comment_a=$row[9]";
$local_web_callerID_QUERY_STRING.="&callerID_comment_b=$row[10]";
$local_web_callerID_QUERY_STRING.="&callerID_comment_c=$row[11]";
$local_web_callerID_QUERY_STRING.="&callerID_comment_d=$row[12]";
$local_web_callerID_QUERY_STRING.="&callerID_comment_e=$row[13]";
echo "<a href=\"$local_web_callerID_URL$local_web_callerID_QUERY_STRING\" target=\"_blank\">CUSTOM</a> - \n";
echo "</td></tr>\n";
echo "<tr bgcolor=\"#DDDDFF\"><td>Number Dialed: </td><td align=left>$row[8]</td></tr>\n";
echo "<tr bgcolor=\"#DDDDFF\"><td>Notes: </td><td align=left>$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|</td></tr>\n";
echo "<tr bgcolor=\"#DDDDFF\"><td colspan=2 align=center>\n<span id=\"callactions\">";
echo "<a href=\"#\" onclick=\"livehangup_send_hangup('$row[1]');return false;\">HANGUP</a> - \n";
echo "<a href=\"#\" onclick=\"liveredirect_send_vmail('$row[1]','$vmail_box');return false;\">SEND TO MY VOICEMAIL</a>\n";
echo "</span></td></tr>\n";
echo "</table>\n";
$stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
}
}
if ($format=='debug')
{
$ENDtime = date("U");
$RUNtime = ($ENDtime - $StarTtime);
echo "\n<!-- script runtime: $RUNtime seconds -->";
echo "\n</body>\n</html>\n";
}
exit;
?>
-278
View File
@@ -1,278 +0,0 @@
<?
### live_exten_check.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
### This script is designed purely to send whether the client channel is live and to what channel it is connected
### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
###
### required variables:
### - $server_ip
### - $session_name
### - $user
### - $pass
### optional variables:
### - $format - ('text','debug')
### - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
### - $protocol - ('SIP','Zap','IAX2',...)
###
# changes
# 50404-1249 - First build of script
# 50406-1402 - added connected trunk lookup
# 50428-1452 - added live_inbound check for exten on 2nd line of output
# 50503-1233 - added session_name checking for extra security
# 50524-1429 - added parked calls count
# 50610-1204 - Added NULL check on MySQL results to reduced errors
# 50711-1204 - removed HTTP authentication in favor of user/pass vars
# 60103-1541 - added favorite extens status display
# 60421-1359 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60619-1203 - Added variable filters to close security holes for login form
# 60825-1029 - Fixed translation variable issue ChannelA
#
require("dbconnect.php");
### If you have globals turned off uncomment these lines
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
if (isset($_GET["format"])) {$format=$_GET["format"];}
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
if (isset($_GET["favorites_count"])) {$favorites_count=$_GET["favorites_count"];}
elseif (isset($_POST["favorites_count"])) {$favorites_count=$_POST["favorites_count"];}
if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];}
elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];}
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
# default optional vars if not set
if (!isset($format)) {$format="text";}
$version = '2.0.1';
$build = '60825-1029';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
{
echo "Invalid Username/Password: |$user|$pass|\n";
exit;
}
else
{
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
{
echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n";
exit;
}
else
{
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$SNauth=$row[0];
if($SNauth==0)
{
echo "Invalid session_name: |$session_name|$server_ip|\n";
exit;
}
else
{
# do nothing for now
}
}
}
if ($format=='debug')
{
echo "<html>\n";
echo "<head>\n";
echo "<!-- VERSION: $version BUILD: $build EXTEN: $exten server_ip: $server_ip-->\n";
echo "<title>Live Extension Check";
echo "</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
}
echo "DateTime: $NOW_TIME|";
echo "UnixTime: $StarTtime|";
$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
echo "$row[0]|";
$MT[0]='';
$row=''; $rowx='';
$channel_live=1;
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
{
$channel_live=0;
echo "Exten $exten is not valid or protocol $protocol is not valid\n";
exit;
}
else
{
$stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
echo "$channels_list|";
$loop_count=0;
while ($channels_list>$loop_count)
{
$loop_count++;
$row=mysql_fetch_row($rslt);
$ChanneLA[$loop_count] = "$row[0]";
$ChanneLB[$loop_count] = "$row[1]";
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
}
}
$counter=0;
while($loop_count > $counter)
{
$counter++;
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
if ($trunk_count>0)
{
$row=mysql_fetch_row($rslt);
echo "Conversation: $counter ~";
echo "ChannelA: $ChanneLA[$counter] ~";
echo "ChannelB: $ChanneLB[$counter] ~";
echo "ChannelBtrunk: $row[0]|";
}
else
{
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
if ($trunk_count>0)
{
$row=mysql_fetch_row($rslt);
echo "Conversation: $counter ~";
echo "ChannelA: $ChanneLA[$counter] ~";
echo "ChannelB: $ChanneLB[$counter] ~";
echo "ChannelBtrunk: $row[0]|";
}
else
{
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
if ($trunk_count>0)
{
$row=mysql_fetch_row($rslt);
echo "Conversation: $counter ~";
echo "ChannelA: $ChanneLA[$counter] ~";
echo "ChannelB: $ChanneLB[$counter] ~";
echo "ChannelBtrunk: $row[0]|";
}
else
{
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
if ($trunk_count>0)
{
$row=mysql_fetch_row($rslt);
echo "Conversation: $counter ~";
echo "ChannelA: $ChanneLA[$counter] ~";
echo "ChannelB: $ChanneLB[$counter] ~";
echo "ChannelBtrunk: $row[0]|";
}
else
{
echo "Conversation: $counter ~";
echo "ChannelA: $ChanneLA[$counter] ~";
echo "ChannelB: $ChanneLB[$counter] ~";
echo "ChannelBtrunk: $ChanneLA[$counter]|";
}
}
}
}
}
echo "\n";
### check for live_inbound entry
$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
if ($channels_list>0)
{
$row=mysql_fetch_row($rslt);
$LIuniqueid = "$row[0]";
$LIchannel = "$row[1]";
$LIcallerid = "$row[3]";
$LIdatetime = "$row[6]";
echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
}
echo "\n";
### if favorites are present do a lookup to see if any are active
if ($favorites_count > 0)
{
$favorites = explode(',',$favorites_list);
$h=0;
$favs_print='';
while ($favorites_count > $h)
{
$fav_extension = explode('/',$favorites[$h]);
$stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$favs_print .= "$fav_extension[1]: $row[0] ~";
$h++;
}
echo "$favs_print\n";
}
if ($format=='debug') {echo "\n<!-- |$favorites_count|$favorites_list| -->";}
if ($format=='debug')
{
$ENDtime = date("U");
$RUNtime = ($ENDtime - $StarTtime);
echo "\n<!-- script runtime: $RUNtime seconds -->";
echo "\n</body>\n</html>\n";
}
exit;
?>
File diff suppressed because it is too large Load Diff
-146
View File
@@ -1,146 +0,0 @@
<?
### park_calls_display.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
### This script is designed purely to send the details on the parked calls on the server
### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
###
### required variables:
### - $server_ip
### - $session_name
### - $user
### - $pass
### optional variables:
### - $format - ('text','debug')
### - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
### - $protocol - ('SIP','Zap','IAX2',...)
###
# changes
# 50524-1515 - First build of script
# 50711-1208 - removed HTTP authentication in favor of user/pass vars
# 60421-1111 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60619-1205 - Added variable filters to close security holes for login form
#
require("dbconnect.php");
### If you have globals turned off uncomment these lines
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
if (isset($_GET["format"])) {$format=$_GET["format"];}
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
# default optional vars if not set
if (!isset($format)) {$format="text";}
if (!isset($park_limit)) {$park_limit="1000";}
$version = '0.0.4';
$build = '60619-1205';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) )
{
echo "Invalid Username/Password: |$user|$pass|\n";
exit;
}
else
{
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) {
echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n";
exit;
}
else
{
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$SNauth=$row[0];
if($SNauth==0)
{
echo "Invalid session_name: |$session_name|$server_ip|\n";
exit;
}
else
{
# do nothing for now
}
}
}
if ($format=='debug')
{
echo "<html>\n";
echo "<head>\n";
echo "<!-- VERSION: $version BUILD: $build EXTEN: $exten server_ip: $server_ip-->\n";
echo "<title>Parked Calls Display";
echo "</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
}
$row=''; $rowx='';
$channel_live=1;
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
{
$channel_live=0;
echo "Exten $exten is not valid or protocol $protocol is not valid\n";
exit;
}
else
{
##### print parked calls from the parked_channels table
$stmt="SELECT * from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$park_calls_count = mysql_num_rows($rslt);
echo "$park_calls_count\n";
$loop_count=0;
while ($park_calls_count>$loop_count)
{
$loop_count++;
$row=mysql_fetch_row($rslt);
echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|";
}
echo "\n";
}
if ($format=='debug')
{
$ENDtime = date("U");
$RUNtime = ($ENDtime - $StarTtime);
echo "\n<!-- script runtime: $RUNtime seconds -->";
echo "\n</body>\n</html>\n";
}
exit;
?>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-140
View File
@@ -1,140 +0,0 @@
<?
### voicemail_check.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
### This script is designed purely to check whether the voicemail box on the server defined has new and old messages
### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
###
### required variables:
### - $server_ip
### - $session_name
### - $user
### - $pass
### optional variables:
### - $format - ('text','debug')
### - $vmail_box - ('101','1234',...)
###
# changes
# 50422-1147 - First build of script
# 50503-1241 - added session_name checking for extra security
# 50711-1201 - removed HTTP authentication in favor of user/pass vars
# 60421-1147 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60619-1204 - Added variable filters to close security holes for login form
#
require("dbconnect.php");
### If you have globals turned off uncomment these lines
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
if (isset($_GET["format"])) {$format=$_GET["format"];}
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
# default optional vars if not set
if (!isset($format)) {$format="text";}
$version = '0.0.5';
$build = '60619-1204';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
{
echo "Invalid Username/Password: |$user|$pass|\n";
exit;
}
else
{
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
{
echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n";
exit;
}
else
{
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$SNauth=$row[0];
if($SNauth==0)
{
echo "Invalid session_name: |$session_name|$server_ip|\n";
exit;
}
else
{
# do nothing for now
}
}
}
if ($format=='debug')
{
echo "<html>\n";
echo "<head>\n";
echo "<!-- VERSION: $version BUILD: $build VMBOX: $vmail_box server_ip: $server_ip-->\n";
echo "<title>Voicemail Check";
echo "</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
}
$MT[0]='';
$row=''; $rowx='';
if (strlen($vmail_box)<1)
{
$channel_live=0;
echo "voicemail box $vmail_box is not valid\n";
exit;
}
else
{
$stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
$vmails_list = mysql_num_rows($rslt);
$loop_count=0;
while ($vmails_list>$loop_count)
{
$loop_count++;
$row=mysql_fetch_row($rslt);
echo "$row[0]|$row[1]";
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
}
}
if ($format=='debug')
{
$ENDtime = date("U");
$RUNtime = ($ENDtime - $StarTtime);
echo "\n<!-- script runtime: $RUNtime seconds -->";
echo "\n</body>\n</html>\n";
}
exit;
?>
-617
View File
@@ -1,617 +0,0 @@
<?
### AST_CLOSERstats.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
# CHANGES
#
# 60619-1714 - Added variable filtering to eliminate SQL injection attack threat
# - Added required user/pass to gain access to this page
# 60905-1326 - Added queue time stats
# 71008-1436 - Added shift to be defined in dbconnect.php
# 71025-0021 - Added status breakdown
#
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["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];}
elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];}
if (isset($_GET["shift"])) {$shift=$_GET["shift"];}
elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];}
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);
if (strlen($shift)<2) {$shift='ALL';}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
if (!isset($group)) {$group = '';}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="select group_id from vicidial_inbound_groups;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$groups_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $groups_to_print)
{
$row=mysql_fetch_row($rslt);
$groups[$i] =$row[0];
$i++;
}
?>
<HTML>
<HEAD>
<STYLE type="text/css">
<!--
.green {color: white; background-color: green}
.red {color: white; background-color: red}
.blue {color: white; background-color: blue}
.purple {color: white; background-color: purple}
-->
</STYLE>
<?
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>VICIDIAL: VDAD Closer Stats</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
echo "<INPUT TYPE=TEXT NAME=query_date SIZE=10 MAXLENGTH=10 VALUE=\"$query_date\">\n";
echo "<SELECT SIZE=1 NAME=group>\n";
$o=0;
while ($groups_to_print > $o)
{
if ($groups[$o] == $group) {echo "<option selected value=\"$groups[$o]\">$groups[$o]</option>\n";}
else {echo "<option value=\"$groups[$o]\">$groups[$o]</option>\n";}
$o++;
}
echo "</SELECT>\n";
echo "<SELECT SIZE=1 NAME=shift>\n";
echo "<option selected value=\"$shift\">$shift</option>\n";
echo "<option value=\"\">--</option>\n";
echo "<option value=\"AM\">AM</option>\n";
echo "<option value=\"PM\">PM</option>\n";
echo "<option value=\"ALL\">ALL</option>\n";
echo "</SELECT>\n";
echo "<INPUT TYPE=submit NAME=SUBMIT VALUE=SUBMIT>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href=\"./admin.php?ADD=3111&group_id=$group\">MODIFY</a> | <a href=\"./admin.php?ADD=999999\">REPORTS</a> </FONT>\n";
echo "</FORM>\n\n";
echo "<PRE><FONT SIZE=2>\n\n";
if (!$group)
{
echo "\n\n";
echo "PLEASE SELECT A CAMPAIGN AND DATE ABOVE AND CLICK SUBMIT\n";
}
else
{
if ($shift == 'AM')
{
$time_BEGIN=$AM_shift_BEGIN;
$time_END=$AM_shift_END;
if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}
if (strlen($time_END) < 6) {$time_END = "15:15:00";}
}
if ($shift == 'PM')
{
$time_BEGIN=$PM_shift_BEGIN;
$time_END=$PM_shift_END;
if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
if (strlen($time_END) < 6) {$time_END = "23:15:00";}
}
if ($shift == 'ALL')
{
if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
if (strlen($time_END) < 6) {$time_END = "23:59:59";}
}
$query_date_BEGIN = "$query_date $time_BEGIN";
$query_date_END = "$query_date $time_END";
echo "VICIDIAL: Auto-dial Closer Stats $NOW_TIME\n";
echo "\n";
echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
echo "---------- TOTALS\n";
$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$TOTALcalls = sprintf("%10s", $row[0]);
if ( ($row[0] < 1) or ($row[1] < 1) )
{$average_hold_seconds = ' 0';}
else
{
$average_hold_seconds = ($row[1] / $row[0]);
$average_hold_seconds = round($average_hold_seconds, 0);
$average_hold_seconds = sprintf("%10s", $average_hold_seconds);
}
echo "Total Calls placed from this Campaign: $TOTALcalls\n";
echo "Average Call Length for all Calls: $average_hold_seconds seconds\n";
echo "\n";
echo "---------- DROPS\n";
$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP' and (length_in_sec <= 999 or length_in_sec is null);";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$DROPcalls = sprintf("%10s", $row[0]);
if ( ($DROPcalls < 1) or ($TOTALcalls < 1) )
{$DROPpercent = '0';}
else
{
$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
$DROPpercent = round($DROPpercent, 0);
}
if ( ($row[0] < 1) or ($row[1] < 1) )
{$average_hold_seconds = ' 0';}
else
{
$average_hold_seconds = ($row[1] / $row[0]);
$average_hold_seconds = round($average_hold_seconds, 0);
$average_hold_seconds = sprintf("%10s", $average_hold_seconds);
}
echo "Total DROP Calls: $DROPcalls $DROPpercent%\n";
echo "Average hold time for DROP Calls: $average_hold_seconds seconds\n";
##############################
######### CALL STATUS STATS
$TOTALcalls = 0;
echo "\n";
echo "---------- CALL STATUS STATS\n";
echo "+--------+----------------------+------------+\n";
echo "| STATUS | DESCRIPTION | CALLS |\n";
echo "+--------+----------------------+------------+\n";
$stmt="SELECT * from vicidial_statuses order by status";
$rslt=mysql_query($stmt, $link);
$statuses_to_print = mysql_num_rows($rslt);
$statuses_list='';
$o=0;
while ($statuses_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
$statname_list["$rowx[0]"] = "$rowx[1]";
$o++;
}
$stmt="SELECT * from vicidial_campaign_statuses order by status";
$rslt=mysql_query($stmt, $link);
$Cstatuses_to_print = mysql_num_rows($rslt);
$o=0;
while ($Cstatuses_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
$statname_list["$rowx[0]"] = "$rowx[1]";
$o++;
}
$stmt="select count(*),status from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$statuses_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $statuses_to_print)
{
$row=mysql_fetch_row($rslt);
$TOTALcalls = ($TOTALcalls + $row[0]);
$STATUScount = sprintf("%10s", $row[0]);while(strlen($STATUScount)>10) {$STATUScount = substr("$STATUScount", 0, -1);}
$RAWstatus = $row[1];
$status = sprintf("%-6s", $row[1]);while(strlen($status)>6) {$status = substr("$status", 0, -1);}
if ($non_latin < 1)
{
$status_name = sprintf("%-20s", $statname_list[$RAWstatus]);
while(strlen($status_name)>20) {$status_name = substr("$status_name", 0, -1);}
}
else
{
$status_name = sprintf("%-60s", $statname_list[$RAWstatus]);
while(mb_strlen($status_name,'utf-8')>20) {$status_name = mb_substr("$status_name", 0, -1,'utf-8');}
}
echo "| $status | $status_name | $STATUScount |\n";
$i++;
}
$TOTALcalls = sprintf("%10s", $TOTALcalls);
echo "+--------+----------------------+------------+\n";
echo "| TOTAL: | $TOTALcalls |\n";
echo "+-------------------------------+------------+\n";
echo "\n";
echo "---------- QUEUE STATS\n";
$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and (queue_seconds > 0);";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$QUEUEcalls = sprintf("%10s", $row[0]);
if ( ($QUEUEcalls < 1) or ($TOTALcalls < 1) )
{$QUEUEpercent = '0';}
else
{
$QUEUEpercent = (($QUEUEcalls / $TOTALcalls) * 100);
$QUEUEpercent = round($QUEUEpercent, 0);
}
if ( ($row[0] < 1) or ($row[1] < 1) )
{$average_queue_seconds = ' 0';}
else
{
$average_queue_seconds = ($row[1] / $row[0]);
$average_queue_seconds = round($average_queue_seconds, 2);
$average_queue_seconds = sprintf("%10.2f", $average_queue_seconds);
}
if ( ($TOTALcalls < 1) or ($row[1] < 1) )
{$average_total_queue_seconds = ' 0';}
else
{
$average_total_queue_seconds = ($row[1] / $TOTALcalls);
$average_total_queue_seconds = round($average_total_queue_seconds, 2);
$average_total_queue_seconds = sprintf("%10.2f", $average_total_queue_seconds);
}
echo "Total Calls That entered Queue: $QUEUEcalls $QUEUEpercent%\n";
echo "Average QUEUE Length for queue calls: $average_queue_seconds seconds\n";
echo "Average QUEUE Length across all calls: $average_total_queue_seconds seconds\n";
##############################
######### USER STATS
$TOTagents=0;
$TOTcalls=0;
$TOTtime=0;
$TOTavg=0;
echo "\n";
echo "---------- AGENT STATS\n";
echo "+--------------------------+------------+----------+--------+\n";
echo "| AGENT | CALLS | TIME M | AVRG M |\n";
echo "+--------------------------+------------+----------+--------+\n";
$stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$users_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $users_to_print)
{
$row=mysql_fetch_row($rslt);
$TOTcalls = ($TOTcalls + $row[2]);
$TOTtime = ($TOTtime + $row[3]);
$user = sprintf("%-6s", $row[0]);
$full_name = sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
$USERcalls = sprintf("%10s", $row[2]);
$USERtotTALK = $row[3];
$USERavgTALK = $row[4];
$USERtotTALK_M = ($USERtotTALK / 60);
$USERtotTALK_M = round($USERtotTALK_M, 2);
$USERtotTALK_M_int = intval("$USERtotTALK_M");
$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
$USERtotTALK_S = ($USERtotTALK_S * 60);
$USERtotTALK_S = round($USERtotTALK_S, 0);
if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
$USERtotTALK_MS = sprintf("%8s", $USERtotTALK_MS);
$USERavgTALK_M = ($USERavgTALK / 60);
$USERavgTALK_M = round($USERavgTALK_M, 2);
$USERavgTALK_M_int = intval("$USERavgTALK_M");
$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
$USERavgTALK_S = ($USERavgTALK_S * 60);
$USERavgTALK_S = round($USERavgTALK_S, 0);
if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
$USERavgTALK_MS = sprintf("%6s", $USERavgTALK_MS);
echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
$i++;
}
if (!$TOTcalls) {$TOTcalls = 1;}
$TOTavg = ($TOTtime / $TOTcalls);
$TOTavg = round($TOTavg, 0);
$TOTavg_M = ($TOTavg / 60);
$TOTavg_M = round($TOTavg_M, 2);
$TOTavg_M_int = intval("$TOTavg_M");
$TOTavg_S = ($TOTavg_M - $TOTavg_M_int);
$TOTavg_S = ($TOTavg_S * 60);
$TOTavg_S = round($TOTavg_S, 0);
if ($TOTavg_S < 10) {$TOTavg_S = "0$TOTavg_S";}
$TOTavg_MS = "$TOTavg_M_int:$TOTavg_S";
$TOTavg = sprintf("%6s", $TOTavg_MS);
$TOTtime_M = ($TOTtime / 60);
$TOTtime_M = round($TOTtime_M, 2);
$TOTtime_M_int = intval("$TOTtime_M");
$TOTtime_S = ($TOTtime_M - $TOTtime_M_int);
$TOTtime_S = ($TOTtime_S * 60);
$TOTtime_S = round($TOTtime_S, 0);
if ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
$TOTtime = sprintf("%6s", $TOTtime_MS);
$TOTagents = sprintf("%10s", $i);
$TOTcalls = sprintf("%10s", $TOTcalls);
$TOTtime = sprintf("%8s", $TOTtime);
$TOTavg = sprintf("%6s", $TOTavg);
echo "+--------------------------+------------+----------+--------+\n";
echo "| TOTAL Agents: $TOTagents | $TOTcalls | $TOTtime | $TOTavg |\n";
echo "+--------------------------+------------+----------+--------+\n";
##############################
######### TIME STATS
echo "\n";
echo "---------- TIME STATS\n";
echo "<FONT SIZE=0>\n";
$hi_hour_count=0;
$last_full_record=0;
$i=0;
$h=0;
while ($i <= 96)
{
$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$hour_count[$i] = $row[0];
if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
if ($hour_count[$i] > 0) {$last_full_record = $i;}
$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$drop_count[$i] = $row[0];
$i++;
$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$hour_count[$i] = $row[0];
if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
if ($hour_count[$i] > 0) {$last_full_record = $i;}
$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$drop_count[$i] = $row[0];
$i++;
$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$hour_count[$i] = $row[0];
if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
if ($hour_count[$i] > 0) {$last_full_record = $i;}
$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$drop_count[$i] = $row[0];
$i++;
$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$hour_count[$i] = $row[0];
if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
if ($hour_count[$i] > 0) {$last_full_record = $i;}
$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$drop_count[$i] = $row[0];
$i++;
$h++;
}
if ($hi_hour_count < 1)
{$hour_multiplier = 0;}
else
{
$hour_multiplier = (100 / $hi_hour_count);
#$hour_multiplier = round($hour_multiplier, 0);
}
echo "<!-- HICOUNT: $hi_hour_count|$hour_multiplier -->\n";
echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS PLACED FROM THIS CAMPAIGN\n";
$k=1;
$Mk=0;
$call_scale = '0';
while ($k <= 102)
{
if ($Mk >= 5)
{
$Mk=0;
if ( ($k < 1) or ($hour_multiplier <= 0) )
{$scale_num = 100;}
else
{
$scale_num=($k / $hour_multiplier);
$scale_num = round($scale_num, 0);
}
$LENscale_num = (strlen($scale_num));
$k = ($k + $LENscale_num);
$call_scale .= "$scale_num";
}
else
{
$call_scale .= " ";
$k++; $Mk++;
}
}
echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP | DROPS | TOTAL |\n";
echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
$ZZ = '00';
$i=0;
$h=4;
$hour= -1;
$no_lines_yet=1;
while ($i <= 96)
{
$char_counter=0;
$time = ' ';
if ($h >= 4)
{
$hour++;
$h=0;
if ($hour < 10) {$hour = "0$hour";}
$time = "+$hour$ZZ+";
}
if ($h == 1) {$time = " 15 ";}
if ($h == 2) {$time = " 30 ";}
if ($h == 3) {$time = " 45 ";}
$Ghour_count = $hour_count[$i];
if ($Ghour_count < 1)
{
if ( ($no_lines_yet) or ($i > $last_full_record) )
{
$do_nothing=1;
}
else
{
$hour_count[$i] = sprintf("%-5s", $hour_count[$i]);
echo "|$time|";
$k=0; while ($k <= 102) {echo " "; $k++;}
echo "| $hour_count[$i] |\n";
}
}
else
{
$no_lines_yet=0;
$Xhour_count = ($Ghour_count * $hour_multiplier);
$Yhour_count = (99 - $Xhour_count);
$Gdrop_count = $drop_count[$i];
if ($Gdrop_count < 1)
{
$hour_count[$i] = sprintf("%-5s", $hour_count[$i]);
echo "|$time|<SPAN class=\"green\">";
$k=0; while ($k <= $Xhour_count) {echo "*"; $k++; $char_counter++;}
echo "*X</SPAN>"; $char_counter++;
$k=0; while ($k <= $Yhour_count) {echo " "; $k++; $char_counter++;}
while ($char_counter <= 101) {echo " "; $char_counter++;}
echo "| 0 | $hour_count[$i] |\n";
}
else
{
$Xdrop_count = ($Gdrop_count * $hour_multiplier);
# if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
$hour_count[$i] = sprintf("%-5s", $hour_count[$i]);
$drop_count[$i] = sprintf("%-5s", $drop_count[$i]);
echo "|$time|<SPAN class=\"red\">";
$k=0; while ($k <= $Xdrop_count) {echo ">"; $k++; $char_counter++;}
echo "D</SPAN><SPAN class=\"green\">"; $char_counter++;
$k=0; while ($k <= $XXhour_count) {echo "*"; $k++; $char_counter++;}
echo "X</SPAN>"; $char_counter++;
$k=0; while ($k <= $Yhour_count) {echo " "; $k++; $char_counter++;}
while ($char_counter <= 102) {echo " "; $char_counter++;}
echo "| $drop_count[$i] | $hour_count[$i] |\n";
}
}
$i++;
$h++;
}
echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n\n";
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\nRun Time: $RUNtime seconds\n";
}
?>
</PRE>
</BODY></HTML>
-647
View File
@@ -1,647 +0,0 @@
<?
### AST_VDADstats.php
###
### Copyright (C) 2007 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
# CHANGES
#
# 60619-1718 - Added variable filtering to eliminate SQL injection attack threat
# - Added required user/pass to gain access to this page
# 61215-1139 - Added drop percentage of answered and round-2 decimal
# 71008-1436 - Added shift to be defined in dbconnect.php
#
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["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];}
elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];}
if (isset($_GET["shift"])) {$shift=$_GET["shift"];}
elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];}
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);
if (strlen($shift)<2) {$shift='ALL';}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
if (!isset($group)) {$group = '';}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="select campaign_id from vicidial_campaigns;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$groups_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $groups_to_print)
{
$row=mysql_fetch_row($rslt);
$groups[$i] =$row[0];
$i++;
}
?>
<HTML>
<HEAD>
<STYLE type="text/css">
<!--
.green {color: white; background-color: green}
.red {color: white; background-color: red}
.blue {color: white; background-color: blue}
.purple {color: white; background-color: purple}
-->
</STYLE>
<?
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>VICIDIAL: VDAD Stats</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
echo "<INPUT TYPE=TEXT NAME=query_date SIZE=10 MAXLENGTH=10 VALUE=\"$query_date\">\n";
echo "<SELECT SIZE=1 NAME=group>\n";
$o=0;
while ($groups_to_print > $o)
{
if ($groups[$o] == $group) {echo "<option selected value=\"$groups[$o]\">$groups[$o]</option>\n";}
else {echo "<option value=\"$groups[$o]\">$groups[$o]</option>\n";}
$o++;
}
echo "</SELECT>\n";
echo "<SELECT SIZE=1 NAME=shift>\n";
echo "<option selected value=\"$shift\">$shift</option>\n";
echo "<option value=\"\">--</option>\n";
echo "<option value=\"AM\">AM</option>\n";
echo "<option value=\"PM\">PM</option>\n";
echo "<option value=\"ALL\">ALL</option>\n";
echo "</SELECT>\n";
echo "<INPUT type=submit NAME=SUBMIT VALUE=SUBMIT>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href=\"./admin.php?ADD=34&campaign_id=$group\">MODIFY</a> | <a href=\"./admin.php?ADD=999999\">REPORTS</a> </FONT>\n";
echo "</FORM>\n\n";
echo "<PRE><FONT SIZE=2>\n\n";
if (!$group)
{
echo "\n\n";
echo "PLEASE SELECT A CAMPAIGN AND DATE ABOVE AND CLICK SUBMIT\n";
}
else
{
if ($shift == 'AM')
{
$time_BEGIN=$AM_shift_BEGIN;
$time_END=$AM_shift_END;
if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}
if (strlen($time_END) < 6) {$time_END = "15:15:00";}
}
if ($shift == 'PM')
{
$time_BEGIN=$PM_shift_BEGIN;
$time_END=$PM_shift_END;
if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
if (strlen($time_END) < 6) {$time_END = "23:15:00";}
}
if ($shift == 'ALL')
{
if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
if (strlen($time_END) < 6) {$time_END = "23:59:59";}
}
$query_date_BEGIN = "$query_date $time_BEGIN";
$query_date_END = "$query_date $time_END";
echo "VICIDIAL: Auto-dial Stats $NOW_TIME\n";
echo "\n";
echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
echo "---------- TOTALS\n";
$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$TOTALcalls = sprintf("%10s", $row[0]);
if ( ($row[0] < 1) or ($row[1] < 1) )
{$average_hold_seconds = ' 0';}
else
{
$average_hold_seconds = ($row[1] / $row[0]);
$average_hold_seconds = round($average_hold_seconds, 2);
$average_hold_seconds = sprintf("%10s", $average_hold_seconds);
}
echo "Total Calls placed from this Campaign: $TOTALcalls\n";
echo "Average Call Length for all Calls in seconds: $average_hold_seconds\n";
echo "\n";
echo "---------- DROPS\n";
$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP' and (length_in_sec <= 60 or length_in_sec is null);";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$DROPcalls = sprintf("%10s", $row[0]);
$DROPcallsRAW = $row[0];
$DROPseconds = $row[1];
$stmt="select count(*) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status NOT IN('NA','B');";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$ANSWERcalls = $row[0];
if ( ($DROPcalls < 1) or ($TOTALcalls < 1) )
{$DROPpercent = '0';}
else
{
$DROPpercent = (($DROPcallsRAW / $TOTALcalls) * 100);
$DROPpercent = round($DROPpercent, 2);
}
if ( ($DROPcalls < 1) or ($ANSWERcalls < 1) )
{$DROPANSWERpercent = '0';}
else
{
$DROPANSWERpercent = (($DROPcallsRAW / $ANSWERcalls) * 100);
$DROPANSWERpercent = round($DROPANSWERpercent, 2);
}
if ( ($DROPseconds < 1) or ($DROPcallsRAW < 1) )
{$average_hold_seconds = ' 0';}
else
{
$average_hold_seconds = ($DROPseconds / $DROPcallsRAW);
$average_hold_seconds = round($average_hold_seconds, 2);
$average_hold_seconds = sprintf("%10s", $average_hold_seconds);
}
echo "Total DROP Calls: $DROPcalls $DROPpercent%\n";
echo "Percent of DROP Calls taken out of Answers: $DROPcalls / $ANSWERcalls $DROPANSWERpercent%\n";
echo "Average Length for DROP Calls in seconds: $average_hold_seconds\n";
echo "\n";
echo "---------- AUTO-DIAL NO ANSWERS\n";
$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status IN('NA','B') and (length_in_sec <= 60 or length_in_sec is null);";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$NAcalls = sprintf("%10s", $row[0]);
if ( ($NAcalls < 1) or ($TOTALcalls < 1) )
{$NApercent = '0';}
else
{
$NApercent = (($NAcalls / $TOTALcalls) * 100);
$NApercent = round($NApercent, 2);
}
if ( ($row[0] < 1) or ($row[1] < 1) )
{$average_na_seconds = ' 0';}
else
{
$average_na_seconds = ($row[1] / $row[0]);
$average_na_seconds = round($average_na_seconds, 2);
$average_na_seconds = sprintf("%10s", $average_na_seconds);
}
echo "Total NA calls -Busy,Disconnect,RingNoAnswer: $NAcalls $NApercent%\n";
echo "Average Call Length for NA Calls in seconds: $average_na_seconds\n";
##############################
######### CALL STATUS STATS
$TOTALcalls = 0;
echo "\n";
echo "---------- CALL STATUS STATS\n";
echo "+--------+----------------------+------------+\n";
echo "| STATUS | DESCRIPTION | CALLS |\n";
echo "+--------+----------------------+------------+\n";
$stmt="SELECT * from vicidial_statuses order by status";
$rslt=mysql_query($stmt, $link);
$statuses_to_print = mysql_num_rows($rslt);
$statuses_list='';
$o=0;
while ($statuses_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
$statname_list["$rowx[0]"] = "$rowx[1]";
$o++;
}
$stmt="SELECT * from vicidial_campaign_statuses where campaign_id='" . mysql_real_escape_string($group) . "' order by status";
$rslt=mysql_query($stmt, $link);
$Cstatuses_to_print = mysql_num_rows($rslt);
$o=0;
while ($Cstatuses_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
$statname_list["$rowx[0]"] = "$rowx[1]";
$o++;
}
$stmt="select count(*),status from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$statuses_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $statuses_to_print)
{
$row=mysql_fetch_row($rslt);
$TOTALcalls = ($TOTALcalls + $row[0]);
$STATUScount = sprintf("%10s", $row[0]);while(strlen($STATUScount)>10) {$STATUScount = substr("$STATUScount", 0, -1);}
$RAWstatus = $row[1];
$status = sprintf("%-6s", $row[1]);while(strlen($status)>6) {$status = substr("$status", 0, -1);}
if ($non_latin < 1)
{
$status_name = sprintf("%-20s", $statname_list[$RAWstatus]);
while(strlen($status_name)>20) {$status_name = substr("$status_name", 0, -1);}
}
else
{
$status_name = sprintf("%-60s", $statname_list[$RAWstatus]);
while(mb_strlen($status_name,'utf-8')>20) {$status_name = mb_substr("$status_name", 0, -1,'utf-8');}
}
echo "| $status | $status_name | $STATUScount |\n";
$i++;
}
$TOTALcalls = sprintf("%10s", $TOTALcalls);
echo "+--------+----------------------+------------+\n";
echo "| TOTAL: | $TOTALcalls |\n";
echo "+-------------------------------+------------+\n";
##############################
######### USER STATS
$TOTagents=0;
$TOTcalls=0;
$TOTtime=0;
$TOTavg=0;
echo "\n";
echo "---------- AGENT STATS\n";
echo "+--------------------------+------------+----------+--------+\n";
echo "| AGENT | CALLS | TIME M | AVRG M |\n";
echo "+--------------------------+------------+----------+--------+\n";
$stmt="select vicidial_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_log.user=vicidial_users.user group by vicidial_log.user;";
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$users_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $users_to_print)
{
$row=mysql_fetch_row($rslt);
$TOTcalls = ($TOTcalls + $row[2]);
$TOTtime = ($TOTtime + $row[3]);
$user = sprintf("%-6s", $row[0]);while(strlen($user)>6) {$user = substr("$user", 0, -1);}
if ($non_latin < 1)
{
$full_name = sprintf("%-15s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
}
else
{
$full_name = sprintf("%-45s", $row[1]); while(mb_strlen($full_name,'utf-8')>15) {$full_name = mb_substr("$full_name", 0, -1,'utf-8');}
}
$USERcalls = sprintf("%10s", $row[2]);
$USERtotTALK = $row[3];
$USERavgTALK = $row[4];
$USERtotTALK_M = ($USERtotTALK / 60);
$USERtotTALK_M = round($USERtotTALK_M, 2);
$USERtotTALK_M_int = intval("$USERtotTALK_M");
$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
$USERtotTALK_S = ($USERtotTALK_S * 60);
$USERtotTALK_S = round($USERtotTALK_S, 0);
if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
$USERtotTALK_MS = sprintf("%6s", $USERtotTALK_MS);
$USERavgTALK_M = ($USERavgTALK / 60);
$USERavgTALK_M = round($USERavgTALK_M, 2);
$USERavgTALK_M_int = intval("$USERavgTALK_M");
$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
$USERavgTALK_S = ($USERavgTALK_S * 60);
$USERavgTALK_S = round($USERavgTALK_S, 0);
if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
$USERavgTALK_MS = sprintf("%6s", $USERavgTALK_MS);
echo "| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n";
$i++;
}
if (!$TOTcalls) {$TOTcalls = 1;}
$TOTavg = ($TOTtime / $TOTcalls);
$TOTavg = round($TOTavg, 0);
$TOTavg_M = ($TOTavg / 60);
$TOTavg_M = round($TOTavg_M, 2);
$TOTavg_M_int = intval("$TOTavg_M");
$TOTavg_S = ($TOTavg_M - $TOTavg_M_int);
$TOTavg_S = ($TOTavg_S * 60);
$TOTavg_S = round($TOTavg_S, 0);
if ($TOTavg_S < 10) {$TOTavg_S = "0$TOTavg_S";}
$TOTavg_MS = "$TOTavg_M_int:$TOTavg_S";
$TOTavg = sprintf("%6s", $TOTavg_MS);
$TOTtime_M = ($TOTtime / 60);
$TOTtime_M = round($TOTtime_M, 2);
$TOTtime_M_int = intval("$TOTtime_M");
$TOTtime_S = ($TOTtime_M - $TOTtime_M_int);
$TOTtime_S = ($TOTtime_S * 60);
$TOTtime_S = round($TOTtime_S, 0);
if ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
$TOTtime = sprintf("%6s", $TOTtime_MS);
$TOTagents = sprintf("%10s", $i);
$TOTcalls = sprintf("%10s", $TOTcalls);
$TOTtime = sprintf("%8s", $TOTtime);
$TOTavg = sprintf("%6s", $TOTavg);
$stmt="select avg(wait_sec) from vicidial_agent_log where event_time >= '$query_date_BEGIN' and event_time <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$AVGwait = $row[0];
$AVGwait_M = ($AVGwait / 60);
$AVGwait_M = round($AVGwait_M, 2);
$AVGwait_M_int = intval("$AVGwait_M");
$AVGwait_S = ($AVGwait_M - $AVGwait_M_int);
$AVGwait_S = ($AVGwait_S * 60);
$AVGwait_S = round($AVGwait_S, 0);
if ($AVGwait_S < 10) {$AVGwait_S = "0$AVGwait_S";}
$AVGwait_MS = "$AVGwait_M_int:$AVGwait_S";
$AVGwait = sprintf("%6s", $AVGwait_MS);
echo "+--------------------------+------------+----------+--------+\n";
echo "| TOTAL Agents: $TOTagents | $TOTcalls | $TOTtime | $TOTavg |\n";
echo "+--------------------------+------------+----------+--------+\n";
echo "| Average Wait time between calls $AVGwait |\n";
echo "+-----------------------------------------------------------+\n";
##############################
######### TIME STATS
echo "\n";
echo "---------- TIME STATS\n";
echo "<FONT SIZE=0>\n";
$hi_hour_count=0;
$last_full_record=0;
$i=0;
$h=0;
while ($i <= 96)
{
$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$hour_count[$i] = $row[0];
if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
if ($hour_count[$i] > 0) {$last_full_record = $i;}
$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$drop_count[$i] = $row[0];
$i++;
$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$hour_count[$i] = $row[0];
if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
if ($hour_count[$i] > 0) {$last_full_record = $i;}
$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$drop_count[$i] = $row[0];
$i++;
$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$hour_count[$i] = $row[0];
if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
if ($hour_count[$i] > 0) {$last_full_record = $i;}
$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$drop_count[$i] = $row[0];
$i++;
$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$hour_count[$i] = $row[0];
if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
if ($hour_count[$i] > 0) {$last_full_record = $i;}
$stmt="select count(*) from vicidial_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$drop_count[$i] = $row[0];
$i++;
$h++;
}
if ($hi_hour_count < 1)
{$hour_multiplier = 0;}
else
{
$hour_multiplier = (100 / $hi_hour_count);
#$hour_multiplier = round($hour_multiplier, 0);
}
echo "<!-- HICOUNT: $hi_hour_count|$hour_multiplier -->\n";
echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS PLACED FROM THIS CAMPAIGN\n";
$k=1;
$Mk=0;
$call_scale = '0';
while ($k <= 102)
{
if ($Mk >= 5)
{
$Mk=0;
if ( ($k < 1) or ($hour_multiplier <= 0) )
{$scale_num = 100;}
else
{
$scale_num=($k / $hour_multiplier);
$scale_num = round($scale_num, 0);
}
$LENscale_num = (strlen($scale_num));
$k = ($k + $LENscale_num);
$call_scale .= "$scale_num";
}
else
{
$call_scale .= " ";
$k++; $Mk++;
}
}
echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP | DROPS | TOTAL |\n";
echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
$ZZ = '00';
$i=0;
$h=4;
$hour= -1;
$no_lines_yet=1;
while ($i <= 96)
{
$char_counter=0;
$time = ' ';
if ($h >= 4)
{
$hour++;
$h=0;
if ($hour < 10) {$hour = "0$hour";}
$time = "+$hour$ZZ+";
}
if ($h == 1) {$time = " 15 ";}
if ($h == 2) {$time = " 30 ";}
if ($h == 3) {$time = " 45 ";}
$Ghour_count = $hour_count[$i];
if ($Ghour_count < 1)
{
if ( ($no_lines_yet) or ($i > $last_full_record) )
{
$do_nothing=1;
}
else
{
$hour_count[$i] = sprintf("%-5s", $hour_count[$i]);
echo "|$time|";
$k=0; while ($k <= 102) {echo " "; $k++;}
echo "| $hour_count[$i] |\n";
}
}
else
{
$no_lines_yet=0;
$Xhour_count = ($Ghour_count * $hour_multiplier);
$Yhour_count = (99 - $Xhour_count);
$Gdrop_count = $drop_count[$i];
if ($Gdrop_count < 1)
{
$hour_count[$i] = sprintf("%-5s", $hour_count[$i]);
echo "|$time|<SPAN class=\"green\">";
$k=0; while ($k <= $Xhour_count) {echo "*"; $k++; $char_counter++;}
echo "*X</SPAN>"; $char_counter++;
$k=0; while ($k <= $Yhour_count) {echo " "; $k++; $char_counter++;}
while ($char_counter <= 101) {echo " "; $char_counter++;}
echo "| 0 | $hour_count[$i] |\n";
}
else
{
$Xdrop_count = ($Gdrop_count * $hour_multiplier);
# if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
$hour_count[$i] = sprintf("%-5s", $hour_count[$i]);
$drop_count[$i] = sprintf("%-5s", $drop_count[$i]);
echo "|$time|<SPAN class=\"red\">";
$k=0; while ($k <= $Xdrop_count) {echo ">"; $k++; $char_counter++;}
echo "D</SPAN><SPAN class=\"green\">"; $char_counter++;
$k=0; while ($k <= $XXhour_count) {echo "*"; $k++; $char_counter++;}
echo "X</SPAN>"; $char_counter++;
$k=0; while ($k <= $Yhour_count) {echo " "; $k++; $char_counter++;}
while ($char_counter <= 102) {echo " "; $char_counter++;}
echo "| $drop_count[$i] | $hour_count[$i] |\n";
}
}
$i++;
$h++;
}
echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\nRun Time: $RUNtime seconds\n";
}
?>
</PRE>
</BODY></HTML>
@@ -1,169 +0,0 @@
<?
### AST_VICIDIAL_hopperlist.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
# CHANGES
#
# 60619-1654 - Added variable filtering to eliminate SQL injection attack threat
# - Added required user/pass to gain access to this page
# 70115-1614 - Added ALT field for vicidial_hopper alt_dial column
# 71029-0852 - Added list_id to the output
# 71030-2118 - Added priority to display
#
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["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
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);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and modify_campaigns='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
if (!isset($group)) {$group = '';}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
if (!isset($server_ip)) {$server_ip = '10.10.10.15';}
$stmt="select campaign_id,campaign_name from vicidial_campaigns order by campaign_id;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$campaigns_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $campaigns_to_print)
{
$row=mysql_fetch_row($rslt);
$campaign_id[$i] =$row[0];
$campaign_name[$i] =$row[1];
$i++;
}
?>
<HTML>
<HEAD>
<STYLE type="text/css">
<!--
.green {color: white; background-color: green}
.red {color: white; background-color: red}
.blue {color: white; background-color: blue}
.purple {color: white; background-color: purple}
-->
</STYLE>
<?
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>VICIDIAL: Hopper List</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
#echo "<INPUT TYPE=HIDDEN NAME=server_ip VALUE=\"$server_ip\">\n";
#echo "<INPUT TYPE=TEXT NAME=query_date SIZE=10 MAXLENGTH=10 VALUE=\"$query_date\">\n";
echo "<SELECT SIZE=1 NAME=group>\n";
$o=0;
while ($campaigns_to_print > $o)
{
if ($campaign_id[$o] == $group) {echo "<option selected value=\"$campaign_id[$o]\">$campaign_id[$o] - $campaign_name[$o]</option>\n";}
else {echo "<option value=\"$campaign_id[$o]\">$campaign_id[$o] - $campaign_name[$o]</option>\n";}
$o++;
}
echo "</SELECT>\n";
echo "<INPUT TYPE=SUBMIT NAME=SUBMIT VALUE=SUBMIT>\n";
echo " &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href=\"./admin.php?ADD=34&campaign_id=$group\">MODIFY</a> \n";
echo "</FORM>\n\n";
echo "<PRE><FONT SIZE=2>\n\n";
if (!$group)
{
echo "\n\n";
echo "PLEASE SELECT A CAMPAIGN ABOVE AND CLICK SUBMIT\n";
}
else
{
echo "VICIDIAL: Live Current Hopper List $NOW_TIME\n";
echo "\n";
echo "---------- TOTALS\n";
$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$TOTALcalls = sprintf("%10s", $row[0]);
echo "Total leads in hopper right now: $TOTALcalls\n";
##############################
######### LEAD STATS
echo "\n";
echo "---------- LEADS IN HOPPER\n";
echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
echo "|ORDER |PRIORITY| LEAD ID | LIST ID | PHONE NUM | STATE | STATUS | COUNT | GMT | ALT |\n";
echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
$stmt="select vicidial_hopper.lead_id,phone_number,vicidial_hopper.state,vicidial_list.status,called_count,vicidial_hopper.gmt_offset_now,hopper_id,alt_dial,vicidial_hopper.list_id,vicidial_hopper.priority from vicidial_hopper,vicidial_list where vicidial_hopper.campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_hopper.lead_id=vicidial_list.lead_id order by priority desc,hopper_id limit 2000;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$users_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $users_to_print)
{
$row=mysql_fetch_row($rslt);
$FMT_i = sprintf("%-4s", $i);
$lead_id = sprintf("%-9s", $row[0]);
$phone_number = sprintf("%-10s", $row[1]);
$state = sprintf("%-5s", $row[2]);
$status = sprintf("%-6s", $row[3]);
$count = sprintf("%-5s", $row[4]);
$gmt = sprintf("%-6s", $row[5]);
$hopper_id = sprintf("%-6s", $row[6]);
$alt_dial = sprintf("%-5s", $row[7]);
$list_id = sprintf("%-10s", $row[8]);
$priority = sprintf("%-6s", $row[9]);
if ($DB) {echo "| $FMT_i | $priority | $lead_id | $list_id | $phone_number | $state | $status | $count | $gmt | $hopper_id |\n";}
else {echo "| $FMT_i | $priority | $lead_id | $list_id | $phone_number | $state | $status | $count | $gmt | $alt_dial |\n";}
$i++;
}
echo "+------+--------+-----------+------------+------------+-------+--------+-------+--------+-------+\n";
}
?>
</PRE>
</BODY></HTML>
@@ -1,118 +0,0 @@
<?
### AST_admin_log_display.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
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["query_date"])) {$query_date=$_GET["query_date"];}
elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];}
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);
$query_date = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$query_date);
# AST GUI database administration
# AST_admin_log_display.php
#
# CHANGES
# 50325-0932 - First build
# 51123-1443 - removed globals=on requirement
# 60421-1229 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60620-1044 - Added variable filtering to eliminate SQL injection attack threat
#
$version = '0.0.4';
$build = '60620-1044';
$STARTtime = date("U");
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 8 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
$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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
else
{
if($auth>0)
{
$office_no=strtoupper($PHP_AUTH_USER);
$password=strtoupper($PHP_AUTH_PW);
$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);
}
}
echo "<html>\n";
echo "<head>\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<!-- VERSION: $version BUILD: $build ADD: $ADD-->\n";
echo "<title>VICIDIAL ADMIN LOG DISPLAY</title>";
echo "</head>\n";
# Fri, 25 Mar 2005
$DAY_DATE = date("j");
if ($DAY_DATE < 10)
# {$GREP_DATE = date("D, j M Y");}
{$GREP_DATE = date("D, 0j M Y");}
else
{$GREP_DATE = date("D, j M Y");}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
if (!$query_date) {$query_date = $GREP_DATE;}
$Gquery_date = eregi_replace(" ",'\ ',$query_date);
echo "<!-- |$query_date|$Gquery_date| -->\n";
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
echo "<INPUT TYPE=TEXT NAME=query_date SIZE=20 MAXLENGTH=20 VALUE=\"$query_date\">\n";
echo "<INPUT TYPE=SUBMIT NAME=SUBMIT VALUE=SUBMIT>\n";
echo "</FORM>\n\n";
echo "<PRE><FONT SIZE=2>\n\n";
echo "VICIDIAL ADMIN CHANGE LOG $NOW_TIME\n";
#passthru("grep $Gquery_date /home/www/htdocs/vicidial/admin_changes_log.txt");
passthru("grep $Gquery_date $WeBServeRRooT/vicidial/admin_changes_log.txt");
?>
</PRE>
</BODY></HTML>
@@ -1,237 +0,0 @@
<?
### AST_agent_disposition.php
### Date Range - Agent/Campaign Disposition (Perfect Network Corporation)
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
# CHANGES
#
# 70201-1213 - First build - from Marin Blu
#
#
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["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];}
elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];}
if (isset($_GET["shift"])) {$shift=$_GET["shift"];}
elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];}
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);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
if (!isset($group)) {$group = '';}
if (!isset($begin_date)) {$begin_date = $NOW_DATE;}
if (!isset($end_date)) {$end_date = $NOW_DATE;}
$stmt="select campaign_id from vicidial_campaigns;";
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$campaigns_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $campaigns_to_print)
{
$row=mysql_fetch_row($rslt);
$groups[$i] =$row[0];
$i++;
}
?>
<HTML>
<HEAD>
<STYLE type="text/css">
<!--
.green {color: white; background-color: green}
.red {color: white; background-color: red}
.blue {color: white; background-color: blue}
.purple {color: white; background-color: purple}
-->
</STYLE>
<?
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>VICIDIAL: Agent Disposition</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>Date - From: <input type=text name=begin_date value=\"$begin_date\" size=10 maxsize=10> to \n";
echo "<input type=text name=end_date value=\"$end_date\" size=10 maxsize=10> &nbsp;\n";
echo "<SELECT SIZE=1 NAME=group>\n";
$o=0;
while ($campaigns_to_print > $o)
{
if ($groups[$o] == $group) {echo "<option selected value=\"$groups[$o]\">$groups[$o]</option>\n";}
else {echo "<option value=\"$groups[$o]\">$groups[$o]</option>\n";}
$o++;
}
echo "</SELECT>\n";
echo "<INPUT TYPE=SUBMIT NAME=SUBMIT VALUE=SUBMIT>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href=\"./admin.php?ADD=34&campaign_id=$group\">MODIFY</a> | <a href=\"./server_stats.php\">REPORTS</a> </FONT>\n";
echo "</FORM>\n\n";
echo "<PRE><FONT SIZE=2>\n";
if (!$group)
{
echo "\n";
echo "PLEASE SELECT A SERVER AND DATE ABOVE AND CLICK SUBMIT\n";
}
else
{
echo "VICIDIAL: Agent Disposition $NOW_TIME\n";
echo "Time range: $begin_date to $end_date \n\n";
echo "---------- Disposition Details -------------\n\n";
echo "+-----------------+------------+--------+--------+--------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+\n";
echo "| USER NAME | ID | CALLS | TALK | TALKAVG| A | B |CALLBK|CBHOLD| DEC | DC | DNC | DROP |INCALL| LB | N | NA | NI | NP | NQ |QUEUE | SALE | XFER |\n";
echo "+-----------------+------------+--------+--------+--------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+\n";
$stmt="select count(*) as calls,sum(length_in_sec) as talk,full_name,vicidial_users.user,avg(length_in_sec) from vicidial_users,vicidial_log where call_date >= '$begin_date 00:00:01' and call_date <= '$end_date 23:59:59' and vicidial_users.user=vicidial_log.user and campaign_id='" . mysql_real_escape_string($group) . "' group by full_name order by calls desc limit 1000;";
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$rows_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $rows_to_print)
{
$row=mysql_fetch_row($rslt);
$TOTcalls=($TOTcalls + $row[0]);
$TOTtotTALK=($TOTtotTALK + $row[1]);
$calls[$i] = sprintf("%-6s", $row[0]);
$full_name[$i]= sprintf("%-15s", $row[2]); while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
$user[$i] = sprintf("%-10s", $row[3]); while(strlen($user[$i])>10) {$user[$i] = substr("$user[$i]", 0, -1);}
$USERtotTALK = $row[1];
$USERavgTALK = $row[4];
$USERtotTALK_M = ($USERtotTALK / 60);
$USERtotTALK_M = round($USERtotTALK_M, 2);
$USERtotTALK_M_int = intval("$USERtotTALK_M");
$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
$USERtotTALK_S = ($USERtotTALK_S * 60);
$USERtotTALK_S = round($USERtotTALK_S, 0);
if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
$pfUSERtotTALK_MS[$i] = sprintf("%6s", $USERtotTALK_MS);
$USERavgTALK_M = ($USERavgTALK / 60);
$USERavgTALK_M = round($USERavgTALK_M, 2);
$USERavgTALK_M_int = intval("$USERavgTALK_M");
$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
$USERavgTALK_S = ($USERavgTALK_S * 60);
$USERavgTALK_S = round($USERavgTALK_S, 0);
if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
$pfUSERavgTALK_MS[$i] = sprintf("%6s", $USERavgTALK_MS);
$i++;
}
$k=0;
while($k < $i)
{
$ctA[$k]="0 "; $ctB[$k]="0 "; $ctDC[$k]="0 "; $ctDNC[$k]="0 "; $ctN[$k]="0 "; $ctNI[$k]="0 "; $ctSALE[$k]="0 "; $ctINCALL[$k]="0 "; $ctDROP[$k]="0 "; $ctQUEUE[$k]="0 "; $ctNP[$k]="0 "; $ctDEC[$k]="0 "; $ctNQ[$k]="0 "; $ctNA[$k]="0 "; $ctXFER[$k]="0 "; $ctLB[$k]="0 "; $ctCALLBK[$k]="0 "; $ctCBHOLD[$k]="0 ";
$stmt="select count(*),status from vicidial_log where call_date >= '$begin_date 00:00:01' and call_date <= '$end_date 23:59:59' and user='$user[$k]' and campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$rows_to_print = mysql_num_rows($rslt);
$m=0;
while ($m < $rows_to_print)
{
$row=mysql_fetch_row($rslt);
if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]); $TOT_A = ($TOT_A + $row[0]);}
if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]); $TOT_B = ($TOT_B + $row[0]);}
if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]); $TOT_DC = ($TOT_DC + $row[0]);}
if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]); $TOT_DNC = ($TOT_DNC + $row[0]);}
if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]); $TOT_N = ($TOT_N + $row[0]);}
if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]); $TOT_NI = ($TOT_NI + $row[0]);}
if ($row[1] == 'SALE') {$ctSALE[$k]=sprintf("%-4s", $row[0]); $TOT_SALE = ($TOT_SALE + $row[0]);}
if ($row[1] == 'INCALL') {$ctINCALL[$k]=sprintf("%-4s", $row[0]); $TOT_INCALL = ($TOT_INCALL + $row[0]);}
if ($row[1] == 'DROP') {$ctDROP[$k]=sprintf("%-4s", $row[0]); $TOT_DROP = ($TOT_DROP + $row[0]);}
if ($row[1] == 'QUEUE') {$ctQUEUE[$k]=sprintf("%-4s", $row[0]); $TOT_QUEUE = ($TOT_QUEUE + $row[0]);}
if ($row[1] == 'NP') {$ctNP[$k]=sprintf("%-4s", $row[0]); $TOT_NP = ($TOT_NP + $row[0]);}
if ($row[1] == 'DEC') {$ctDEC[$k]=sprintf("%-4s", $row[0]); $TOT_DEC = ($TOT_DEC + $row[0]);}
if ($row[1] == 'NQ') {$ctNQ[$k]=sprintf("%-4s", $row[0]); $TOT_NQ = ($TOT_NQ + $row[0]);}
if ($row[1] == 'NA') {$ctNA[$k]=sprintf("%-4s", $row[0]); $TOT_NA = ($TOT_NA + $row[0]);}
if ($row[1] == 'XFER') {$ctXFER[$k]=sprintf("%-4s", $row[0]); $TOT_XFER = ($TOT_XFER + $row[0]);}
if ($row[1] == 'LB') {$ctLB[$k]=sprintf("%-4s", $row[0]); $TOT_LB = ($TOT_LB + $row[0]);}
if ($row[1] == 'CALLBK') {$ctCALLBK[$k]=sprintf("%-4s", $row[0]); $TOT_CALLBK = ($TOT_CALLBK + $row[0]);}
if ($row[1] == 'CBHOLD') {$ctCBHOLD[$k]=sprintf("%-4s", $row[0]); $TOT_CBHOLD = ($TOT_CBHOLD + $row[0]);}
$m++;
}
echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $ctA[$k] | $ctB[$k] | $ctCALLBK[$k] | $ctCBHOLD[$k] | $ctDEC[$k] | $ctDC[$k] | $ctDNC[$k] | $ctDROP[$k] | $ctINCALL[$k] | $ctLB[$k] | $ctN[$k] | $ctNA[$k] | $ctNI[$k] | $ctNP[$k] | $ctNQ[$k] | $ctQUEUE[$k] | $ctSALE[$k] | $ctXFER[$k] | \n";
$k++;
}
$TOTcalls = sprintf("%-7s", $TOTcalls);
$TOTtotTALK_M = ($TOTtotTALK / 60);
$TOTtotTALK_M = round($TOTtotTALK_M, 2);
$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
$TOTtotTALK_S = ($TOTtotTALK_S * 60);
$TOTtotTALK_S = round($TOTtotTALK_S, 0);
if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
$TOTtotTALK_MS = sprintf("%7s", $TOTtotTALK_MS);
while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
$TOT_A = sprintf("%-5s", $TOT_A);
$TOT_B = sprintf("%-5s", $TOT_B);
$TOT_DC = sprintf("%-5s", $TOT_DC);
$TOT_DNC = sprintf("%-5s", $TOT_DNC);
$TOT_N = sprintf("%-5s", $TOT_N);
$TOT_NI = sprintf("%-5s", $TOT_NI);
$TOT_SALE = sprintf("%-5s", $TOT_SALE);
$TOT_INCALL = sprintf("%-5s", $TOT_INCALL);
$TOT_DROP = sprintf("%-5s", $TOT_DROP);
$TOT_QUEUE = sprintf("%-5s", $TOT_QUEUE);
$TOT_NP = sprintf("%-5s", $TOT_NP);
$TOT_DEC = sprintf("%-5s", $TOT_DEC);
$TOT_NQ = sprintf("%-5s", $TOT_NQ);
$TOT_NA = sprintf("%-5s", $TOT_NA);
$TOT_XFER = sprintf("%-5s", $TOT_XFER);
$TOT_LB= sprintf("%-5s", $TOT_LB);
$TOT_CALLBK = sprintf("%-5s", $TOT_CALLBK);
$TOT_CBHOLD = sprintf("%-5s", $TOT_CBHOLD);
echo "+-----------------+------------+--------+--------+--------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+\n";
echo "| TOTALS | $TOTcalls| $TOTtotTALK_MS| | $TOT_A| $TOT_B| $TOT_CALLBK| $TOT_CBHOLD| $TOT_DEC| $TOT_DC| $TOT_DNC| $TOT_DROP| $TOT_INCALL| $TOT_LB| $TOT_N| $TOT_NA| $TOT_NI| $TOT_NP| $TOT_NQ| $TOT_QUEUE| $TOT_SALE| $TOT_XFER|\n";
echo "+-----------------+------------+--------+--------+--------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+\n";
echo "\n";
}
?>
</BODY></HTML>
@@ -1,257 +0,0 @@
<?
### AST_agent_performance.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
# CHANGES
#
# 60619-1711 - Added variable filtering to eliminate SQL injection attack threat
# - Added required user/pass to gain access to this page
# 70201-1203 - Added non_latin UTF8 output code, widened USER ID to 8 chars
#
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["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];}
elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];}
if (isset($_GET["shift"])) {$shift=$_GET["shift"];}
elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];}
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);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
if (!isset($group)) {$group = '';}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="select campaign_id from vicidial_campaigns;";
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$campaigns_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $campaigns_to_print)
{
$row=mysql_fetch_row($rslt);
$groups[$i] =$row[0];
$i++;
}
?>
<HTML>
<HEAD>
<STYLE type="text/css">
<!--
.green {color: white; background-color: green}
.red {color: white; background-color: red}
.blue {color: white; background-color: blue}
.purple {color: white; background-color: purple}
-->
</STYLE>
<?
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>VICIDIAL: Agent Performance</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
echo "<INPUT TYPE=TEXT NAME=query_date SIZE=19 MAXLENGTH=19 VALUE=\"$query_date\">\n";
echo "<SELECT SIZE=1 NAME=group>\n";
$o=0;
while ($campaigns_to_print > $o)
{
if ($groups[$o] == $group) {echo "<option selected value=\"$groups[$o]\">$groups[$o]</option>\n";}
else {echo "<option value=\"$groups[$o]\">$groups[$o]</option>\n";}
$o++;
}
echo "</SELECT>\n";
echo "<SELECT SIZE=1 NAME=shift>\n";
echo "<option selected value=\"AM\">AM</option>\n";
echo "<option value=\"PM\">PM</option>\n";
echo "</SELECT>\n";
echo "<INPUT TYPE=SUBMIT NAME=SUBMIT VALUE=SUBMIT>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href=\"./admin.php?ADD=34&campaign_id=$group\">MODIFY</a> | <a href=\"./admin.php?ADD=999999\">REPORTS</a> </FONT>\n";
echo "</FORM>\n\n";
echo "<PRE><FONT SIZE=2>\n";
if (!$group)
{
echo "\n";
echo "PLEASE SELECT A SERVER AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
echo " NOTE: stats taken from 6 hour shift specified\n";
}
else
{
if ($shift == 'AM')
{
$query_date_BEGIN = "$query_date 08:45:00";
$query_date_END = "$query_date 15:33:00";
$time_BEGIN = "08:45:00";
$time_END = "15:33:00";
}
if ($shift == 'PM')
{
$query_date_BEGIN = "$query_date 15:33:00";
$query_date_END = "$query_date 23:15:00";
$time_BEGIN = "15:33:00";
$time_END = "23:15:00";
}
echo "VICIDIAL: Agent Performance $NOW_TIME\n";
echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
echo "---------- AGENTS Details -------------\n\n";
echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
echo "| USER NAME | ID | CALLS | TALK | TALKAVG| A | B | DC | DNC | N | NI | SALE |\n";
echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
$stmt="select count(*) as calls,sum(length_in_sec) as talk,full_name,vicidial_users.user,avg(length_in_sec) from vicidial_users,vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and vicidial_users.user=vicidial_log.user and campaign_id='" . mysql_real_escape_string($group) . "' group by full_name order by calls desc limit 1000;";
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$rows_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $rows_to_print)
{
$row=mysql_fetch_row($rslt);
$TOTcalls=($TOTcalls + $row[0]);
$TOTtotTALK=($TOTtotTALK + $row[1]);
$calls[$i] = sprintf("%-6s", $row[0]);
if ($non_latin < 1)
{
$full_name[$i]= sprintf("%-15s", $row[2]);
while(strlen($full_name[$i])>15) {$full_name[$i] = substr("$full_name[$i]", 0, -1);}
$user[$i] = sprintf("%-6s", $row[3]);
while(strlen($user[$i])>6) {$user[$i] = substr("$user[$i]", 0, -1);}
}
else
{
$full_name[$i]= sprintf("%-45s", $row[2]);
while(mb_strlen($full_name[$i],'utf-8')>15) {$full_name[$i] = mb_substr("$full_name[$i]", 0, -1,'utf-8');}
$user[$i] = sprintf("%-18s", $row[3]);
while(mb_strlen($user[$i],'utf-8')>6) {$user[$i] = mb_substr("$user[$i]", 0, -1,'utf-8');}
}
$user[$i] = sprintf("%-8s", $row[3]);
$USERtotTALK = $row[1];
$USERavgTALK = $row[4];
$USERtotTALK_M = ($USERtotTALK / 60);
$USERtotTALK_M = round($USERtotTALK_M, 2);
$USERtotTALK_M_int = intval("$USERtotTALK_M");
$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
$USERtotTALK_S = ($USERtotTALK_S * 60);
$USERtotTALK_S = round($USERtotTALK_S, 0);
if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
$pfUSERtotTALK_MS[$i] = sprintf("%6s", $USERtotTALK_MS);
$USERavgTALK_M = ($USERavgTALK / 60);
$USERavgTALK_M = round($USERavgTALK_M, 2);
$USERavgTALK_M_int = intval("$USERavgTALK_M");
$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
$USERavgTALK_S = ($USERavgTALK_S * 60);
$USERavgTALK_S = round($USERavgTALK_S, 0);
if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
$pfUSERavgTALK_MS[$i] = sprintf("%6s", $USERavgTALK_MS);
$i++;
}
$k=0;
while($k < $i)
{
$ctA[$k]="0 "; $ctB[$k]="0 "; $ctDC[$k]="0 "; $ctDNC[$k]="0 "; $ctN[$k]="0 "; $ctNI[$k]="0 "; $ctSALE[$k]="0 ";
$stmt="select count(*),status from vicidial_log where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and user='$user[$k]' and campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$rows_to_print = mysql_num_rows($rslt);
$m=0;
while ($m < $rows_to_print)
{
$row=mysql_fetch_row($rslt);
if ($row[1] == 'A') {$ctA[$k]=sprintf("%-4s", $row[0]); $TOT_A = ($TOT_A + $row[0]);}
if ($row[1] == 'B') {$ctB[$k]=sprintf("%-4s", $row[0]); $TOT_B = ($TOT_B + $row[0]);}
if ($row[1] == 'DC') {$ctDC[$k]=sprintf("%-4s", $row[0]); $TOT_DC = ($TOT_DC + $row[0]);}
if ($row[1] == 'DNC') {$ctDNC[$k]=sprintf("%-4s", $row[0]); $TOT_DNC = ($TOT_DNC + $row[0]);}
if ($row[1] == 'N') {$ctN[$k]=sprintf("%-4s", $row[0]); $TOT_N = ($TOT_N + $row[0]);}
if ($row[1] == 'NI') {$ctNI[$k]=sprintf("%-4s", $row[0]); $TOT_NI = ($TOT_NI + $row[0]);}
if (($row[1] == 'SALE') || ($row[1] == 'XFER') ) {$ctSALE[$k]=sprintf("%-4s", $row[0]); $TOT_SALE = ($TOT_SALE + $row[0]);}
$m++;
}
echo "| $full_name[$k] | $user[$k] | $calls[$k] | $pfUSERtotTALK_MS[$k] | $pfUSERavgTALK_MS[$k] | $ctA[$k] | $ctB[$k] | $ctDC[$k] | $ctDNC[$k] | $ctN[$k] | $ctNI[$k] | $ctSALE[$k] |\n";
$k++;
}
$TOTcalls = sprintf("%-7s", $TOTcalls);
$TOTtotTALK_M = ($TOTtotTALK / 60);
$TOTtotTALK_M = round($TOTtotTALK_M, 2);
$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
$TOTtotTALK_S = ($TOTtotTALK_S * 60);
$TOTtotTALK_S = round($TOTtotTALK_S, 0);
if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
$TOTtotTALK_MS = sprintf("%7s", $TOTtotTALK_MS);
while(strlen($TOTtotTALK_MS)>7) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
$TOT_A = sprintf("%-5s", $TOT_A);
$TOT_B = sprintf("%-5s", $TOT_B);
$TOT_DC = sprintf("%-5s", $TOT_DC);
$TOT_DNC = sprintf("%-5s", $TOT_DNC);
$TOT_N = sprintf("%-5s", $TOT_N);
$TOT_NI = sprintf("%-5s", $TOT_NI);
$TOT_SALE = sprintf("%-5s", $TOT_SALE);
echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
echo "| TOTALS | $TOTcalls| $TOTtotTALK_MS| | $TOT_A| $TOT_B| $TOT_DC| $TOT_DNC| $TOT_N| $TOT_NI| $TOT_SALE|\n";
echo "+-----------------+----------+--------+--------+--------+------+------+------+------+------+------+------+\n";
echo "\n";
}
?>
</BODY></HTML>
@@ -1,557 +0,0 @@
<?
### AST_agent_performance_detail.php
###
### Copyright (C) 2007 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
# CHANGES
#
# 71119-2359 - First build
# 71121-0144 - Replace existing AST_agent_performance_detail.php script with this one
# - Fixed zero division bug
#
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["query_date"])) {$query_date=$_GET["query_date"];}
elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];}
if (isset($_GET["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["user_group"])) {$user_group=$_GET["user_group"];}
elseif (isset($_POST["user_group"])) {$user_group=$_POST["user_group"];}
if (isset($_GET["shift"])) {$shift=$_GET["shift"];}
elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];}
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"];}
if (strlen($shift)<2) {$shift='ALL';}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
if (!isset($group)) {$group = '';}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="select campaign_id from vicidial_campaigns;";
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$campaigns_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $campaigns_to_print)
{
$row=mysql_fetch_row($rslt);
$groups[$i] =$row[0];
$i++;
}
$stmt="select user_group from vicidial_user_groups;";
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$user_groups_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $user_groups_to_print)
{
$row=mysql_fetch_row($rslt);
$user_groups[$i] =$row[0];
$i++;
}
?>
<HTML>
<HEAD>
<STYLE type="text/css">
<!--
.green {color: white; background-color: green}
.red {color: white; background-color: red}
.blue {color: white; background-color: blue}
.purple {color: white; background-color: purple}
-->
</STYLE>
<?
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>VICIDIAL: Agent Performance</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
echo "<INPUT TYPE=TEXT NAME=query_date SIZE=19 MAXLENGTH=19 VALUE=\"$query_date\">\n";
echo "<SELECT SIZE=1 NAME=group>\n";
$o=0;
while ($campaigns_to_print > $o)
{
if ($groups[$o] == $group) {echo "<option selected value=\"$groups[$o]\">$groups[$o]</option>\n";}
else {echo "<option value=\"$groups[$o]\">$groups[$o]</option>\n";}
$o++;
}
echo "</SELECT>\n";
echo "<SELECT SIZE=1 NAME=user_group>\n";
echo "<option value=\"\">-- ALL USER GROUPS --</option>\n";
$o=0;
while ($user_groups_to_print > $o)
{
if ($user_groups[$o] == $user_group) {echo "<option selected value=\"$user_groups[$o]\">$user_groups[$o]</option>\n";}
else {echo "<option value=\"$user_groups[$o]\">$user_groups[$o]</option>\n";}
$o++;
}
echo "</SELECT>\n";
echo "<SELECT SIZE=1 NAME=shift>\n";
echo "<option selected value=\"$shift\">$shift</option>\n";
echo "<option value=\"\">--</option>\n";
echo "<option value=\"AM\">AM</option>\n";
echo "<option value=\"PM\">PM</option>\n";
echo "<option value=\"ALL\">ALL</option>\n";
echo "</SELECT>\n";
echo "<INPUT TYPE=SUBMIT NAME=SUBMIT VALUE=SUBMIT>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href=\"./admin.php?ADD=34&campaign_id=$group\">MODIFY</a> | <a href=\"./admin.php?ADD=999999\">REPORTS</a> </FONT>\n";
echo "</FORM>\n\n";
echo "<PRE><FONT SIZE=2>\n";
if (!$group)
{
echo "\n";
echo "PLEASE SELECT A CAMPAIGN AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
echo " NOTE: stats taken from shift specified\n";
}
else
{
if ($shift == 'AM')
{
$time_BEGIN=$AM_shift_BEGIN;
$time_END=$AM_shift_END;
if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}
if (strlen($time_END) < 6) {$time_END = "15:15:00";}
}
if ($shift == 'PM')
{
$time_BEGIN=$PM_shift_BEGIN;
$time_END=$PM_shift_END;
if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
if (strlen($time_END) < 6) {$time_END = "23:15:00";}
}
if ($shift == 'ALL')
{
if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
if (strlen($time_END) < 6) {$time_END = "23:59:59";}
}
$query_date_BEGIN = "$query_date $time_BEGIN";
$query_date_END = "$query_date $time_END";
if (strlen($user_group)>0) {$ugSQL="and vicidial_agent_log.user_group='$user_group'";}
else {$ugSQL='';}
echo "VICIDIAL: Agent Performance Detail $NOW_TIME\n";
echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
echo "---------- AGENTS Details -------------\n\n";
$statuses='-';
$statusesTXT='';
$statusesHEAD='';
$statusesHTML='';
$statusesARY[0]='';
$j=0;
$users='-';
$usersARY[0]='';
$user_namesARY[0]='';
$k=0;
$stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,sum(pause_sec),sum(wait_sec),sum(dispo_sec),status from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and campaign_id='" . mysql_real_escape_string($group) . "' and pause_sec<36000 and wait_sec<36000 and talk_sec<36000 and dispo_sec<36000 $ugSQL group by full_name,status order by status desc,full_name limit 100000;";
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$rows_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $rows_to_print)
{
$row=mysql_fetch_row($rslt);
$row[0] = ($row[0] - 1); # subtract 1 for login/logout event compensation
$calls[$i] = $row[0];
$talk_sec[$i] = $row[1];
$full_name[$i] = $row[2];
$user[$i] = $row[3];
$pause_sec[$i] = $row[4];
$wait_sec[$i] = $row[5];
$dispo_sec[$i] = $row[6];
$status[$i] = $row[7];
if ( (!eregi("-$status[$i]-", $statuses)) and (strlen($status[$i])>0) )
{
$statusesTXT = sprintf("%8s", $status[$i]);
$statusesHEAD .= "----------+";
$statusesHTML .= " $statusesTXT |";
$statuses .= "$status[$i]-";
$statusesARY[$j] = $status[$i];
$j++;
}
if (!eregi("-$user[$i]-", $users))
{
$users .= "$user[$i]-";
$usersARY[$k] = $user[$i];
$user_namesARY[$k] = $full_name[$i];
$k++;
}
$i++;
}
echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
echo "| USER NAME | ID | CALLS | TIME | PAUSE | PAUSAVG| WAIT | WAITAVG| TALK | TALKAVG| DISPO | DISPAVG|$statusesHTML\n";
echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
### BEGIN loop through each user ###
$m=0;
while ($m < $k)
{
$Suser=$usersARY[$m];
$Sfull_name=$user_namesARY[$m];
$Stime=0;
$Scalls=0;
$Stalk_sec=0;
$Spause_sec=0;
$Swait_sec=0;
$Sdispo_sec=0;
$SstatusesHTML='';
### BEGIN loop through each status ###
$n=0;
while ($n < $j)
{
$Sstatus=$statusesARY[$n];
$SstatusTXT='';
### BEGIN loop through each stat line ###
$i=0; $status_found=0;
while ($i < $rows_to_print)
{
if ( ($Suser=="$user[$i]") and ($Sstatus=="$status[$i]") )
{
$Scalls = ($Scalls + $calls[$i]);
$Stalk_sec = ($Stalk_sec + $talk_sec[$i]);
$Spause_sec = ($Spause_sec + $pause_sec[$i]);
$Swait_sec = ($Swait_sec + $wait_sec[$i]);
$Sdispo_sec = ($Sdispo_sec + $dispo_sec[$i]);
$SstatusTXT = sprintf("%8s", $calls[$i]);
$SstatusesHTML .= " $SstatusTXT |";
$status_found++;
}
$i++;
}
if ($status_found < 1)
{
$SstatusesHTML .= " 0 |";
}
### END loop through each stat line ###
$n++;
}
### END loop through each status ###
$Stime = ($Stalk_sec + $Spause_sec + $Swait_sec + $Sdispo_sec);
$TOTcalls=($TOTcalls + $Scalls);
$TOTtime=($TOTtime + $Stime);
$TOTtotTALK=($TOTtotTALK + $Stalk_sec);
$TOTtotWAIT=($TOTtotWAIT + $Swait_sec);
$TOTtotPAUSE=($TOTtotPAUSE + $Spause_sec);
$TOTtotDISPO=($TOTtotDISPO + $Sdispo_sec);
$Stime = ($Stalk_sec + $Spause_sec + $Swait_sec + $Sdispo_sec);
if ( ($Scalls > 0) and ($Stalk_sec > 0) ) {$Stalk_avg = ($Stalk_sec/$Scalls);}
else {$Stalk_avg=0;}
if ( ($Scalls > 0) and ($Spause_sec > 0) ) {$Spause_avg = ($Spause_sec/$Scalls);}
else {$Spause_avg=0;}
if ( ($Scalls > 0) and ($Swait_sec > 0) ) {$Swait_avg = ($Swait_sec/$Scalls);}
else {$Swait_avg=0;}
if ( ($Scalls > 0) and ($Sdispo_sec > 0) ) {$Sdispo_avg = ($Sdispo_sec/$Scalls);}
else {$Sdispo_avg=0;}
$Scalls = sprintf("%6s", $Scalls);
if ($non_latin < 1)
{
$Sfull_name= sprintf("%-15s", $Sfull_name);
while(strlen($Sfull_name)>15) {$Sfull_name = substr("$Sfull_name", 0, -1);}
$Suser = sprintf("%-8s", $Suser);
while(strlen($Suser)>8) {$Suser = substr("$Suser", 0, -1);}
}
else
{
$Sfull_name= sprintf("%-45s", $Sfull_name);
while(mb_strlen($Sfull_name,'utf-8')>15) {$Sfull_name = mb_substr("$Sfull_name", 0, -1,'utf-8');}
$Suser = sprintf("%-24s", $Suser);
while(mb_strlen($Suser,'utf-8')>8) {$Suser = mb_substr("$Suser", 0, -1,'utf-8');}
}
$USERtime_M = ($Stime / 60);
$USERtime_M = round($USERtime_M, 2);
$USERtime_M_int = intval("$USERtime_M");
$USERtime_S = ($USERtime_M - $USERtime_M_int);
$USERtime_S = ($USERtime_S * 60);
$USERtime_S = round($USERtime_S, 0);
if ($USERtime_S < 10) {$USERtime_S = "0$USERtime_S";}
$USERtime_MS = "$USERtime_M_int:$USERtime_S";
$pfUSERtime_MS = sprintf("%7s", $USERtime_MS);
$USERtotTALK_M = ($Stalk_sec / 60);
$USERtotTALK_M = round($USERtotTALK_M, 2);
$USERtotTALK_M_int = intval("$USERtotTALK_M");
$USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int);
$USERtotTALK_S = ($USERtotTALK_S * 60);
$USERtotTALK_S = round($USERtotTALK_S, 0);
if ($USERtotTALK_S < 10) {$USERtotTALK_S = "0$USERtotTALK_S";}
$USERtotTALK_MS = "$USERtotTALK_M_int:$USERtotTALK_S";
$pfUSERtotTALK_MS = sprintf("%6s", $USERtotTALK_MS);
$USERavgTALK_M = ($Stalk_avg / 60);
$USERavgTALK_M = round($USERavgTALK_M, 2);
$USERavgTALK_M_int = intval("$USERavgTALK_M");
$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
$USERavgTALK_S = ($USERavgTALK_S * 60);
$USERavgTALK_S = round($USERavgTALK_S, 0);
if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
$pfUSERavgTALK_MS = sprintf("%6s", $USERavgTALK_MS);
$USERtotPAUSE_M = ($Spause_sec / 60);
$USERtotPAUSE_M = round($USERtotPAUSE_M, 2);
$USERtotPAUSE_M_int = intval("$USERtotPAUSE_M");
$USERtotPAUSE_S = ($USERtotPAUSE_M - $USERtotPAUSE_M_int);
$USERtotPAUSE_S = ($USERtotPAUSE_S * 60);
$USERtotPAUSE_S = round($USERtotPAUSE_S, 0);
if ($USERtotPAUSE_S < 10) {$USERtotPAUSE_S = "0$USERtotPAUSE_S";}
$USERtotPAUSE_MS = "$USERtotPAUSE_M_int:$USERtotPAUSE_S";
$pfUSERtotPAUSE_MS = sprintf("%6s", $USERtotPAUSE_MS);
$USERavgPAUSE_M = ($Spause_avg / 60);
$USERavgPAUSE_M = round($USERavgPAUSE_M, 2);
$USERavgPAUSE_M_int = intval("$USERavgPAUSE_M");
$USERavgPAUSE_S = ($USERavgPAUSE_M - $USERavgPAUSE_M_int);
$USERavgPAUSE_S = ($USERavgPAUSE_S * 60);
$USERavgPAUSE_S = round($USERavgPAUSE_S, 0);
if ($USERavgPAUSE_S < 10) {$USERavgPAUSE_S = "0$USERavgPAUSE_S";}
$USERavgPAUSE_MS = "$USERavgPAUSE_M_int:$USERavgPAUSE_S";
$pfUSERavgPAUSE_MS = sprintf("%6s", $USERavgPAUSE_MS);
$USERtotWAIT_M = ($Swait_sec / 60);
$USERtotWAIT_M = round($USERtotWAIT_M, 2);
$USERtotWAIT_M_int = intval("$USERtotWAIT_M");
$USERtotWAIT_S = ($USERtotWAIT_M - $USERtotWAIT_M_int);
$USERtotWAIT_S = ($USERtotWAIT_S * 60);
$USERtotWAIT_S = round($USERtotWAIT_S, 0);
if ($USERtotWAIT_S < 10) {$USERtotWAIT_S = "0$USERtotWAIT_S";}
$USERtotWAIT_MS = "$USERtotWAIT_M_int:$USERtotWAIT_S";
$pfUSERtotWAIT_MS = sprintf("%6s", $USERtotWAIT_MS);
$USERavgWAIT_M = ($Swait_avg / 60);
$USERavgWAIT_M = round($USERavgWAIT_M, 2);
$USERavgWAIT_M_int = intval("$USERavgWAIT_M");
$USERavgWAIT_S = ($USERavgWAIT_M - $USERavgWAIT_M_int);
$USERavgWAIT_S = ($USERavgWAIT_S * 60);
$USERavgWAIT_S = round($USERavgWAIT_S, 0);
if ($USERavgWAIT_S < 10) {$USERavgWAIT_S = "0$USERavgWAIT_S";}
$USERavgWAIT_MS = "$USERavgWAIT_M_int:$USERavgWAIT_S";
$pfUSERavgWAIT_MS = sprintf("%6s", $USERavgWAIT_MS);
$USERtotDISPO_M = ($Sdispo_sec / 60);
$USERtotDISPO_M = round($USERtotDISPO_M, 2);
$USERtotDISPO_M_int = intval("$USERtotDISPO_M");
$USERtotDISPO_S = ($USERtotDISPO_M - $USERtotDISPO_M_int);
$USERtotDISPO_S = ($USERtotDISPO_S * 60);
$USERtotDISPO_S = round($USERtotDISPO_S, 0);
if ($USERtotDISPO_S < 10) {$USERtotDISPO_S = "0$USERtotDISPO_S";}
$USERtotDISPO_MS = "$USERtotDISPO_M_int:$USERtotDISPO_S";
$pfUSERtotDISPO_MS = sprintf("%6s", $USERtotDISPO_MS);
$USERavgDISPO_M = ($Sdispo_avg / 60);
$USERavgDISPO_M = round($USERavgDISPO_M, 2);
$USERavgDISPO_M_int = intval("$USERavgDISPO_M");
$USERavgDISPO_S = ($USERavgDISPO_M - $USERavgDISPO_M_int);
$USERavgDISPO_S = ($USERavgDISPO_S * 60);
$USERavgDISPO_S = round($USERavgDISPO_S, 0);
if ($USERavgDISPO_S < 10) {$USERavgDISPO_S = "0$USERavgDISPO_S";}
$USERavgDISPO_MS = "$USERavgDISPO_M_int:$USERavgDISPO_S";
$pfUSERavgDISPO_MS = sprintf("%6s", $USERavgDISPO_MS);
echo "| $Sfull_name | $Suser | $Scalls | $pfUSERtime_MS | $pfUSERtotPAUSE_MS | $pfUSERavgPAUSE_MS | $pfUSERtotWAIT_MS | $pfUSERavgWAIT_MS | $pfUSERtotTALK_MS | $pfUSERavgTALK_MS | $pfUSERtotDISPO_MS | $pfUSERavgDISPO_MS |$SstatusesHTML\n";
$m++;
}
### END loop through each user ###
###### LAST LINE FORMATTING ##########
### BEGIN loop through each status ###
$SUMstatusesHTML='';
$n=0;
while ($n < $j)
{
$Scalls=0;
$Sstatus=$statusesARY[$n];
$SUMstatusTXT='';
### BEGIN loop through each stat line ###
$i=0; $status_found=0;
while ($i < $rows_to_print)
{
if ($Sstatus=="$status[$i]")
{
$Scalls = ($Scalls + $calls[$i]);
$status_found++;
}
$i++;
}
### END loop through each stat line ###
if ($status_found < 1)
{
$SUMstatusesHTML .= " 0 |";
}
else
{
$SUMstatusTXT = sprintf("%8s", $Scalls);
$SUMstatusesHTML .= " $SUMstatusTXT |";
}
$n++;
}
### END loop through each status ###
$TOTcalls = sprintf("%7s", $TOTcalls);
$TOT_AGENTS = sprintf("%-4s", $m);
$TOTtime_M = ($TOTtime / 60);
$TOTtime_M = round($TOTtime_M, 2);
$TOTtime_M_int = intval("$TOTtime_M");
$TOTtime_S = ($TOTtime_M - $TOTtime_M_int);
$TOTtime_S = ($TOTtime_S * 60);
$TOTtime_S = round($TOTtime_S, 0);
if ($TOTtime_S < 10) {$TOTtime_S = "0$TOTtime_S";}
$TOTtime_MS = "$TOTtime_M_int:$TOTtime_S";
$TOTtime_MS = sprintf("%8s", $TOTtime_MS);
while(strlen($TOTtime_MS)>8) {$TOTtime_MS = substr("$TOTtime_MS", 0, -1);}
$TOTtotTALK_M = ($TOTtotTALK / 60);
$TOTtotTALK_M = round($TOTtotTALK_M, 2);
$TOTtotTALK_M_int = intval("$TOTtotTALK_M");
$TOTtotTALK_S = ($TOTtotTALK_M - $TOTtotTALK_M_int);
$TOTtotTALK_S = ($TOTtotTALK_S * 60);
$TOTtotTALK_S = round($TOTtotTALK_S, 0);
if ($TOTtotTALK_S < 10) {$TOTtotTALK_S = "0$TOTtotTALK_S";}
$TOTtotTALK_MS = "$TOTtotTALK_M_int:$TOTtotTALK_S";
$TOTtotTALK_MS = sprintf("%8s", $TOTtotTALK_MS);
while(strlen($TOTtotTALK_MS)>8) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);}
$TOTtotDISPO_M = ($TOTtotDISPO / 60);
$TOTtotDISPO_M = round($TOTtotDISPO_M, 2);
$TOTtotDISPO_M_int = intval("$TOTtotDISPO_M");
$TOTtotDISPO_S = ($TOTtotDISPO_M - $TOTtotDISPO_M_int);
$TOTtotDISPO_S = ($TOTtotDISPO_S * 60);
$TOTtotDISPO_S = round($TOTtotDISPO_S, 0);
if ($TOTtotDISPO_S < 10) {$TOTtotDISPO_S = "0$TOTtotDISPO_S";}
$TOTtotDISPO_MS = "$TOTtotDISPO_M_int:$TOTtotDISPO_S";
$TOTtotDISPO_MS = sprintf("%8s", $TOTtotDISPO_MS);
while(strlen($TOTtotDISPO_MS)>8) {$TOTtotDISPO_MS = substr("$TOTtotDISPO_MS", 0, -1);}
$TOTtotPAUSE_M = ($TOTtotPAUSE / 60);
$TOTtotPAUSE_M = round($TOTtotPAUSE_M, 2);
$TOTtotPAUSE_M_int = intval("$TOTtotPAUSE_M");
$TOTtotPAUSE_S = ($TOTtotPAUSE_M - $TOTtotPAUSE_M_int);
$TOTtotPAUSE_S = ($TOTtotPAUSE_S * 60);
$TOTtotPAUSE_S = round($TOTtotPAUSE_S, 0);
if ($TOTtotPAUSE_S < 10) {$TOTtotPAUSE_S = "0$TOTtotPAUSE_S";}
$TOTtotPAUSE_MS = "$TOTtotPAUSE_M_int:$TOTtotPAUSE_S";
$TOTtotPAUSE_MS = sprintf("%8s", $TOTtotPAUSE_MS);
while(strlen($TOTtotPAUSE_MS)>8) {$TOTtotPAUSE_MS = substr("$TOTtotPAUSE_MS", 0, -1);}
$TOTtotWAIT_M = ($TOTtotWAIT / 60);
$TOTtotWAIT_M = round($TOTtotWAIT_M, 2);
$TOTtotWAIT_M_int = intval("$TOTtotWAIT_M");
$TOTtotWAIT_S = ($TOTtotWAIT_M - $TOTtotWAIT_M_int);
$TOTtotWAIT_S = ($TOTtotWAIT_S * 60);
$TOTtotWAIT_S = round($TOTtotWAIT_S, 0);
if ($TOTtotWAIT_S < 10) {$TOTtotWAIT_S = "0$TOTtotWAIT_S";}
$TOTtotWAIT_MS = "$TOTtotWAIT_M_int:$TOTtotWAIT_S";
$TOTtotWAIT_MS = sprintf("%8s", $TOTtotWAIT_MS);
while(strlen($TOTtotWAIT_MS)>8) {$TOTtotWAIT_MS = substr("$TOTtotWAIT_MS", 0, -1);}
$TOTavgTALK_M = ( ($TOTtotTALK / $TOTcalls) / 60);
$TOTavgTALK_M = round($TOTavgTALK_M, 2);
$TOTavgTALK_M_int = intval("$TOTavgTALK_M");
$TOTavgTALK_S = ($TOTavgTALK_M - $TOTavgTALK_M_int);
$TOTavgTALK_S = ($TOTavgTALK_S * 60);
$TOTavgTALK_S = round($TOTavgTALK_S, 0);
if ($TOTavgTALK_S < 10) {$TOTavgTALK_S = "0$TOTavgTALK_S";}
$TOTavgTALK_MS = "$TOTavgTALK_M_int:$TOTavgTALK_S";
$TOTavgTALK_MS = sprintf("%6s", $TOTavgTALK_MS);
while(strlen($TOTavgTALK_MS)>6) {$TOTavgTALK_MS = substr("$TOTavgTALK_MS", 0, -1);}
$TOTavgDISPO_M = ( ($TOTtotDISPO / $TOTcalls) / 60);
$TOTavgDISPO_M = round($TOTavgDISPO_M, 2);
$TOTavgDISPO_M_int = intval("$TOTavgDISPO_M");
$TOTavgDISPO_S = ($TOTavgDISPO_M - $TOTavgDISPO_M_int);
$TOTavgDISPO_S = ($TOTavgDISPO_S * 60);
$TOTavgDISPO_S = round($TOTavgDISPO_S, 0);
if ($TOTavgDISPO_S < 10) {$TOTavgDISPO_S = "0$TOTavgDISPO_S";}
$TOTavgDISPO_MS = "$TOTavgDISPO_M_int:$TOTavgDISPO_S";
$TOTavgDISPO_MS = sprintf("%6s", $TOTavgDISPO_MS);
while(strlen($TOTavgDISPO_MS)>6) {$TOTavgDISPO_MS = substr("$TOTavgDISPO_MS", 0, -1);}
$TOTavgPAUSE_M = ( ($TOTtotPAUSE / $TOTcalls) / 60);
$TOTavgPAUSE_M = round($TOTavgPAUSE_M, 2);
$TOTavgPAUSE_M_int = intval("$TOTavgPAUSE_M");
$TOTavgPAUSE_S = ($TOTavgPAUSE_M - $TOTavgPAUSE_M_int);
$TOTavgPAUSE_S = ($TOTavgPAUSE_S * 60);
$TOTavgPAUSE_S = round($TOTavgPAUSE_S, 0);
if ($TOTavgPAUSE_S < 10) {$TOTavgPAUSE_S = "0$TOTavgPAUSE_S";}
$TOTavgPAUSE_MS = "$TOTavgPAUSE_M_int:$TOTavgPAUSE_S";
$TOTavgPAUSE_MS = sprintf("%6s", $TOTavgPAUSE_MS);
while(strlen($TOTavgPAUSE_MS)>6) {$TOTavgPAUSE_MS = substr("$TOTavgPAUSE_MS", 0, -1);}
$TOTavgWAIT_M = ( ($TOTtotWAIT / $TOTcalls) / 60);
$TOTavgWAIT_M = round($TOTavgWAIT_M, 2);
$TOTavgWAIT_M_int = intval("$TOTavgWAIT_M");
$TOTavgWAIT_S = ($TOTavgWAIT_M - $TOTavgWAIT_M_int);
$TOTavgWAIT_S = ($TOTavgWAIT_S * 60);
$TOTavgWAIT_S = round($TOTavgWAIT_S, 0);
if ($TOTavgWAIT_S < 10) {$TOTavgWAIT_S = "0$TOTavgWAIT_S";}
$TOTavgWAIT_MS = "$TOTavgWAIT_M_int:$TOTavgWAIT_S";
$TOTavgWAIT_MS = sprintf("%6s", $TOTavgWAIT_MS);
while(strlen($TOTavgWAIT_MS)>6) {$TOTavgWAIT_MS = substr("$TOTavgWAIT_MS", 0, -1);}
echo "+-----------------+----------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
echo "| TOTALS AGENTS:$TOT_AGENTS | $TOTcalls| $TOTtime_MS|$TOTtotPAUSE_MS| $TOTavgPAUSE_MS |$TOTtotWAIT_MS| $TOTavgWAIT_MS |$TOTtotTALK_MS| $TOTavgTALK_MS |$TOTtotDISPO_MS| $TOTavgDISPO_MS |$SUMstatusesHTML\n";
echo "+----------------------------+--------+---------+--------+--------+--------+--------+--------+--------+--------+--------+$statusesHEAD\n";
echo "\n";
}
?>
</BODY></HTML>
@@ -1,286 +0,0 @@
<?
### AST_agent_time_sheet.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
# CHANGES
#
# 60619-1729 - Added variable filtering to eliminate SQL injection attack threat
# - Added required user/pass to gain access to this page
#
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["agent"])) {$agent=$_GET["agent"];}
elseif (isset($_POST["agent"])) {$agent=$_POST["agent"];}
if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];}
elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];}
if (isset($_GET["calls_summary"])) {$calls_summary=$_GET["calls_summary"];}
elseif (isset($_POST["calls_summary"])) {$calls_summary=$_POST["calls_summary"];}
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);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
?>
<HTML>
<HEAD>
<STYLE type="text/css">
<!--
.green {color: white; background-color: green}
.red {color: white; background-color: red}
.blue {color: white; background-color: blue}
.purple {color: white; background-color: purple}
-->
</STYLE>
<?
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>VICIDIAL: Agent Time Sheet</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
echo "<a href=\"./admin.php\">VICIDIAL ADMIN</a>: Agent Time Sheet\n";
echo " - <a href=\"./user_stats.php?user=$agent\">User Stats</a>\n";
echo " - <a href=\"./user_status.php?user=$agent\">User Status</a>\n";
echo " - <a href=\"./admin.php?ADD=3&user=$agent\">Modify User</a>\n";
echo "<BR>\n";
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET> &nbsp; \n";
echo "Date: <INPUT TYPE=TEXT NAME=query_date SIZE=19 MAXLENGTH=19 VALUE=\"$query_date\">\n";
echo "User ID: <INPUT TYPE=TEXT NAME=agent SIZE=10 MAXLENGTH=20 VALUE=\"$agent\">\n";
echo "<INPUT TYPE=SUBMIT NAME=SUBMIT VALUE=SUBMIT>\n";
echo "</FORM>\n\n";
echo "<PRE><FONT SIZE=3>\n";
if (!$agent)
{
echo "\n";
echo "PLEASE SELECT AN AGENT ID AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
echo " NOTE: stats taken from available agent log data\n";
}
else
{
$query_date_BEGIN = "$query_date 00:00:00";
$query_date_END = "$query_date 23:59:59";
$time_BEGIN = "00:00:00";
$time_END = "23:59:59";
$stmt="select full_name from vicidial_users where user='$agent';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$full_name = $row[0];
echo "VICIDIAL: Agent Time Sheet $NOW_TIME\n";
echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
echo "---------- AGENT TIME SHEET: $agent - $full_name -------------\n\n";
if ($calls_summary)
{
$stmt="select count(*) as calls,sum(talk_sec) as talk,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$TOTAL_TIME = ($row[1] + $row[3] + $row[5] + $row[7]);
$TOTAL_TIME_H = ($TOTAL_TIME / 3600);
$TOTAL_TIME_H = round($TOTAL_TIME_H, 2);
$TOTAL_TIME_H_int = intval("$TOTAL_TIME_H");
$TOTAL_TIME_M = ($TOTAL_TIME_H - $TOTAL_TIME_H_int);
$TOTAL_TIME_M = ($TOTAL_TIME_M * 60);
$TOTAL_TIME_M = round($TOTAL_TIME_M, 2);
$TOTAL_TIME_M_int = intval("$TOTAL_TIME_M");
$TOTAL_TIME_S = ($TOTAL_TIME_M - $TOTAL_TIME_M_int);
$TOTAL_TIME_S = ($TOTAL_TIME_S * 60);
$TOTAL_TIME_S = round($TOTAL_TIME_S, 0);
if ($TOTAL_TIME_S < 10) {$TOTAL_TIME_S = "0$TOTAL_TIME_S";}
if ($TOTAL_TIME_M_int < 10) {$TOTAL_TIME_M_int = "0$TOTAL_TIME_M_int";}
$TOTAL_TIME_HMS = "$TOTAL_TIME_H_int:$TOTAL_TIME_M_int:$TOTAL_TIME_S";
$pfTOTAL_TIME_HMS = sprintf("%8s", $TOTAL_TIME_HMS);
$TALK_TIME_H = ($row[1] / 3600);
$TALK_TIME_H = round($TALK_TIME_H, 2);
$TALK_TIME_H_int = intval("$TALK_TIME_H");
$TALK_TIME_M = ($TALK_TIME_H - $TALK_TIME_H_int);
$TALK_TIME_M = ($TALK_TIME_M * 60);
$TALK_TIME_M = round($TALK_TIME_M, 2);
$TALK_TIME_M_int = intval("$TALK_TIME_M");
$TALK_TIME_S = ($TALK_TIME_M - $TALK_TIME_M_int);
$TALK_TIME_S = ($TALK_TIME_S * 60);
$TALK_TIME_S = round($TALK_TIME_S, 0);
if ($TALK_TIME_S < 10) {$TALK_TIME_S = "0$TALK_TIME_S";}
if ($TALK_TIME_M_int < 10) {$TALK_TIME_M_int = "0$TALK_TIME_M_int";}
$TALK_TIME_HMS = "$TALK_TIME_H_int:$TALK_TIME_M_int:$TALK_TIME_S";
$pfTALK_TIME_HMS = sprintf("%8s", $TALK_TIME_HMS);
$PAUSE_TIME_H = ($row[3] / 3600);
$PAUSE_TIME_H = round($PAUSE_TIME_H, 2);
$PAUSE_TIME_H_int = intval("$PAUSE_TIME_H");
$PAUSE_TIME_M = ($PAUSE_TIME_H - $PAUSE_TIME_H_int);
$PAUSE_TIME_M = ($PAUSE_TIME_M * 60);
$PAUSE_TIME_M = round($PAUSE_TIME_M, 2);
$PAUSE_TIME_M_int = intval("$PAUSE_TIME_M");
$PAUSE_TIME_S = ($PAUSE_TIME_M - $PAUSE_TIME_M_int);
$PAUSE_TIME_S = ($PAUSE_TIME_S * 60);
$PAUSE_TIME_S = round($PAUSE_TIME_S, 0);
if ($PAUSE_TIME_S < 10) {$PAUSE_TIME_S = "0$PAUSE_TIME_S";}
if ($PAUSE_TIME_M_int < 10) {$PAUSE_TIME_M_int = "0$PAUSE_TIME_M_int";}
$PAUSE_TIME_HMS = "$PAUSE_TIME_H_int:$PAUSE_TIME_M_int:$PAUSE_TIME_S";
$pfPAUSE_TIME_HMS = sprintf("%8s", $PAUSE_TIME_HMS);
$WAIT_TIME_H = ($row[5] / 3600);
$WAIT_TIME_H = round($WAIT_TIME_H, 2);
$WAIT_TIME_H_int = intval("$WAIT_TIME_H");
$WAIT_TIME_M = ($WAIT_TIME_H - $WAIT_TIME_H_int);
$WAIT_TIME_M = ($WAIT_TIME_M * 60);
$WAIT_TIME_M = round($WAIT_TIME_M, 2);
$WAIT_TIME_M_int = intval("$WAIT_TIME_M");
$WAIT_TIME_S = ($WAIT_TIME_M - $WAIT_TIME_M_int);
$WAIT_TIME_S = ($WAIT_TIME_S * 60);
$WAIT_TIME_S = round($WAIT_TIME_S, 0);
if ($WAIT_TIME_S < 10) {$WAIT_TIME_S = "0$WAIT_TIME_S";}
if ($WAIT_TIME_M_int < 10) {$WAIT_TIME_M_int = "0$WAIT_TIME_M_int";}
$WAIT_TIME_HMS = "$WAIT_TIME_H_int:$WAIT_TIME_M_int:$WAIT_TIME_S";
$pfWAIT_TIME_HMS = sprintf("%8s", $WAIT_TIME_HMS);
$WRAPUP_TIME_H = ($row[7] / 3600);
$WRAPUP_TIME_H = round($WRAPUP_TIME_H, 2);
$WRAPUP_TIME_H_int = intval("$WRAPUP_TIME_H");
$WRAPUP_TIME_M = ($WRAPUP_TIME_H - $WRAPUP_TIME_H_int);
$WRAPUP_TIME_M = ($WRAPUP_TIME_M * 60);
$WRAPUP_TIME_M = round($WRAPUP_TIME_M, 2);
$WRAPUP_TIME_M_int = intval("$WRAPUP_TIME_M");
$WRAPUP_TIME_S = ($WRAPUP_TIME_M - $WRAPUP_TIME_M_int);
$WRAPUP_TIME_S = ($WRAPUP_TIME_S * 60);
$WRAPUP_TIME_S = round($WRAPUP_TIME_S, 0);
if ($WRAPUP_TIME_S < 10) {$WRAPUP_TIME_S = "0$WRAPUP_TIME_S";}
if ($WRAPUP_TIME_M_int < 10) {$WRAPUP_TIME_M_int = "0$WRAPUP_TIME_M_int";}
$WRAPUP_TIME_HMS = "$WRAPUP_TIME_H_int:$WRAPUP_TIME_M_int:$WRAPUP_TIME_S";
$pfWRAPUP_TIME_HMS = sprintf("%8s", $WRAPUP_TIME_HMS);
$TALK_AVG_M = ($row[2] / 60);
$TALK_AVG_M = round($TALK_AVG_M, 2);
$TALK_AVG_M_int = intval("$TALK_AVG_M");
$TALK_AVG_S = ($TALK_AVG_M - $TALK_AVG_M_int);
$TALK_AVG_S = ($TALK_AVG_S * 60);
$TALK_AVG_S = round($TALK_AVG_S, 0);
if ($TALK_AVG_S < 10) {$TALK_AVG_S = "0$TALK_AVG_S";}
$TALK_AVG_MS = "$TALK_AVG_M_int:$TALK_AVG_S";
$pfTALK_AVG_MS = sprintf("%6s", $TALK_AVG_MS);
$PAUSE_AVG_M = ($row[4] / 60);
$PAUSE_AVG_M = round($PAUSE_AVG_M, 2);
$PAUSE_AVG_M_int = intval("$PAUSE_AVG_M");
$PAUSE_AVG_S = ($PAUSE_AVG_M - $PAUSE_AVG_M_int);
$PAUSE_AVG_S = ($PAUSE_AVG_S * 60);
$PAUSE_AVG_S = round($PAUSE_AVG_S, 0);
if ($PAUSE_AVG_S < 10) {$PAUSE_AVG_S = "0$PAUSE_AVG_S";}
$PAUSE_AVG_MS = "$PAUSE_AVG_M_int:$PAUSE_AVG_S";
$pfPAUSE_AVG_MS = sprintf("%6s", $PAUSE_AVG_MS);
$WAIT_AVG_M = ($row[6] / 60);
$WAIT_AVG_M = round($WAIT_AVG_M, 2);
$WAIT_AVG_M_int = intval("$WAIT_AVG_M");
$WAIT_AVG_S = ($WAIT_AVG_M - $WAIT_AVG_M_int);
$WAIT_AVG_S = ($WAIT_AVG_S * 60);
$WAIT_AVG_S = round($WAIT_AVG_S, 0);
if ($WAIT_AVG_S < 10) {$WAIT_AVG_S = "0$WAIT_AVG_S";}
$WAIT_AVG_MS = "$WAIT_AVG_M_int:$WAIT_AVG_S";
$pfWAIT_AVG_MS = sprintf("%6s", $WAIT_AVG_MS);
$WRAPUP_AVG_M = ($row[8] / 60);
$WRAPUP_AVG_M = round($WRAPUP_AVG_M, 2);
$WRAPUP_AVG_M_int = intval("$WRAPUP_AVG_M");
$WRAPUP_AVG_S = ($WRAPUP_AVG_M - $WRAPUP_AVG_M_int);
$WRAPUP_AVG_S = ($WRAPUP_AVG_S * 60);
$WRAPUP_AVG_S = round($WRAPUP_AVG_S, 0);
if ($WRAPUP_AVG_S < 10) {$WRAPUP_AVG_S = "0$WRAPUP_AVG_S";}
$WRAPUP_AVG_MS = "$WRAPUP_AVG_M_int:$WRAPUP_AVG_S";
$pfWRAPUP_AVG_MS = sprintf("%6s", $WRAPUP_AVG_MS);
echo "TOTAL CALLS TAKEN: $row[0]\n";
echo "TALK TIME: $pfTALK_TIME_HMS AVERAGE: $pfTALK_AVG_MS\n";
echo "PAUSE TIME: $pfPAUSE_TIME_HMS AVERAGE: $pfPAUSE_AVG_MS\n";
echo "WAIT TIME: $pfWAIT_TIME_HMS AVERAGE: $pfWAIT_AVG_MS\n";
echo "WRAPUP TIME: $pfWRAPUP_TIME_HMS AVERAGE: $pfWRAPUP_AVG_MS\n";
echo "----------------------------------------------------------------\n";
echo "TOTAL ACTIVE AGENT TIME: $pfTOTAL_TIME_HMS\n";
echo "\n";
}
else
{
echo "<a href=\"$PHP_SELF?calls_summary=1&agent=$agent&query_date=$query_date\">Call Activity Summary</a>\n\n";
}
$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
echo "FIRST LOGIN: $row[0]\n";
$start = $row[1];
$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time desc limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
echo "LAST LOG ACTIVITY: $row[0]\n";
$end = $row[1];
$login_time = ($end - $start);
$LOGIN_TIME_H = ($login_time / 3600);
$LOGIN_TIME_H = round($LOGIN_TIME_H, 2);
$LOGIN_TIME_H_int = intval("$LOGIN_TIME_H");
$LOGIN_TIME_M = ($LOGIN_TIME_H - $LOGIN_TIME_H_int);
$LOGIN_TIME_M = ($LOGIN_TIME_M * 60);
$LOGIN_TIME_M = round($LOGIN_TIME_M, 2);
$LOGIN_TIME_M_int = intval("$LOGIN_TIME_M");
$LOGIN_TIME_S = ($LOGIN_TIME_M - $LOGIN_TIME_M_int);
$LOGIN_TIME_S = ($LOGIN_TIME_S * 60);
$LOGIN_TIME_S = round($LOGIN_TIME_S, 0);
if ($LOGIN_TIME_S < 10) {$LOGIN_TIME_S = "0$LOGIN_TIME_S";}
if ($LOGIN_TIME_M_int < 10) {$LOGIN_TIME_M_int = "0$LOGIN_TIME_M_int";}
$LOGIN_TIME_HMS = "$LOGIN_TIME_H_int:$LOGIN_TIME_M_int:$LOGIN_TIME_S";
$pfLOGIN_TIME_HMS = sprintf("%8s", $LOGIN_TIME_HMS);
echo "-----------------------------------------\n";
echo "TOTAL LOGGED-IN TIME: $pfLOGIN_TIME_HMS\n";
}
?>
</BODY></HTML>
@@ -1,286 +0,0 @@
<?
### AST_agent_time_sheet_archive.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
# CHANGES
#
# 60619-1721 - Added variable filtering to eliminate SQL injection attack threat
# - Added required user/pass to gain access to this page
#
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["agent"])) {$agent=$_GET["agent"];}
elseif (isset($_POST["agent"])) {$agent=$_POST["agent"];}
if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];}
elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];}
if (isset($_GET["calls_summary"])) {$calls_summary=$_GET["calls_summary"];}
elseif (isset($_POST["calls_summary"])) {$calls_summary=$_POST["calls_summary"];}
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);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
?>
<HTML>
<HEAD>
<STYLE type="text/css">
<!--
.green {color: white; background-color: green}
.red {color: white; background-color: red}
.blue {color: white; background-color: blue}
.purple {color: white; background-color: purple}
-->
</STYLE>
<?
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>VICIDIAL: Agent Time Sheet</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
echo "<a href=\"./admin.php\">VICIDIAL ADMIN</a>: Agent Time Sheet\n";
echo " - <a href=\"./user_stats.php?user=$agent\">User Stats</a>\n";
echo " - <a href=\"./user_status.php?user=$agent\">User Status</a>\n";
echo " - <a href=\"./admin.php?ADD=3&user=$agent\">Modify User</a>\n";
echo "<BR>\n";
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET> &nbsp; \n";
echo "Date: <INPUT TYPE=TEXT NAME=query_date SIZE=19 MAXLENGTH=19 VALUE=\"$query_date\">\n";
echo "User ID: <INPUT TYPE=TEXT NAME=agent SIZE=10 MAXLENGTH=20 VALUE=\"$agent\">\n";
echo "<INPUT TYPE=SUBMIT NAME=SUBMIT VALUE=SUBMIT>\n";
echo "</FORM>\n\n";
echo "<PRE><FONT SIZE=3>\n";
if (!$agent)
{
echo "\n";
echo "PLEASE SELECT AN AGENT ID AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
echo " NOTE: stats taken from available agent log data\n";
}
else
{
$query_date_BEGIN = "$query_date 00:00:00";
$query_date_END = "$query_date 23:59:59";
$time_BEGIN = "00:00:00";
$time_END = "23:59:59";
$stmt="select full_name from vicidial_users where user='$agent';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$full_name = $row[0];
echo "VICIDIAL: Agent Time Sheet $NOW_TIME\n";
echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
echo "---------- AGENT TIME SHEET: $agent - $full_name -------------\n\n";
if ($calls_summary)
{
$stmt="select count(*) as calls,sum(talk_sec) as talk,avg(talk_sec),sum(pause_sec),avg(pause_sec),sum(wait_sec),avg(wait_sec),sum(dispo_sec),avg(dispo_sec) from vicidial_agent_log_archive where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' and pause_sec<48800 and wait_sec<48800 and talk_sec<48800 and dispo_sec<48800 limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$TOTAL_TIME = ($row[1] + $row[3] + $row[5] + $row[7]);
$TOTAL_TIME_H = ($TOTAL_TIME / 3600);
$TOTAL_TIME_H = round($TOTAL_TIME_H, 2);
$TOTAL_TIME_H_int = intval("$TOTAL_TIME_H");
$TOTAL_TIME_M = ($TOTAL_TIME_H - $TOTAL_TIME_H_int);
$TOTAL_TIME_M = ($TOTAL_TIME_M * 60);
$TOTAL_TIME_M = round($TOTAL_TIME_M, 2);
$TOTAL_TIME_M_int = intval("$TOTAL_TIME_M");
$TOTAL_TIME_S = ($TOTAL_TIME_M - $TOTAL_TIME_M_int);
$TOTAL_TIME_S = ($TOTAL_TIME_S * 60);
$TOTAL_TIME_S = round($TOTAL_TIME_S, 0);
if ($TOTAL_TIME_S < 10) {$TOTAL_TIME_S = "0$TOTAL_TIME_S";}
if ($TOTAL_TIME_M_int < 10) {$TOTAL_TIME_M_int = "0$TOTAL_TIME_M_int";}
$TOTAL_TIME_HMS = "$TOTAL_TIME_H_int:$TOTAL_TIME_M_int:$TOTAL_TIME_S";
$pfTOTAL_TIME_HMS = sprintf("%8s", $TOTAL_TIME_HMS);
$TALK_TIME_H = ($row[1] / 3600);
$TALK_TIME_H = round($TALK_TIME_H, 2);
$TALK_TIME_H_int = intval("$TALK_TIME_H");
$TALK_TIME_M = ($TALK_TIME_H - $TALK_TIME_H_int);
$TALK_TIME_M = ($TALK_TIME_M * 60);
$TALK_TIME_M = round($TALK_TIME_M, 2);
$TALK_TIME_M_int = intval("$TALK_TIME_M");
$TALK_TIME_S = ($TALK_TIME_M - $TALK_TIME_M_int);
$TALK_TIME_S = ($TALK_TIME_S * 60);
$TALK_TIME_S = round($TALK_TIME_S, 0);
if ($TALK_TIME_S < 10) {$TALK_TIME_S = "0$TALK_TIME_S";}
if ($TALK_TIME_M_int < 10) {$TALK_TIME_M_int = "0$TALK_TIME_M_int";}
$TALK_TIME_HMS = "$TALK_TIME_H_int:$TALK_TIME_M_int:$TALK_TIME_S";
$pfTALK_TIME_HMS = sprintf("%8s", $TALK_TIME_HMS);
$PAUSE_TIME_H = ($row[3] / 3600);
$PAUSE_TIME_H = round($PAUSE_TIME_H, 2);
$PAUSE_TIME_H_int = intval("$PAUSE_TIME_H");
$PAUSE_TIME_M = ($PAUSE_TIME_H - $PAUSE_TIME_H_int);
$PAUSE_TIME_M = ($PAUSE_TIME_M * 60);
$PAUSE_TIME_M = round($PAUSE_TIME_M, 2);
$PAUSE_TIME_M_int = intval("$PAUSE_TIME_M");
$PAUSE_TIME_S = ($PAUSE_TIME_M - $PAUSE_TIME_M_int);
$PAUSE_TIME_S = ($PAUSE_TIME_S * 60);
$PAUSE_TIME_S = round($PAUSE_TIME_S, 0);
if ($PAUSE_TIME_S < 10) {$PAUSE_TIME_S = "0$PAUSE_TIME_S";}
if ($PAUSE_TIME_M_int < 10) {$PAUSE_TIME_M_int = "0$PAUSE_TIME_M_int";}
$PAUSE_TIME_HMS = "$PAUSE_TIME_H_int:$PAUSE_TIME_M_int:$PAUSE_TIME_S";
$pfPAUSE_TIME_HMS = sprintf("%8s", $PAUSE_TIME_HMS);
$WAIT_TIME_H = ($row[5] / 3600);
$WAIT_TIME_H = round($WAIT_TIME_H, 2);
$WAIT_TIME_H_int = intval("$WAIT_TIME_H");
$WAIT_TIME_M = ($WAIT_TIME_H - $WAIT_TIME_H_int);
$WAIT_TIME_M = ($WAIT_TIME_M * 60);
$WAIT_TIME_M = round($WAIT_TIME_M, 2);
$WAIT_TIME_M_int = intval("$WAIT_TIME_M");
$WAIT_TIME_S = ($WAIT_TIME_M - $WAIT_TIME_M_int);
$WAIT_TIME_S = ($WAIT_TIME_S * 60);
$WAIT_TIME_S = round($WAIT_TIME_S, 0);
if ($WAIT_TIME_S < 10) {$WAIT_TIME_S = "0$WAIT_TIME_S";}
if ($WAIT_TIME_M_int < 10) {$WAIT_TIME_M_int = "0$WAIT_TIME_M_int";}
$WAIT_TIME_HMS = "$WAIT_TIME_H_int:$WAIT_TIME_M_int:$WAIT_TIME_S";
$pfWAIT_TIME_HMS = sprintf("%8s", $WAIT_TIME_HMS);
$WRAPUP_TIME_H = ($row[7] / 3600);
$WRAPUP_TIME_H = round($WRAPUP_TIME_H, 2);
$WRAPUP_TIME_H_int = intval("$WRAPUP_TIME_H");
$WRAPUP_TIME_M = ($WRAPUP_TIME_H - $WRAPUP_TIME_H_int);
$WRAPUP_TIME_M = ($WRAPUP_TIME_M * 60);
$WRAPUP_TIME_M = round($WRAPUP_TIME_M, 2);
$WRAPUP_TIME_M_int = intval("$WRAPUP_TIME_M");
$WRAPUP_TIME_S = ($WRAPUP_TIME_M - $WRAPUP_TIME_M_int);
$WRAPUP_TIME_S = ($WRAPUP_TIME_S * 60);
$WRAPUP_TIME_S = round($WRAPUP_TIME_S, 0);
if ($WRAPUP_TIME_S < 10) {$WRAPUP_TIME_S = "0$WRAPUP_TIME_S";}
if ($WRAPUP_TIME_M_int < 10) {$WRAPUP_TIME_M_int = "0$WRAPUP_TIME_M_int";}
$WRAPUP_TIME_HMS = "$WRAPUP_TIME_H_int:$WRAPUP_TIME_M_int:$WRAPUP_TIME_S";
$pfWRAPUP_TIME_HMS = sprintf("%8s", $WRAPUP_TIME_HMS);
$TALK_AVG_M = ($row[2] / 60);
$TALK_AVG_M = round($TALK_AVG_M, 2);
$TALK_AVG_M_int = intval("$TALK_AVG_M");
$TALK_AVG_S = ($TALK_AVG_M - $TALK_AVG_M_int);
$TALK_AVG_S = ($TALK_AVG_S * 60);
$TALK_AVG_S = round($TALK_AVG_S, 0);
if ($TALK_AVG_S < 10) {$TALK_AVG_S = "0$TALK_AVG_S";}
$TALK_AVG_MS = "$TALK_AVG_M_int:$TALK_AVG_S";
$pfTALK_AVG_MS = sprintf("%6s", $TALK_AVG_MS);
$PAUSE_AVG_M = ($row[4] / 60);
$PAUSE_AVG_M = round($PAUSE_AVG_M, 2);
$PAUSE_AVG_M_int = intval("$PAUSE_AVG_M");
$PAUSE_AVG_S = ($PAUSE_AVG_M - $PAUSE_AVG_M_int);
$PAUSE_AVG_S = ($PAUSE_AVG_S * 60);
$PAUSE_AVG_S = round($PAUSE_AVG_S, 0);
if ($PAUSE_AVG_S < 10) {$PAUSE_AVG_S = "0$PAUSE_AVG_S";}
$PAUSE_AVG_MS = "$PAUSE_AVG_M_int:$PAUSE_AVG_S";
$pfPAUSE_AVG_MS = sprintf("%6s", $PAUSE_AVG_MS);
$WAIT_AVG_M = ($row[6] / 60);
$WAIT_AVG_M = round($WAIT_AVG_M, 2);
$WAIT_AVG_M_int = intval("$WAIT_AVG_M");
$WAIT_AVG_S = ($WAIT_AVG_M - $WAIT_AVG_M_int);
$WAIT_AVG_S = ($WAIT_AVG_S * 60);
$WAIT_AVG_S = round($WAIT_AVG_S, 0);
if ($WAIT_AVG_S < 10) {$WAIT_AVG_S = "0$WAIT_AVG_S";}
$WAIT_AVG_MS = "$WAIT_AVG_M_int:$WAIT_AVG_S";
$pfWAIT_AVG_MS = sprintf("%6s", $WAIT_AVG_MS);
$WRAPUP_AVG_M = ($row[8] / 60);
$WRAPUP_AVG_M = round($WRAPUP_AVG_M, 2);
$WRAPUP_AVG_M_int = intval("$WRAPUP_AVG_M");
$WRAPUP_AVG_S = ($WRAPUP_AVG_M - $WRAPUP_AVG_M_int);
$WRAPUP_AVG_S = ($WRAPUP_AVG_S * 60);
$WRAPUP_AVG_S = round($WRAPUP_AVG_S, 0);
if ($WRAPUP_AVG_S < 10) {$WRAPUP_AVG_S = "0$WRAPUP_AVG_S";}
$WRAPUP_AVG_MS = "$WRAPUP_AVG_M_int:$WRAPUP_AVG_S";
$pfWRAPUP_AVG_MS = sprintf("%6s", $WRAPUP_AVG_MS);
echo "TOTAL CALLS TAKEN: $row[0]\n";
echo "TALK TIME: $pfTALK_TIME_HMS AVERAGE: $pfTALK_AVG_MS\n";
echo "PAUSE TIME: $pfPAUSE_TIME_HMS AVERAGE: $pfPAUSE_AVG_MS\n";
echo "WAIT TIME: $pfWAIT_TIME_HMS AVERAGE: $pfWAIT_AVG_MS\n";
echo "WRAPUP TIME: $pfWRAPUP_TIME_HMS AVERAGE: $pfWRAPUP_AVG_MS\n";
echo "----------------------------------------------------------------\n";
echo "TOTAL ACTIVE AGENT TIME: $pfTOTAL_TIME_HMS\n";
echo "\n";
}
else
{
echo "<a href=\"$PHP_SELF?calls_summary=1&agent=$agent&query_date=$query_date\">Call Activity Summary</a>\n\n";
}
$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log_archive where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
echo "FIRST LOGIN: $row[0]\n";
$start = $row[1];
$stmt="select event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log_archive where event_time <= '" . mysql_real_escape_string($query_date_END) . "' and event_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and user='" . mysql_real_escape_string($agent) . "' order by event_time desc limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
echo "LAST LOG ACTIVITY: $row[0]\n";
$end = $row[1];
$login_time = ($end - $start);
$LOGIN_TIME_H = ($login_time / 3600);
$LOGIN_TIME_H = round($LOGIN_TIME_H, 2);
$LOGIN_TIME_H_int = intval("$LOGIN_TIME_H");
$LOGIN_TIME_M = ($LOGIN_TIME_H - $LOGIN_TIME_H_int);
$LOGIN_TIME_M = ($LOGIN_TIME_M * 60);
$LOGIN_TIME_M = round($LOGIN_TIME_M, 2);
$LOGIN_TIME_M_int = intval("$LOGIN_TIME_M");
$LOGIN_TIME_S = ($LOGIN_TIME_M - $LOGIN_TIME_M_int);
$LOGIN_TIME_S = ($LOGIN_TIME_S * 60);
$LOGIN_TIME_S = round($LOGIN_TIME_S, 0);
if ($LOGIN_TIME_S < 10) {$LOGIN_TIME_S = "0$LOGIN_TIME_S";}
if ($LOGIN_TIME_M_int < 10) {$LOGIN_TIME_M_int = "0$LOGIN_TIME_M_int";}
$LOGIN_TIME_HMS = "$LOGIN_TIME_H_int:$LOGIN_TIME_M_int:$LOGIN_TIME_S";
$pfLOGIN_TIME_HMS = sprintf("%8s", $LOGIN_TIME_HMS);
echo "-----------------------------------------\n";
echo "TOTAL LOGGED-IN TIME: $pfLOGIN_TIME_HMS\n";
}
?>
</BODY></HTML>
@@ -1,400 +0,0 @@
<?
# AST_inboundEXTstats.php
#
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
# CHANGES
# 60421-1450 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60620-1322 - Added variable filtering to eliminate SQL injection attack threat
# - Added required user/pass to gain access to this page
#
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["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];}
elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
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);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
if (!isset($server_ip)) {$server_ip = '10.10.11.20';}
$stmt="select extension,full_number,inbound_name from inbound_numbers where server_ip='" . mysql_real_escape_string($server_ip) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$inbound_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $inbound_to_print)
{
$row=mysql_fetch_row($rslt);
$inbound[$i] =$row[0];
$fullnum[$i] =$row[1];
$inbname[$i] =$row[2];
$i++;
}
?>
<HTML>
<HEAD>
<STYLE type="text/css">
<!--
.green {color: white; background-color: green}
.red {color: white; background-color: red}
.blue {color: white; background-color: blue}
.purple {color: white; background-color: purple}
-->
</STYLE>
<?
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n";
#echo"<META HTTP-EQUIV=Refresh CONTENT=\"7; URL=$PHP_SELF?server_ip=$server_ip&DB=$DB\">\n";
echo "<TITLE>ASTERISK: Inbound Calls Stats</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
echo "<INPUT TYPE=HIDDEN NAME=server_ip VALUE=\"$server_ip\">\n";
echo "<INPUT TYPE=TEXT NAME=query_date SIZE=10 MAXLENGTH=10 VALUE=\"$query_date\">\n";
echo "<SELECT SIZE=1 NAME=group>\n";
$o=0;
while ($inbound_to_print > $o)
{
if ($inbound[$o] == $group) {echo "<option selected value=\"$inbound[$o]\">$fullnum[$o] - $inbname[$o]</option>\n";}
else {echo "<option value=\"$inbound[$o]\">$fullnum[$o] - $inbname[$o]</option>\n";}
$o++;
}
echo "</SELECT>\n";
echo "<INPUT TYPE=SUBMIT NAME=SUBMIT VALUE=SUBMIT>\n";
echo "</FORM>\n\n";
echo "<PRE><FONT SIZE=2>\n\n";
if (!$group)
{
echo "\n\n";
echo "PLEASE SELECT A NUMBER AND DATE ABOVE AND CLICK SUBMIT\n";
}
else
{
echo "ASTERISK: Inbound Calls Stats $NOW_TIME\n";
echo "\n";
echo "---------- TOTALS\n";
$extenSQL = "and extension='" . mysql_real_escape_string($group) . "'";
if (eregi("\*",$group))
{$extenSQL = "and extension LIKE \"%$group\"";}
$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$TOTALcalls = sprintf("%10s", $row[0]);
$average_hold_seconds = ($row[1] / $row[0]);
$average_hold_seconds = round($average_hold_seconds, 0);
$average_hold_seconds = sprintf("%10s", $average_hold_seconds);
echo "Total Calls That came into this number: $TOTALcalls\n";
echo "Average Call Length(seconds) for all Calls: $average_hold_seconds\n";
echo "\n";
echo "---------- DROPS\n";
$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$DROPcalls = sprintf("%10s", $row[0]);
$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
$DROPpercent = round($DROPpercent, 0);
if ($row[0])
{
$average_hold_seconds = ($row[1] / $row[0]);
$average_hold_seconds = round($average_hold_seconds, 0);
$average_hold_seconds = sprintf("%10s", $average_hold_seconds);
}
else {$DROPpercent=0; $average_hold_seconds=0;}
echo "Total DROP Calls: (less than 10 seconds) $DROPcalls $DROPpercent%\n";
echo "Average Call Length(seconds) for DROP Calls: $average_hold_seconds\n";
##############################
######### CALLS STATS
echo "\n";
echo "---------- CALL LISTINGS\n";
echo "+----------------------+----------------------+--------+---------------------+\n";
echo "| CALLERID | CALLERIDNAME | LENGTH | DATE TIME |\n";
echo "+----------------------+----------------------+--------+---------------------+\n";
$stmt="select number_dialed,caller_code,length_in_sec,start_time from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$users_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $users_to_print)
{
$row=mysql_fetch_row($rslt);
$CID = sprintf("%-20s", $row[0]);
$CIDname = sprintf("%-20s", $row[1]); while(strlen($full_name)>15) {$full_name = substr("$full_name", 0, -1);}
$datetime = sprintf("%-19s", $row[3]);
$USERavgTALK = $row[2];
$USERavgTALK_M = ($USERavgTALK / 60);
$USERavgTALK_M = round($USERavgTALK_M, 2);
$USERavgTALK_M_int = intval("$USERavgTALK_M");
$USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int);
$USERavgTALK_S = ($USERavgTALK_S * 60);
$USERavgTALK_S = round($USERavgTALK_S, 0);
if ($USERavgTALK_S < 10) {$USERavgTALK_S = "0$USERavgTALK_S";}
$USERavgTALK_MS = "$USERavgTALK_M_int:$USERavgTALK_S";
$USERavgTALK_MS = sprintf("%6s", $USERavgTALK_MS);
echo "| $CID | $CIDname | $USERavgTALK_MS | $datetime |\n";
$i++;
}
echo "+----------------------+----------------------+--------+---------------------+\n";
##############################
######### TIME STATS
if ($output == 'FULL')
{
echo "\n";
echo "---------- TIME STATS\n";
echo "<FONT SIZE=0>\n";
$hi_hour_count=0;
$last_full_record=0;
$i=0;
$h=0;
while ($i <= 96)
{
$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:00:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:14:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$hour_count[$i] = $row[0];
if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
if ($hour_count[$i] > 0) {$last_full_record = $i;}
$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:00:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:14:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$drop_count[$i] = $row[0];
$i++;
$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:15:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:29:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$hour_count[$i] = $row[0];
if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
if ($hour_count[$i] > 0) {$last_full_record = $i;}
$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:15:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:29:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$drop_count[$i] = $row[0];
$i++;
$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:30:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:44:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$hour_count[$i] = $row[0];
if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
if ($hour_count[$i] > 0) {$last_full_record = $i;}
$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:30:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:44:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$drop_count[$i] = $row[0];
$i++;
$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:45:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL ;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$hour_count[$i] = $row[0];
if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
if ($hour_count[$i] > 0) {$last_full_record = $i;}
$stmt="select count(*) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " $h:45:00' and start_time <= '" . mysql_real_escape_string($query_date) . " $h:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' $extenSQL and (length_in_sec <= 10 or length_in_sec is null);";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$drop_count[$i] = $row[0];
$i++;
$h++;
}
$hour_multiplier = (100 / $hi_hour_count);
#$hour_multiplier = round($hour_multiplier, 0);
echo "<!-- HICOUNT: $hi_hour_count|$hour_multiplier -->\n";
echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS\n";
$k=1;
$Mk=0;
$call_scale = '0';
while ($k <= 102)
{
if ($Mk >= 5)
{
$Mk=0;
$scale_num=($k / $hour_multiplier);
$scale_num = round($scale_num, 0);
$LENscale_num = (strlen($scale_num));
$k = ($k + $LENscale_num);
$call_scale .= "$scale_num";
}
else
{
$call_scale .= " ";
$k++; $Mk++;
}
}
echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
#echo "| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP | DROPS | TOTAL |\n";
echo "| HOUR |$call_scale| DROPS | TOTAL |\n";
echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
$ZZ = '00';
$i=0;
$h=4;
$hour= -1;
$no_lines_yet=1;
while ($i <= 96)
{
$char_counter=0;
$time = ' ';
if ($h >= 4)
{
$hour++;
$h=0;
if ($hour < 10) {$hour = "0$hour";}
$time = "+$hour$ZZ+";
}
if ($h == 1) {$time = " 15 ";}
if ($h == 2) {$time = " 30 ";}
if ($h == 3) {$time = " 45 ";}
$Ghour_count = $hour_count[$i];
if ($Ghour_count < 1)
{
if ( ($no_lines_yet) or ($i > $last_full_record) )
{
$do_nothing=1;
}
else
{
$hour_count[$i] = sprintf("%-5s", $hour_count[$i]);
echo "|$time|";
$k=0; while ($k <= 102) {echo " "; $k++;}
echo "| $hour_count[$i] |\n";
}
}
else
{
$no_lines_yet=0;
$Xhour_count = ($Ghour_count * $hour_multiplier);
$Yhour_count = (99 - $Xhour_count);
$Gdrop_count = $drop_count[$i];
if ($Gdrop_count < 1)
{
$hour_count[$i] = sprintf("%-5s", $hour_count[$i]);
echo "|$time|<SPAN class=\"green\">";
$k=0; while ($k <= $Xhour_count) {echo "*"; $k++; $char_counter++;}
echo "*X</SPAN>"; $char_counter++;
$k=0; while ($k <= $Yhour_count) {echo " "; $k++; $char_counter++;}
while ($char_counter <= 101) {echo " "; $char_counter++;}
echo "| 0 | $hour_count[$i] |\n";
}
else
{
$Xdrop_count = ($Gdrop_count * $hour_multiplier);
# if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
$hour_count[$i] = sprintf("%-5s", $hour_count[$i]);
$drop_count[$i] = sprintf("%-5s", $drop_count[$i]);
echo "|$time|<SPAN class=\"red\">";
$k=0; while ($k <= $Xdrop_count) {echo ">"; $k++; $char_counter++;}
echo "D</SPAN><SPAN class=\"green\">"; $char_counter++;
$k=0; while ($k <= $XXhour_count) {echo "*"; $k++; $char_counter++;}
echo "X</SPAN>"; $char_counter++;
$k=0; while ($k <= $Yhour_count) {echo " "; $k++; $char_counter++;}
while ($char_counter <= 102) {echo " "; $char_counter++;}
echo "| $drop_count[$i] | $hour_count[$i] |\n";
}
}
$i++;
$h++;
}
echo "+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n";
}
}
?>
</PRE>
</BODY></HTML>
@@ -1,178 +0,0 @@
<?
# AST_inboundEXTstats_department.php
#
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
# CHANGES
# 70201-1710 - First Build
#
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["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];}
elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];}
if (isset($_GET["end_query_date"])) {$end_query_date=$_GET["end_query_date"];}
elseif (isset($_POST["end_query_date"])) {$end_query_date=$_POST["end_query_date"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
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);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
if (!isset($end_query_date)) {$end_query_date = $NOW_DATE;}
if (!isset($server_ip)) {$server_ip = '10.10.11.20';}
$stmt="select distinct department from inbound_numbers;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$dept_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $dept_to_print)
{
$row=mysql_fetch_row($rslt);
$dept[$i] =$row[0];
$i++;
}
?>
<HTML>
<HEAD>
<STYLE type="text/css">
<!--
.green {color: white; background-color: green}
.red {color: white; background-color: red}
.blue {color: white; background-color: blue}
.purple {color: white; background-color: purple}
-->
</STYLE>
<?
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n";
#echo"<META HTTP-EQUIV=Refresh CONTENT=\"7; URL=$PHP_SELF?server_ip=$server_ip&DB=$DB\">\n";
echo "<TITLE>ASTERISK: Inbound Calls Stats - By Department</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
echo "<INPUT TYPE=HIDDEN NAME=server_ip VALUE=\"$server_ip\">\n";
echo "<INPUT TYPE=TEXT NAME=query_date SIZE=10 MAXLENGTH=10 VALUE=\"$query_date\">\n";
echo "<INPUT TYPE=TEXT NAME=end_query_date SIZE=10 MAXLENGTH=10 VALUE=\"$end_query_date\">\n";
echo "<SELECT SIZE=1 NAME=group>\n";
$o=0;
while ($dept_to_print > $o)
{
if ($dept[$o] == $group) {echo "<option selected value=\"$dept[$o]\">$dept[$o]</option>\n";}
else {echo "<option value=\"$dept[$o]\">$dept[$o]</option>\n";}
$o++;
}
echo "</SELECT>\n";
echo "<INPUT TYPE=SUBMIT NAME=SUBMIT VALUE=SUBMIT>\n";
echo "</FORM>\n\n";
echo "<PRE><FONT SIZE=2>\n\n";
if (!$group)
{
echo "\n\n";
echo "PLEASE SELECT A DEPARTMENT AND DATE RANGE ABOVE AND CLICK SUBMIT\n";
}
else
{
$extSQL='';
$stmt="select extension from inbound_numbers where department='$group';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$inbound_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $inbound_to_print)
{
if (strlen($extSQL)> 1) {$extSQL .= ",";}
$row=mysql_fetch_row($rslt);
$extensions[$i] =$row[0];
$extSQL .= "'$extensions[$i]'";
$i++;
}
echo "ASTERISK: Inbound Calls Stats For $group from $query_date to $end_query_date\n";
echo "\n";
echo "---------- TOTALS\n";
echo "\n";
echo "+----------------------+------------+------------+\n";
echo "| NUMBER | CALLS | AVG TIME |\n";
echo "+----------------------+------------+------------+\n";
$k=0;
while ($k < $inbound_to_print)
{
$stmt="select count(*),sum(length_in_sec) from call_log where start_time >= '" . mysql_real_escape_string($query_date) . " 00:00:01' and start_time <= '" . mysql_real_escape_string($end_query_date) . " 23:59:59' and server_ip='" . mysql_real_escape_string($server_ip) . "' and extension='$extensions[$k]' ;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$extensions[$k] = sprintf("%20s", $extensions[$k]);
$TOTALcalls = sprintf("%10s", $row[0]);
if ( ($row[0]<1) or ($row[1]<1) )
{
$average_hold_seconds = " 0";
}
else
{
$average_hold_seconds = ($row[1] / $row[0]);
$average_hold_seconds = round($average_hold_seconds, 0);
$average_hold_seconds = sprintf("%10s", $average_hold_seconds);
}
$calls = ($TOTALcalls + $calls);
$seconds = ($row[1] + $seconds);
echo "| $extensions[$k] | $TOTALcalls | $average_hold_seconds |\n";
$k++;
}
$calls = sprintf("%10s", $calls);
$seconds = ($seconds / $calls);
$seconds = round($seconds, 0);
$seconds = sprintf("%5s", $seconds);
echo "+----------------------+------------+------------+\n";
echo "| TOTALS | $calls | AVG: $seconds |\n";
echo "+----------------------+------------+------------+\n";
}
?>
</PRE>
</BODY></HTML>
@@ -1,306 +0,0 @@
<?
# AST_server_performance.php
#
# Copyright (C) 2007 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
# CHANGES
#
# 60619-1732 - Added variable filtering to eliminate SQL injection attack threat
# - Added required user/pass to gain access to this page
# 70417-1106 - Changed time frame to be definable per time range on a single day
# - Fixed vertical scaling issues
#
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["query_date"])) {$query_date=$_GET["query_date"];}
elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];}
if (isset($_GET["begin_query_time"])) {$begin_query_time=$_GET["begin_query_time"];}
elseif (isset($_POST["begin_query_time"])) {$begin_query_time=$_POST["begin_query_time"];}
if (isset($_GET["end_query_time"])) {$end_query_time=$_GET["end_query_time"];}
elseif (isset($_POST["end_query_time"])) {$end_query_time=$_POST["end_query_time"];}
if (isset($_GET["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
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);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and modify_servers='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
# path from root to where ploticus files will be stored
$PLOTroot = "vicidial/ploticus";
$DOCroot = "$WeBServeRRooT/$PLOTroot/";
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
if (!isset($begin_query_time)) {$begin_query_time = '09:00:00';}
if (!isset($end_query_time)) {$end_query_time = '15:30:00';}
if (!isset($group)) {$group = '';}
$stmt="select server_ip from servers;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$servers_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $servers_to_print)
{
$row=mysql_fetch_row($rslt);
$groups[$i] =$row[0];
$i++;
}
?>
<HTML>
<HEAD>
<STYLE type="text/css">
<!--
.green {color: white; background-color: green}
.red {color: white; background-color: red}
.blue {color: white; background-color: blue}
.purple {color: white; background-color: purple}
-->
</STYLE>
<?
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>VICIDIAL: Server Performance</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
echo "Date: <INPUT TYPE=TEXT NAME=query_date SIZE=12 MAXLENGTH=10 VALUE=\"$query_date\"> &nbsp; \n";
echo "Time: <INPUT TYPE=TEXT NAME=begin_query_time SIZE=10 MAXLENGTH=8 VALUE=\"$begin_query_time\"> \n";
echo "to <INPUT TYPE=TEXT NAME=end_query_time SIZE=10 MAXLENGTH=8 VALUE=\"$end_query_time\"> \n";
echo "Server: <SELECT SIZE=1 NAME=group>\n";
$o=0;
while ($servers_to_print > $o)
{
if ($groups[$o] == $group) {echo "<option selected value=\"$groups[$o]\">$groups[$o]</option>\n";}
else {echo "<option value=\"$groups[$o]\">$groups[$o]</option>\n";}
$o++;
}
echo "</SELECT> \n";
echo "<INPUT TYPE=SUBMIT NAME=SUBMIT VALUE=SUBMIT>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href=\"./admin.php?ADD=999999\">REPORTS</a> </FONT>\n";
echo "</FORM>\n\n";
echo "<PRE><FONT SIZE=2>\n";
if (!$group)
{
echo "\n";
echo "PLEASE SELECT A SERVER, DATE AND TIME RANGE ABOVE AND CLICK SUBMIT\n";
}
else
{
$query_date_BEGIN = "$query_date $begin_query_time";
$query_date_END = "$query_date $end_query_time";
$time_BEGIN = "$begin_query_time";
$time_END = "$end_query_time";
echo "VICIDIAL: Server Performance $NOW_TIME\n";
echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
echo "---------- TOTALS, PEAKS and AVERAGES\n";
$stmt="select AVG(sysload),AVG(channels_total),MAX(sysload),MAX(channels_total),MAX(processes) from server_performance where start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$AVGload = sprintf("%10s", $row[0]);
$AVGchannels = sprintf("%10s", $row[1]);
$HIGHload = $row[2];
$HIGHmulti = intval($HIGHload / 100);
$HIGHchannels = $row[3];
$HIGHprocesses =$row[4];
if ($row[2] > $row[3]) {$HIGHlimit = $row[2];}
else {$HIGHlimit = $row[3];}
if ($HIGHlimit < $row[4]) {$HIGHlimit = $row[4];}
$stmt="select AVG(cpu_user_percent),AVG(cpu_system_percent),AVG(cpu_idle_percent) from server_performance where start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$AVGcpuUSER = sprintf("%10s", $row[0]);
$AVGcpuSYSTEM = sprintf("%10s", $row[1]);
$AVGcpuIDLE = sprintf("%10s", $row[2]);
$stmt="select count(*),SUM(length_in_min) from call_log where extension NOT IN('8365','8366','8367') and start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' and server_ip='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$TOTALcalls = sprintf("%10s", $row[0]);
$OFFHOOKtime = sprintf("%10s", $row[1]);
echo "Total Calls in/out on this server: $TOTALcalls\n";
echo "Total Off-Hook time on this server (min): $OFFHOOKtime\n";
echo "Average/Peak channels in use for server: $AVGchannels / $HIGHchannels\n";
echo "Average/Peak load for server: $AVGload / $HIGHload\n";
echo "Average USER process cpu percentage: $AVGcpuUSER %\n";
echo "Average SYSTEM process cpu percentage: $AVGcpuSYSTEM %\n";
echo "Average IDLE process cpu percentage: $AVGcpuIDLE %\n";
echo "\n";
echo "---------- LINE GRAPH:\n";
##############################
######### Graph stats
$DAT = '.dat';
$HTM = '.htm';
$PNG = '.png';
$filedate = date("Y-m-d_His");
$DATfile = "$group$query_date$shift$filedate$DAT";
$HTMfile = "$group$query_date$shift$filedate$HTM";
$PNGfile = "$group$query_date$shift$filedate$PNG";
$HTMfp = fopen ("$DOCroot/$HTMfile", "a");
$DATfp = fopen ("$DOCroot/$DATfile", "a");
$stmt="select DATE_FORMAT(start_time,'%H:%i:%s') as timex,sysload,processes,channels_total,live_recordings,cpu_user_percent,cpu_system_percent from server_performance where server_ip='" . mysql_real_escape_string($group) . "' and start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' order by timex;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$rows_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $rows_to_print)
{
$row=mysql_fetch_row($rslt);
$row[5] = intval(($row[5] + $row[6]) * $HIGHmulti);
$row[6] = intval($row[6] * $HIGHmulti);
fwrite ($DATfp, "$row[5]\t$row[6]\t$row[0]\t$row[1]\t$row[2]\t$row[3]\n");
$i++;
}
fclose($DATfp);
$rows_to_max = ($rows_to_print + 100);
#print "rows: $i\n";
$time_scale_abb = '5 minutes';
$time_scale_tick = '1 minute';
if ($i > 1000) {$time_scale_abb = '10 minutes'; $time_scale_tick = '2 minutes';}
if ($i > 2000) {$time_scale_abb = '20 minutes'; $time_scale_tick = '4 minutes';}
if ($i > 3000) {$time_scale_abb = '30 minutes'; $time_scale_tick = '5 minutes';}
if ($i > 4000) {$time_scale_abb = '40 minutes'; $time_scale_tick = '10 minutes';}
if ($i > 5000) {$time_scale_abb = '60 minutes'; $time_scale_tick = '15 minutes';}
if ($i > 6000) {$time_scale_abb = '90 minutes'; $time_scale_tick = '15 minutes';}
if ($i > 7000) {$time_scale_abb = '120 minutes'; $time_scale_tick = '30 minutes';}
$HTMcontent = '';
$HTMcontent .= "#proc page\n";
$HTMcontent .= "#if @DEVICE in png,gif\n";
$HTMcontent .= " scale: 0.6\n";
$HTMcontent .= "\n";
$HTMcontent .= "#endif\n";
$HTMcontent .= "#proc getdata\n";
$HTMcontent .= "file: $DOCroot/$DATfile\n";
$HTMcontent .= "fieldnames: userproc sysproc time load processes channels\n";
$HTMcontent .= "\n";
$HTMcontent .= "#proc areadef\n";
$HTMcontent .= "title: Server $group $query_date_BEGIN to $query_date_END\n";
$HTMcontent .= "titledetails: size=14 align=C\n";
$HTMcontent .= "rectangle: 1 1 14 7\n";
$HTMcontent .= "xscaletype: time hh:mm:ss\n";
$HTMcontent .= "xrange: $time_BEGIN $time_END\n";
$HTMcontent .= "yrange: 0 $HIGHlimit\n";
$HTMcontent .= "\n";
$HTMcontent .= "#proc xaxis\n";
$HTMcontent .= "stubs: inc $time_scale_abb\n";
$HTMcontent .= "minorticinc: $time_scale_tick\n";
$HTMcontent .= "stubformat: hh:mm:ssa\n";
$HTMcontent .= "\n";
$HTMcontent .= "#proc yaxis\n";
$HTMcontent .= "stubs: inc 50\n";
$HTMcontent .= "grid: color=yellow\n";
$HTMcontent .= "gridskip: min\n";
$HTMcontent .= "ticincrement: 100 1000\n";
$HTMcontent .= "\n";
$HTMcontent .= "#proc lineplot\n";
$HTMcontent .= "xfield: time\n";
$HTMcontent .= "yfield: userproc\n";
$HTMcontent .= "linedetails: color=purple width=.5\n";
$HTMcontent .= "fill: lavender\n";
$HTMcontent .= "legendlabel: user proc%\n";
$HTMcontent .= "maxinpoints: $rows_to_max\n";
$HTMcontent .= "\n";
$HTMcontent .= "#proc lineplot\n";
$HTMcontent .= "xfield: time\n";
$HTMcontent .= "yfield: sysproc\n";
$HTMcontent .= "linedetails: color=yelloworange width=.5\n";
$HTMcontent .= "fill: dullyellow\n";
$HTMcontent .= "legendlabel: system proc%\n";
$HTMcontent .= "maxinpoints: $rows_to_max\n";
$HTMcontent .= "\n";
$HTMcontent .= "#proc curvefit\n";
$HTMcontent .= "xfield: time\n";
$HTMcontent .= "yfield: load\n";
$HTMcontent .= "linedetails: color=blue width=.5\n";
$HTMcontent .= "legendlabel: load\n";
$HTMcontent .= "maxinpoints: $rows_to_max\n";
$HTMcontent .= "\n";
$HTMcontent .= "#proc curvefit\n";
$HTMcontent .= "xfield: time\n";
$HTMcontent .= "yfield: processes\n";
$HTMcontent .= "linedetails: color=red width=.5\n";
$HTMcontent .= "legendlabel: processes\n";
$HTMcontent .= "maxinpoints: $rows_to_max\n";
$HTMcontent .= "\n";
$HTMcontent .= "#proc curvefit\n";
$HTMcontent .= "xfield: time\n";
$HTMcontent .= "yfield: channels\n";
$HTMcontent .= "linedetails: color=green width=.5\n";
$HTMcontent .= "legendlabel: channels\n";
$HTMcontent .= "maxinpoints: $rows_to_max\n";
$HTMcontent .= "\n";
$HTMcontent .= "#proc legend\n";
$HTMcontent .= "location: max-2 max\n";
$HTMcontent .= "seglen: 0.2\n";
$HTMcontent .= "\n";
fwrite ($HTMfp, "$HTMcontent");
fclose($HTMfp);
passthru("/usr/local/bin/pl -png $DOCroot/$HTMfile -o $DOCroot/$PNGfile");
sleep(1);
echo "</PRE>\n";
echo "\n";
echo "<IMG SRC=\"/$PLOTroot/$PNGfile\">\n";
echo "<!-- /usr/local/bin/pl -png $DOCroot/$HTMfile -o $DOCroot/$PNGfile -->";
}
?>
</BODY></HTML>
-374
View File
@@ -1,374 +0,0 @@
<?
### AST_timeonVDAD.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
# live real-time stats for the VICIDIAL Auto-Dialer
#
# CHANGES
#
# 60620-1037 - Added variable filtering to eliminate SQL injection attack threat
# - Added required user/pass to gain access to this page
# 61114-2004 - Changed to display CLOSER and DEFAULT, added trunk shortage
#
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["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];}
elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];}
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"];}
if (isset($_GET["closer_display"])) {$closer_display=$_GET["closer_display"];}
elseif (isset($_POST["closer_display"])) {$closer_display=$_POST["closer_display"];}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
$epochSIXhoursAGO = ($STARTtime - 21600);
$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO);
$reset_counter++;
if ($reset_counter > 7)
{
$reset_counter=0;
$stmt="update park_log set status='HUNGUP' where hangup_time is not null;";
# $rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
if ($DB)
{
$stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');";
# $rslt=mysql_query($stmt, $link);
echo "$stmt\n";
}
}
?>
<HTML>
<HEAD>
<?
echo "<STYLE type=\"text/css\">\n";
echo "<!--\n";
if ($closer_display>0)
{
$stmt="select group_id,group_color from vicidial_inbound_groups;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$groups_to_print = mysql_num_rows($rslt);
if ($groups_to_print > 0)
{
$g=0;
while ($g < $groups_to_print)
{
$row=mysql_fetch_row($rslt);
$group_id[$g] = $row[0];
$group_color[$g] = $row[1];
echo " .$group_id[$g] {color: black; background-color: $group_color[$g]}\n";
$g++;
}
}
}
?>
.DEAD {color: white; background-color: black}
.green {color: white; background-color: green}
.red {color: white; background-color: red}
.blue {color: white; background-color: blue}
.purple {color: white; background-color: purple}
.yellow {color: black; background-color: yellow}
-->
</STYLE>
<?
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo"<META HTTP-EQUIV=Refresh CONTENT=\"4; URL=$PHP_SELF?server_ip=$server_ip&DB=$DB&reset_counter=$reset_counter&closer_display=$closer_display\">\n";
echo "<TITLE>VICIDIAL: Time On VDAD</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
echo "<PRE><FONT SIZE=3>";
###################################################################################
###### SERVER INFORMATION
###################################################################################
$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where server_ip='" . mysql_real_escape_string($server_ip) . "';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$balanceSHORT = $row[0];
echo "SERVER: $server_ip\n";
###################################################################################
###### TIME ON SYSTEM
###################################################################################
if ($closer_display>0) {$closer_display_reverse=0; $closer_reverse_link='DEFAULT';}
else {$closer_display_reverse=1; $closer_reverse_link='CLOSER';}
echo "VICIDIAL: Agents Time On Calls $NOW_TIME <a href=\"$PHP_SELF?server_ip=$server_ip&DB=$DB&reset_counter=$reset_counter&closer_display=$closer_display_reverse\">$closer_reverse_link</a> | <a href=\"./admin.php?ADD=999999\">REPORTS</a>\n\n";
if ($closer_display>0)
{
echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
echo "| STATION | USER | SESSIONID | CHANNEL | STATUS | CALLTIME | MINUTES | CAMPAIGN | FRONT |\n";
echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
}
else
{
echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
echo "| STATION | USER | SESSIONID | CHANNEL | STATUS | CALLTIME | MINUTES |\n";
echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
}
$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),uniqueid,lead_id from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by extension;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$talking_to_print = mysql_num_rows($rslt);
if ($talking_to_print > 0)
{
$i=0;
while ($i < $talking_to_print)
{
$row=mysql_fetch_row($rslt);
if (eregi("READY|PAUSED|CLOSER",$row[4]))
{
$row[3]='';
$row[5]='- WAIT -';
$row[6]=$row[7];
}
$extension[$i] = eregi_replace('Local/',"",$row[0]);
$extension[$i] = sprintf("%-10s", $extension[$i]);
while(strlen($extension[$i])>10) {$extension[$i] = substr("$extension[$i]", 0, -1);}
$user[$i] = sprintf("%-6s", $row[1]);
$sessionid[$i] = sprintf("%-9s", $row[2]);
$channel[$i] = sprintf("%-19s", $row[3]);
$cc[$i]=0;
while ( (strlen($channel[$i]) > 19) and ($cc[$i] < 100) )
{
$channel[$i] = eregi_replace(".$","",$channel[$i]);
$cc[$i]++;
if (strlen($channel[$i]) <= 19) {$cc[$i]=101;}
}
$status[$i] = sprintf("%-6s", $row[4]);
$start_time[$i] = sprintf("%-8s", $row[5]);
$cd[$i]=0;
while ( (strlen($start_time[$i]) > 8) and ($cd[$i] < 100) )
{
$start_time[$i] = eregi_replace("^.","",$start_time[$i]);
$cd[$i]++;
if (strlen($start_time[$i]) <= 8) {$cd[$i]=101;}
}
$uniqueid[$i] = $row[8];
$lead_id[$i] = $row[9];
$closer[$i] = $row[1];
$call_time_S[$i] = ($STARTtime - $row[6]);
$call_time_M[$i] = ($call_time_S[$i] / 60);
$call_time_M[$i] = round($call_time_M[$i], 2);
$call_time_M_int[$i] = intval("$call_time_M[$i]");
$call_time_SEC[$i] = ($call_time_M[$i] - $call_time_M_int[$i]);
$call_time_SEC[$i] = ($call_time_SEC[$i] * 60);
$call_time_SEC[$i] = round($call_time_SEC[$i], 0);
if ($call_time_SEC[$i] < 10) {$call_time_SEC[$i] = "0$call_time_SEC[$i]";}
$call_time_MS[$i] = "$call_time_M_int[$i]:$call_time_SEC[$i]";
$call_time_MS[$i] = sprintf("%7s", $call_time_MS[$i]);
if ($closer_display<1)
{
$G = ''; $EG = '';
if ($call_time_M_int[$i] >= 5) {$G='<SPAN class="blue"><B>'; $EG='</B></SPAN>';}
if ($call_time_M_int[$i] >= 10) {$G='<SPAN class="purple"><B>'; $EG='</B></SPAN>';}
if (eregi("PAUSED",$row[4]))
{
if ($call_time_M_int >= 1)
{$i++; continue;}
else
{$G='<SPAN class="yellow"><B>'; $EG='</B></SPAN>';}
}
$agentcount++;
echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG |\n";
}
$i++;
}
if ($closer_display>0)
{
$ext_count = $i;
$i=0;
while ($i < $ext_count)
{
$stmt="select campaign_id from vicidial_auto_calls where lead_id='$lead_id[$i]' and server_ip='" . mysql_real_escape_string($server_ip) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$camp_to_print = mysql_num_rows($rslt);
if ($camp_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$campaign = sprintf("%-12s", $row[0]);
$camp_color = $row[0];
}
else
{$campaign = 'DEAD '; $camp_color = 'DEAD';}
if (eregi("READY|PAUSED|CLOSER",$status[$i]))
{$campaign = ' '; $camp_color = '';}
$stmt="select user from vicidial_xfer_log where lead_id='$lead_id[$i]' and closer='$closer[$i]' order by call_date desc limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$xfer_to_print = mysql_num_rows($rslt);
if ($xfer_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$fronter = sprintf("%-6s", $row[0]);
}
else
{$fronter = ' ';}
$G = ''; $EG = '';
$G="<SPAN class=\"$camp_color\"><B>"; $EG='</B></SPAN>';
# if ($call_time_M_int[$i] >= 5) {$G='<SPAN class="blue"><B>'; $EG='</B></SPAN>';}
# if ($call_time_M_int[$i] >= 10) {$G='<SPAN class="purple"><B>'; $EG='</B></SPAN>';}
echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG | $G$campaign$EG | $G$fronter$EG |\n";
$i++;
}
echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
echo " $i agents logged in on server $server_ip\n\n";
# echo " <SPAN class=\"blue\"><B> </SPAN> - 5 minutes or more on call</B>\n";
# echo " <SPAN class=\"purple\"><B> </SPAN> - Over 10 minutes on call</B>\n";
}
else
{
echo "+------------|--------+-----------+---------------------+--------+----------+---------+\n";
echo " $agentcount agents logged in on server $server_ip\n\n";
echo " <SPAN class=\"yellow\"><B> </SPAN> - Paused agents</B>\n";
echo " <SPAN class=\"blue\"><B> </SPAN> - 5 minutes or more on call</B>\n";
echo " <SPAN class=\"purple\"><B> </SPAN> - Over 10 minutes on call</B>\n";
}
}
else
{
echo "**************************************************************************************\n";
echo "**************************************************************************************\n";
echo "********************************* NO AGENTS ON CALLS *********************************\n";
echo "**************************************************************************************\n";
echo "**************************************************************************************\n";
}
###################################################################################
###### OUTBOUND CALLS
###################################################################################
#echo "\n\n";
echo "----------------------------------------------------------------------------------------";
echo "\n\n";
echo "VICIDIAL: Time On VDAD TRUNK SHORT: $balanceSHORT $NOW_TIME\n\n";
echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
echo "| CHANNEL | STATUS | CAMPAIGN | PHONE NUMBER | CALLTIME | MINUTES |\n";
echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by auto_call_id desc;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$parked_to_print = mysql_num_rows($rslt);
if ($parked_to_print > 0)
{
$i=0;
while ($i < $parked_to_print)
{
$row=mysql_fetch_row($rslt);
$channel = sprintf("%-19s", $row[0]);
$cc=0;
while ( (strlen($channel) > 19) and ($cc < 100) )
{
$channel = eregi_replace(".$","",$channel);
$cc++;
if (strlen($channel) <= 19) {$cc=101;}
}
$start_time = sprintf("%-8s", $row[5]);
$cd=0;
while ( (strlen($start_time) > 8) and ($cd < 100) )
{
$start_time = eregi_replace("^.","",$start_time);
$cd++;
if (strlen($start_time) <= 8) {$cd=101;}
}
$status = sprintf("%-6s", $row[1]);
$campaign = sprintf("%-12s", $row[2]);
$all_phone = "$row[3]$row[4]";
$number_dialed = sprintf("%-18s", $all_phone);
$call_time_S = ($STARTtime - $row[6]);
$call_time_M = ($call_time_S / 60);
$call_time_M = round($call_time_M, 2);
$call_time_M_int = intval("$call_time_M");
$call_time_SEC = ($call_time_M - $call_time_M_int);
$call_time_SEC = ($call_time_SEC * 60);
$call_time_SEC = round($call_time_SEC, 0);
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
$call_time_MS = "$call_time_M_int:$call_time_SEC";
$call_time_MS = sprintf("%7s", $call_time_MS);
$G = ''; $EG = '';
if (eregi("LIVE",$status)) {$G='<SPAN class="green"><B>'; $EG='</B></SPAN>';}
# if ($call_time_M_int >= 6) {$G='<SPAN class="red"><B>'; $EG='</B></SPAN>';}
echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
$i++;
}
echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
echo " $i calls being placed on server $server_ip\n\n";
echo " <SPAN class=\"green\"><B> </SPAN> - LIVE CALL WAITING</B>\n";
# echo " <SPAN class=\"red\"><B> </SPAN> - Over 5 minutes on hold</B>\n";
}
else
{
echo "***************************************************************************************\n";
echo "***************************************************************************************\n";
echo "******************************* NO LIVE CALLS WAITING *********************************\n";
echo "***************************************************************************************\n";
echo "***************************************************************************************\n";
}
?>
</PRE>
</BODY></HTML>
@@ -1,318 +0,0 @@
<?
### AST_timeonVDAD_closer.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
# live real-time stats for the VICIDIAL Auto-Dialer
#
# CHANGES
#
# 60620-1037 - Added variable filtering to eliminate SQL injection attack threat
# - Added required user/pass to gain access to this page
#
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["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];}
elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];}
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);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
$epochSIXhoursAGO = ($STARTtime - 21600);
$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO);
$reset_counter++;
if ($reset_counter > 7)
{
$reset_counter=0;
$stmt="update park_log set status='HUNGUP' where hangup_time is not null;";
# $rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
if ($DB)
{
$stmt="delete from park_log where grab_time < '$timeSIXhoursAGO' and (hangup_time is null or hangup_time='');";
# $rslt=mysql_query($stmt, $link);
echo "$stmt\n";
}
}
?>
<HTML>
<HEAD>
<?
echo "<STYLE type=\"text/css\">\n";
echo "<!--\n";
$stmt="select group_id,group_color from vicidial_inbound_groups;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$groups_to_print = mysql_num_rows($rslt);
if ($groups_to_print > 0)
{
$g=0;
while ($g < $groups_to_print)
{
$row=mysql_fetch_row($rslt);
$group_id[$g] = $row[0];
$group_color[$g] = $row[1];
echo " .$group_id[$g] {color: black; background-color: $group_color[$g]}\n";
$g++;
}
}
?>
.DEAD {color: white; background-color: black}
.green {color: white; background-color: green}
.red {color: white; background-color: red}
.blue {color: white; background-color: blue}
.purple {color: white; background-color: purple}
-->
</STYLE>
<?
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo"<META HTTP-EQUIV=Refresh CONTENT=\"4; URL=$PHP_SELF?server_ip=$server_ip&DB=$DB&reset_counter=$reset_counter\">\n";
echo "<TITLE>VICIDIAL: Time On VDAD</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
echo "<PRE><FONT SIZE=3>";
###################################################################################
###### TIME ON SYSTEM
###################################################################################
echo "VICIDIAL: Agents Time On Calls $NOW_TIME <a href=\"./server_stats.php\">REPORTS</a>\n\n";
echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
echo "| STATION | USER | SESSIONID | CHANNEL | STATUS | CALLTIME | MINUTES | CAMPAIGN | FRONT |\n";
echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
$stmt="select extension,user,conf_exten,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),uniqueid,lead_id from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by extension;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$talking_to_print = mysql_num_rows($rslt);
if ($talking_to_print > 0)
{
$i=0;
while ($i < $talking_to_print)
{
$row=mysql_fetch_row($rslt);
if (eregi("READY|PAUSED|CLOSER",$row[4]))
{
$row[3]='';
$row[5]='- WAIT -';
$row[6]=$row[7];
}
$extension[$i] = eregi_replace('Local/',"",$row[0]);
$extension[$i] = sprintf("%-10s", $extension[$i]);
while(strlen($extension[$i])>10) {$extension[$i] = substr("$extension[$i]", 0, -1);}
$user[$i] = sprintf("%-6s", $row[1]);
$sessionid[$i] = sprintf("%-9s", $row[2]);
$channel[$i] = sprintf("%-19s", $row[3]);
$cc[$i]=0;
while ( (strlen($channel[$i]) > 19) and ($cc[$i] < 100) )
{
$channel[$i] = eregi_replace(".$","",$channel[$i]);
$cc[$i]++;
if (strlen($channel[$i]) <= 19) {$cc[$i]=101;}
}
$status[$i] = sprintf("%-6s", $row[4]);
$start_time[$i] = sprintf("%-8s", $row[5]);
$cd[$i]=0;
while ( (strlen($start_time[$i]) > 8) and ($cd[$i] < 100) )
{
$start_time[$i] = eregi_replace("^.","",$start_time[$i]);
$cd[$i]++;
if (strlen($start_time[$i]) <= 8) {$cd[$i]=101;}
}
$uniqueid[$i] = $row[8];
$lead_id[$i] = $row[9];
$closer[$i] = $row[1];
$call_time_S[$i] = ($STARTtime - $row[6]);
$call_time_M[$i] = ($call_time_S[$i] / 60);
$call_time_M[$i] = round($call_time_M[$i], 2);
$call_time_M_int[$i] = intval("$call_time_M[$i]");
$call_time_SEC[$i] = ($call_time_M[$i] - $call_time_M_int[$i]);
$call_time_SEC[$i] = ($call_time_SEC[$i] * 60);
$call_time_SEC[$i] = round($call_time_SEC[$i], 0);
if ($call_time_SEC[$i] < 10) {$call_time_SEC[$i] = "0$call_time_SEC[$i]";}
$call_time_MS[$i] = "$call_time_M_int[$i]:$call_time_SEC[$i]";
$call_time_MS[$i] = sprintf("%7s", $call_time_MS[$i]);
$i++;
}
$ext_count = $i;
$i=0;
while ($i < $ext_count)
{
$stmt="select campaign_id from vicidial_auto_calls where lead_id='$lead_id[$i]' and server_ip='" . mysql_real_escape_string($server_ip) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$camp_to_print = mysql_num_rows($rslt);
if ($camp_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$campaign = sprintf("%-12s", $row[0]);
$camp_color = $row[0];
}
else
{$campaign = 'DEAD '; $camp_color = 'DEAD';}
if (eregi("READY|PAUSED|CLOSER",$status[$i]))
{$campaign = ' '; $camp_color = '';}
$stmt="select user from vicidial_xfer_log where lead_id='$lead_id[$i]' and closer='$closer[$i]' order by call_date desc limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$xfer_to_print = mysql_num_rows($rslt);
if ($xfer_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$fronter = sprintf("%-6s", $row[0]);
}
else
{$fronter = ' ';}
$G = ''; $EG = '';
$G="<SPAN class=\"$camp_color\"><B>"; $EG='</B></SPAN>';
# if ($call_time_M_int[$i] >= 5) {$G='<SPAN class="blue"><B>'; $EG='</B></SPAN>';}
# if ($call_time_M_int[$i] >= 10) {$G='<SPAN class="purple"><B>'; $EG='</B></SPAN>';}
echo "| $G$extension[$i]$EG | $G$user[$i]$EG | $G$sessionid[$i]$EG | $G$channel[$i]$EG | $G$status[$i]$EG | $G$start_time[$i]$EG | $G$call_time_MS[$i]$EG | $G$campaign$EG | $G$fronter$EG |\n";
$i++;
}
echo "+------------|--------+-----------+---------------------+--------+----------+---------+--------------+--------+\n";
echo " $i agents logged in on server $server_ip\n\n";
# echo " <SPAN class=\"blue\"><B> </SPAN> - 5 minutes or more on call</B>\n";
# echo " <SPAN class=\"purple\"><B> </SPAN> - Over 10 minutes on call</B>\n";
}
else
{
echo "**************************************************************************************\n";
echo "**************************************************************************************\n";
echo "********************************* NO AGENTS ON CALLS *********************************\n";
echo "**************************************************************************************\n";
echo "**************************************************************************************\n";
}
###################################################################################
###### OUTBOUND CALLS
###################################################################################
#echo "\n\n";
echo "----------------------------------------------------------------------------------------";
echo "\n\n";
echo "VICIDIAL: Time On VDAD $NOW_TIME\n\n";
echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
echo "| CHANNEL | STATUS | CAMPAIGN | PHONE NUMBER | CALLTIME | MINUTES |\n";
echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
#$link=mysql_connect("localhost", "cron", "1234");
# $linkX=mysql_connect("localhost", "cron", "1234");
#mysql_select_db("asterisk");
$stmt="select channel,status,campaign_id,phone_code,phone_number,call_time,UNIX_TIMESTAMP(call_time) from vicidial_auto_calls where status NOT IN('XFER') and server_ip='" . mysql_real_escape_string($server_ip) . "' order by auto_call_id desc;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$parked_to_print = mysql_num_rows($rslt);
if ($parked_to_print > 0)
{
$i=0;
while ($i < $parked_to_print)
{
$row=mysql_fetch_row($rslt);
$channel = sprintf("%-19s", $row[0]);
$cc=0;
while ( (strlen($channel) > 19) and ($cc < 100) )
{
$channel = eregi_replace(".$","",$channel);
$cc++;
if (strlen($channel) <= 19) {$cc=101;}
}
$start_time = sprintf("%-8s", $row[5]);
$cd=0;
while ( (strlen($start_time) > 8) and ($cd < 100) )
{
$start_time = eregi_replace("^.","",$start_time);
$cd++;
if (strlen($start_time) <= 8) {$cd=101;}
}
$status = sprintf("%-6s", $row[1]);
$campaign = sprintf("%-12s", $row[2]);
$all_phone = "$row[3]$row[4]";
$number_dialed = sprintf("%-18s", $all_phone);
$call_time_S = ($STARTtime - $row[6]);
$call_time_M = ($call_time_S / 60);
$call_time_M = round($call_time_M, 2);
$call_time_M_int = intval("$call_time_M");
$call_time_SEC = ($call_time_M - $call_time_M_int);
$call_time_SEC = ($call_time_SEC * 60);
$call_time_SEC = round($call_time_SEC, 0);
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
$call_time_MS = "$call_time_M_int:$call_time_SEC";
$call_time_MS = sprintf("%7s", $call_time_MS);
$G = ''; $EG = '';
if (eregi("LIVE",$status)) {$G='<SPAN class="green"><B>'; $EG='</B></SPAN>';}
# if ($call_time_M_int >= 6) {$G='<SPAN class="red"><B>'; $EG='</B></SPAN>';}
echo "| $G$channel$EG | $G$status$EG | $G$campaign$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
$i++;
}
echo "+---------------------+--------+--------------+--------------------+----------+---------+\n";
echo " $i calls being placed on server $server_ip\n\n";
echo " <SPAN class=\"green\"><B> </SPAN> - LIVE CALL WAITING</B>\n";
# echo " <SPAN class=\"red\"><B> </SPAN> - Over 5 minutes on hold</B>\n";
}
else
{
echo "***************************************************************************************\n";
echo "***************************************************************************************\n";
echo "******************************* NO LIVE CALLS WAITING *********************************\n";
echo "***************************************************************************************\n";
echo "***************************************************************************************\n";
}
?>
</PRE>
</BODY></HTML>
-826
View File
@@ -1,826 +0,0 @@
<?
# AST_timeonVDADall.php
#
# Copyright (C) 2007 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
# live real-time stats for the VICIDIAL Auto-Dialer all servers
#
# STOP=4000, SLOW=40, GO=4 seconds refresh interval
#
# CHANGELOG:
# 50406-0920 - Added Paused agents < 1 min (Chris Doyle)
# 51130-1218 - Modified layout and info to show all servers in a vicidial system
# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60511-1343 - Added leads and drop info at the top of the screen
# 60608-1539 - Fixed CLOSER tallies for active calls
# 60619-1658 - Added variable filtering to eliminate SQL injection attack threat
# - Added required user/pass to gain access to this page
# 60626-1453 - Added display of system load to bottom (Angelito Manansala)
# 60901-1123 - Changed display elements at the top of the screen
# 60905-1342 - Fixed non INCALL|QUEUE timer column
# 61002-1642 - Added TRUNK SHORT/FILL stats
# 61101-1318 - Added SIP and IAX Listen and Barge links option
# 61101-1647 - Added Usergroup column and user name option as well as sorting
# 61102-1155 - Made display of columns more modular, added ability to hide server info
# 61215-1131 - Added answered calls and drop percent taken from answered calls
# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns
# 70123-1151 - Added non_latin options for substr in display variables, thanks Marin Blu
# 70206-1140 - Added call-type statuses to display(A-Auto, M-Manual, I-Inbound/Closer)
# 70619-1339 - Added Status Category tally display
# 71029-1900 - Changed CLOSER-type to not require campaign_id restriction
#
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["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["RR"])) {$RR=$_GET["RR"];}
elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];}
if (isset($_GET["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["usergroup"])) {$usergroup=$_GET["usergroup"];}
elseif (isset($_POST["usergroup"])) {$usergroup=$_POST["usergroup"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];}
elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];}
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"];}
if (isset($_GET["SIPmonitorLINK"])) {$SIPmonitorLINK=$_GET["SIPmonitorLINK"];}
elseif (isset($_POST["SIPmonitorLINK"])) {$SIPmonitorLINK=$_POST["SIPmonitorLINK"];}
if (isset($_GET["IAXmonitorLINK"])) {$IAXmonitorLINK=$_GET["IAXmonitorLINK"];}
elseif (isset($_POST["IAXmonitorLINK"])) {$IAXmonitorLINK=$_POST["IAXmonitorLINK"];}
if (isset($_GET["UGdisplay"])) {$UGdisplay=$_GET["UGdisplay"];}
elseif (isset($_POST["UGdisplay"])) {$UGdisplay=$_POST["UGdisplay"];}
if (isset($_GET["UidORname"])) {$UidORname=$_GET["UidORname"];}
elseif (isset($_POST["UidORname"])) {$UidORname=$_POST["UidORname"];}
if (isset($_GET["orderby"])) {$orderby=$_GET["orderby"];}
elseif (isset($_POST["orderby"])) {$orderby=$_POST["orderby"];}
if (isset($_GET["SERVdisplay"])) {$SERVdisplay=$_GET["SERVdisplay"];}
elseif (isset($_POST["SERVdisplay"])) {$SERVdisplay=$_POST["SERVdisplay"];}
if (!isset($RR)) {$gRRroup=4;}
if (!isset($group)) {$group='';}
if (!isset($usergroup)) {$usergroup='';}
if (!isset($UGdisplay)) {$UGdisplay=0;} # 0=no, 1=yes
if (!isset($UidORname)) {$UidORname=0;} # 0=id, 1=name
if (!isset($orderby)) {$orderby='timeup';}
if (!isset($SERVdisplay)) {$SERVdisplay=1;} # 0=no, 1=yes
function get_server_load($windows = false) {
$os = strtolower(PHP_OS);
if(strpos($os, "win") === false) {
if(file_exists("/proc/loadavg")) {
$load = file_get_contents("/proc/loadavg");
$load = explode(' ', $load);
return $load[0];
}
elseif(function_exists("shell_exec")) {
$load = explode(' ', `uptime`);
return $load[count($load)-1];
}
else {
return false;
}
}
elseif($windows) {
if(class_exists("COM")) {
$wmi = new COM("WinMgmts:\\\\.");
$cpus = $wmi->InstancesOf("Win32_Processor");
$cpuload = 0;
$i = 0;
while ($cpu = $cpus->Next()) {
$cpuload += $cpu->LoadPercentage;
$i++;
}
$cpuload = round($cpuload / $i, 2);
return "$cpuload%";
}
else {
return false;
}
}
}
$load_ave = get_server_load(true);
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
$NOW_TIME = date("Y-m-d H:i:s");
$NOW_DAY = date("Y-m-d");
$NOW_HOUR = date("H:i:s");
$STARTtime = date("U");
$epochSIXhoursAGO = ($STARTtime - 21600);
$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO);
$stmt="select campaign_id from vicidial_campaigns where active='Y';";
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
}
$rslt=mysql_query($stmt, $link);
if (!isset($DB)) {$DB=0;}
if ($DB) {echo "$stmt\n";}
$groups_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $groups_to_print)
{
$row=mysql_fetch_row($rslt);
$groups[$i] =$row[0];
$i++;
}
$stmt="select * from vicidial_user_groups;";
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
}
$rslt=mysql_query($stmt, $link);
if (!isset($DB)) {$DB=0;}
if ($DB) {echo "$stmt\n";}
$usergroups_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $usergroups_to_print)
{
$row=mysql_fetch_row($rslt);
$usergroups[$i] =$row[0];
$i++;
}
if (!isset($RR)) {$RR=4;}
$NFB = '<b><font size=6 face="courier">';
$NFE = '</font></b>';
$F=''; $FG=''; $B=''; $BG='';
?>
<HTML>
<HEAD>
<STYLE type="text/css">
<!--
.green {color: white; background-color: green}
.red {color: white; background-color: red}
.lightblue {color: black; background-color: #ADD8E6}
.blue {color: white; background-color: blue}
.midnightblue {color: white; background-color: #191970}
.purple {color: white; background-color: purple}
.violet {color: black; background-color: #EE82EE}
.thistle {color: black; background-color: #D8BFD8}
.olive {color: white; background-color: #808000}
.yellow {color: black; background-color: yellow}
.khaki {color: black; background-color: #F0E68C}
.orange {color: black; background-color: orange}
.r1 {color: black; background-color: #FFCCCC}
.r2 {color: black; background-color: #FF9999}
.r3 {color: black; background-color: #FF6666}
.r4 {color: white; background-color: #FF0000}
.b1 {color: black; background-color: #CCCCFF}
.b2 {color: black; background-color: #9999FF}
.b3 {color: black; background-color: #6666FF}
.b4 {color: white; background-color: #0000FF}
-->
</STYLE>
<?
$stmt = "select count(*) from vicidial_campaigns where campaign_id='$group' and campaign_allow_inbound='Y';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$campaign_allow_inbound = $row[0];
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo"<META HTTP-EQUIV=Refresh CONTENT=\"$RR; URL=$PHP_SELF?RR=$RR&DB=$DB&group=$group&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\">\n";
echo "<TITLE>VICIDIAL: Time On VDAD Campaign: $group</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
echo "VICIDIAL Campaign: \n";
echo "<INPUT TYPE=HIDDEN NAME=RR VALUE=\"$RR\">\n";
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
echo "<INPUT TYPE=HIDDEN NAME=adastats VALUE=\"$adastats\">\n";
echo "<INPUT TYPE=HIDDEN NAME=SIPmonitorLINK VALUE=\"$SIPmonitorLINK\">\n";
echo "<INPUT TYPE=HIDDEN NAME=IAXmonitorLINK VALUE=\"$IAXmonitorLINK\">\n";
echo "<INPUT TYPE=HIDDEN NAME=usergroup VALUE=\"$usergroup\">\n";
echo "<INPUT TYPE=HIDDEN NAME=UGdisplay VALUE=\"$UGdisplay\">\n";
echo "<INPUT TYPE=HIDDEN NAME=UidORname VALUE=\"$UidORname\">\n";
echo "<INPUT TYPE=HIDDEN NAME=orderby VALUE=\"$orderby\">\n";
echo "<INPUT TYPE=HIDDEN NAME=SERVdisplay VALUE=\"$SERVdisplay\">\n";
echo "<SELECT SIZE=1 NAME=group>\n";
echo "<option value=\"XXXX-ALL-ACTIVE-XXXX\">ALL ACTIVE</option>\n";
$o=0;
while ($groups_to_print > $o)
{
if ($groups[$o] == $group) {echo "<option selected value=\"$groups[$o]\">$groups[$o]</option>\n";}
else {echo "<option value=\"$groups[$o]\">$groups[$o]</option>\n";}
$o++;
}
echo "</SELECT>\n";
if ($UGdisplay > 0)
{
echo "<SELECT SIZE=1 NAME=usergroup>\n";
echo "<option value=\"\">ALL USER GROUPS</option>\n";
$o=0;
while ($usergroups_to_print > $o)
{
if ($usergroups[$o] == $usergroup) {echo "<option selected value=\"$usergroups[$o]\">$usergroups[$o]</option>\n";}
else {echo "<option value=\"$usergroups[$o]\">$usergroups[$o]</option>\n";}
$o++;
}
echo "</SELECT>\n";
}
echo "<INPUT type=submit NAME=SUBMIT VALUE=SUBMIT><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2> &nbsp; &nbsp; &nbsp; &nbsp; \n";
echo "<a href=\"$PHP_SELF?group=$group&RR=4000&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\">STOP</a> | ";
echo "<a href=\"$PHP_SELF?group=$group&RR=40&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\">SLOW</a> | ";
echo "<a href=\"$PHP_SELF?group=$group&RR=4&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\">GO</a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"./admin.php?ADD=34&campaign_id=$group\">MODIFY</a> | \n";
echo "<a href=\"./AST_timeonVDADallSUMMARY.php?group=$group&RR=$RR&DB=$DB&adastats=$adastats\">SUMMARY</a> | \n";
echo "<a href=\"./admin.php?ADD=999999\">REPORTS</a> </FONT>\n";
echo "\n\n";
if (!$group) {echo "<BR><BR>please select a campaign from the pulldown above</FORM>\n"; exit;}
else
{
$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';";
if ($group=='XXXX-ALL-ACTIVE-XXXX')
{
$stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses) from vicidial_campaigns;";
}
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$DIALlev = $row[0];
$DIALstatusA = $row[1];
$DIALstatusB = $row[2];
$DIALstatusC = $row[3];
$DIALstatusD = $row[4];
$DIALstatusE = $row[5];
$DIALorder = $row[6];
$DIALfilter = $row[7];
$HOPlev = $row[8];
$DIALmethod = $row[9];
$maxDIALlev = $row[10];
$DROPmax = $row[11];
$targetDIFF = $row[12];
$ADAintense = $row[13];
$ADAavailonly = $row[14];
$TAPERtime = $row[15];
$CALLtime = $row[16];
$DIALtimeout = $row[17];
$DIALstatuses = $row[18];
$DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses));
$DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses));
$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';";
if ($group=='XXXX-ALL-ACTIVE-XXXX')
{
$stmt="select count(*) from vicidial_hopper;";
}
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$VDhop = $row[0];
$stmt="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';";
if ($group=='XXXX-ALL-ACTIVE-XXXX')
{
$stmt="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),min(status_category_1),sum(status_category_count_1),min(status_category_2),sum(status_category_count_2),min(status_category_3),sum(status_category_count_3),min(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats;";
}
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$DAleads = $row[0];
$callsTODAY = $row[1];
$dropsTODAY = $row[2];
$drpctTODAY = $row[3];
$diffONEMIN = $row[4];
$agentsONEMIN = $row[5];
$balanceFILL = $row[6];
$answersTODAY = $row[7];
$VSCcat1 = $row[8];
$VSCcat1tally = $row[9];
$VSCcat2 = $row[10];
$VSCcat2tally = $row[11];
$VSCcat3 = $row[12];
$VSCcat3tally = $row[13];
$VSCcat4 = $row[14];
$VSCcat4tally = $row[15];
if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) )
{
$diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100);
$diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN);
}
else {$diffpctONEMIN = '0.00';}
$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';";
if ($group=='XXXX-ALL-ACTIVE-XXXX')
{
$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats;";
}
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$balanceSHORT = $row[0];
echo "<BR><table cellpadding=0 cellspacing=0><TR>";
echo "<TD ALIGN=RIGHT><font size=2><B>DIAL LEVEL:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALlev&nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>TRUNK SHORT/FILL:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $balanceSHORT / $balanceFILL &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>FILTER:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALfilter &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B> TIME:</B> &nbsp; </TD><TD ALIGN=LEFT><font size=2> $NOW_TIME </TD>";
echo "";
echo "</TR>";
if ($adastats>1)
{
echo "<TR BGCOLOR=\"#CCCCCC\">";
echo "<TD ALIGN=RIGHT><a href=\"$PHP_SELF?group=$group&RR=4&DB=$DB&adastats=1\"><font size=1>- min </font></a><font size=2>&nbsp; <B>MAX LEVEL:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $maxDIALlev &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DROPPED MAX:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DROPmax% &nbsp; &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>TARGET DIFF:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $targetDIFF &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>INTENSITY:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $ADAintense &nbsp; &nbsp; </TD>";
echo "</TR>";
echo "<TR BGCOLOR=\"#CCCCCC\">";
echo "<TD ALIGN=RIGHT><font size=2><B>DIAL TIMEOUT:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALtimeout &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>TAPER TIME:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $TAPERtime &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>LOCAL TIME:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $CALLtime &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>AVAIL ONLY:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $ADAavailonly &nbsp;</TD>";
echo "</TR>";
}
echo "<TR>";
echo "<TD ALIGN=RIGHT><font size=2><B>DIALABLE LEADS:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DAleads &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>CALLS TODAY:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $callsTODAY &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>AVG AGENTS:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $agentsONEMIN &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DIAL METHOD:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALmethod &nbsp; &nbsp; </TD>";
echo "</TR>";
echo "<TR>";
echo "<TD ALIGN=RIGHT><font size=2><B>HOPPER LEVEL:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $HOPlev &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DROPPED / ANSWERED:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $dropsTODAY / $answersTODAY &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DL DIFF:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $diffONEMIN &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>STATUSES:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALstatuses &nbsp; &nbsp; </TD>";
echo "</TR>";
echo "<TR>";
echo "<TD ALIGN=RIGHT><font size=2><B>LEADS IN HOPPER:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $VDhop &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DROPPED PERCENT:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; ";
if ($drpctTODAY >= $DROPmax)
{echo "<font color=red><B>$drpctTODAY%</B></font>";}
else
{echo "$drpctTODAY%";}
echo " &nbsp; &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DIFF:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $diffpctONEMIN% &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>ORDER:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALorder &nbsp; &nbsp; </TD>";
echo "</TR>";
echo "<TR>";
echo "<TD ALIGN=LEFT COLSPAN=8>";
if ( (!eregi('NULL',$VSCcat1)) and (strlen($VSCcat1)>0) )
{echo "<font size=2><B>$VSCcat1:</B> &nbsp; $VSCcat1tally &nbsp; &nbsp; &nbsp; \n";}
if ( (!eregi('NULL',$VSCcat2)) and (strlen($VSCcat2)>0) )
{echo "<font size=2><B>$VSCcat2:</B> &nbsp; $VSCcat2tally &nbsp; &nbsp; &nbsp; \n";}
if ( (!eregi('NULL',$VSCcat3)) and (strlen($VSCcat3)>0) )
{echo "<font size=2><B>$VSCcat3:</B> &nbsp; $VSCcat3tally &nbsp; &nbsp; &nbsp; \n";}
if ( (!eregi('NULL',$VSCcat4)) and (strlen($VSCcat4)>0) )
{echo "<font size=2><B>$VSCcat4:</B> &nbsp; $VSCcat4tally &nbsp; &nbsp; &nbsp; \n";}
echo "</TD></TR>";
echo "<TR>";
echo "<TD ALIGN=LEFT COLSPAN=8>";
if ($adastats<2)
{
echo "<a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=2&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\"><font size=1>+ VIEW MORE SETTINGS</font></a>";
}
if ($UGdisplay>0)
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=0&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\"><font size=1>HIDE USER GROUP</font></a>";
}
else
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=1&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\"><font size=1>VIEW USER GROUP</font></a>";
}
if ($UidORname>0)
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=0&orderby=$orderby&SERVdisplay=$SERVdisplay\"><font size=1>SHOW AGENT ID</font></a>";
}
else
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=1&orderby=$orderby&SERVdisplay=$SERVdisplay\"><font size=1>SHOW AGENT NAME</font></a>";
}
if ($SERVdisplay>0)
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=0\"><font size=1>HIDE SERVER INFO</font></a>";
}
else
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=1\"><font size=1>SHOW SERVER INFO</font></a>";
}
echo "</TD>";
echo "</TR>";
echo "</TABLE>";
echo "</FORM>\n\n";
}
###################################################################################
###### OUTBOUND CALLS
###################################################################################
if ($campaign_allow_inbound > 0)
{
$stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';";
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$closer_campaigns = preg_replace("/^ | -$/","",$row[0]);
$closer_campaigns = preg_replace("/ /","','",$closer_campaigns);
$closer_campaigns = "'$closer_campaigns'";
$stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type='OUT') );";
}
else
{
if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';}
else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";}
$stmt="select status from vicidial_auto_calls where status NOT IN('XFER') $groupSQL;";
}
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$parked_to_print = mysql_num_rows($rslt);
if ($parked_to_print > 0)
{
$i=0;
$out_total=0;
$out_ring=0;
$out_live=0;
while ($i < $parked_to_print)
{
$row=mysql_fetch_row($rslt);
if (eregi("LIVE",$row[0]))
{$out_live++;}
else
{
if (eregi("CLOSER",$row[0]))
{$nothing=1;}
else
{$out_ring++;}
}
$out_total++;
$i++;
}
if ($out_live > 0) {$F='<FONT class="r1">'; $FG='</FONT>';}
if ($out_live > 4) {$F='<FONT class="r2">'; $FG='</FONT>';}
if ($out_live > 9) {$F='<FONT class="r3">'; $FG='</FONT>';}
if ($out_live > 14) {$F='<FONT class="r4">'; $FG='</FONT>';}
if ($campaign_allow_inbound > 0)
{echo "$NFB$out_total$NFE current active calls&nbsp; &nbsp; &nbsp; \n";}
else
{echo "$NFB$out_total$NFE calls being placed &nbsp; &nbsp; &nbsp; \n";}
echo "$NFB$out_ring$NFE calls ringing &nbsp; &nbsp; &nbsp; &nbsp; \n";
echo "$NFB$F &nbsp;$out_live $FG$NFE calls waiting for agents &nbsp; &nbsp; &nbsp; \n";
}
else
{
echo " NO LIVE CALLS WAITING \n";
}
###################################################################################
###### TIME ON SYSTEM
###################################################################################
$agent_incall=0;
$agent_ready=0;
$agent_paused=0;
$agent_total=0;
$Aecho = '';
$Aecho .= "VICIDIAL: Agents Time On Calls Campaign: $group $NOW_TIME\n\n";
$HDbegin = "+";
$HTbegin = "|";
$HDstation = "------------+";
$HTstation = " STATION |";
$HDuser = "--------------------+";
$HTuser = " <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=userup&SERVdisplay=$SERVdisplay\">USER</a> |";
$HDusergroup = "--------------+";
$HTusergroup = " <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=groupup&SERVdisplay=$SERVdisplay\">USER GROUP</a> |";
$HDsessionid = "------------------+";
$HTsessionid = " SESSIONID |";
$HDbarge = "-------+";
$HTbarge = " BARGE |";
$HDstatus = "----------+";
$HTstatus = " STATUS |";
$HDserver_ip = "-----------------+";
$HTserver_ip = " SERVER IP |";
$HDcall_server_ip = "-----------------+";
$HTcall_server_ip = " CALL SERVER IP |";
$HDtime = "---------+";
$HTtime = " <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=timeup&SERVdisplay=$SERVdisplay\">MM:SS</a> |";
$HDcampaign = "------------+";
$HTcampaign = " <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=campaignup&SERVdisplay=$SERVdisplay\">CAMPAIGN</a> |";
if ($UGdisplay < 1)
{
$HDusergroup = '';
$HTusergroup = '';
}
if ( ($SIPmonitorLINK<1) && ($IAXmonitorLINK<1) )
{
$HDsessionid = "-----------+";
$HTsessionid = " SESSIONID |";
}
if ( ($SIPmonitorLINK<2) && ($IAXmonitorLINK<2) )
{
$HDbarge = '';
$HTbarge = '';
}
if ($SERVdisplay < 1)
{
$HDserver_ip = '';
$HTserver_ip = '';
$HDcall_server_ip = '';
$HTcall_server_ip = '';
}
$Aline = "$HDbegin$HDstation$HDuser$HDusergroup$HDsessionid$HDbarge$HDstatus$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign\n";
$Bline = "$HTbegin$HTstation$HTuser$HTusergroup$HTsessionid$HTbarge$HTstatus$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign\n";
$Aecho .= "$Aline";
$Aecho .= "$Bline";
$Aecho .= "$Aline";
if ($orderby=='timeup') {$orderSQL='status,last_call_time';}
if ($orderby=='timedown') {$orderSQL='status desc,last_call_time desc';}
if ($orderby=='campaignup') {$orderSQL='campaign_id,status,last_call_time';}
if ($orderby=='campaigndown') {$orderSQL='campaign_id desc,status desc,last_call_time desc';}
if ($orderby=='groupup') {$orderSQL='user_group,status,last_call_time';}
if ($orderby=='groupdown') {$orderSQL='user_group desc,status desc,last_call_time desc';}
if ($UidORname > 0)
{
if ($orderby=='userup') {$orderSQL='full_name,status,last_call_time';}
if ($orderby=='userdown') {$orderSQL='full_name desc,status desc,last_call_time desc';}
}
else
{
if ($orderby=='userup') {$orderSQL='vicidial_live_agents.user';}
if ($orderby=='userdown') {$orderSQL='vicidial_live_agents.user desc';}
}
if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';}
else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";}
if (strlen($usergroup)<1) {$usergroupSQL = '';}
else {$usergroupSQL = " and user_group='" . mysql_real_escape_string($usergroup) . "'";}
$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name,vicidial_live_agents.comments from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user $groupSQL $usergroupSQL order by $orderSQL;";
#$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user and campaign_id='" . mysql_real_escape_string($group) . "' order by $orderSQL;";
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$talking_to_print = mysql_num_rows($rslt);
if ($talking_to_print > 0)
{
$i=0;
$agentcount=0;
while ($i < $talking_to_print)
{
$row=mysql_fetch_row($rslt);
if (eregi("READY|PAUSED",$row[3]))
{
$row[5]=$row[6];
}
if ($non_latin < 1)
{
$extension = eregi_replace('Local/',"",$row[0]);
$extension = sprintf("%-10s", $extension);
while(strlen($extension)>10) {$extension = substr("$extension", 0, -1);}
}
else
{
$extension = eregi_replace('Local/',"",$row[0]);
$extension = sprintf("%-40s", $extension);
while(mb_strlen($extension, 'utf-8')>10) {$extension = mb_substr("$extension", 0, -1,'utf8');}
}
$Luser = $row[1];
$user = sprintf("%-18s", $row[1]);
$Lsessionid = $row[2];
$sessionid = sprintf("%-9s", $row[2]);
$Lstatus = $row[3];
$status = sprintf("%-6s", $row[3]);
$server_ip = sprintf("%-15s", $row[4]);
$call_server_ip = sprintf("%-15s", $row[7]);
$campaign_id = sprintf("%-10s", $row[8]);
$comments= $row[11];
if (eregi("INCALL",$Lstatus))
{
if ( (eregi("AUTO",$comments)) or (strlen($comments)<1) )
{$CM='A';}
else
{
if (eregi("INBOUND",$comments))
{$CM='I';}
else
{$CM='M';}
}
}
else {$CM=' ';}
if ($UGdisplay > 0)
{
if ($non_latin < 1)
{
$user_group = sprintf("%-12s", $row[9]);
while(strlen($user_group)>12) {$user_group = substr("$user_group", 0, -1);}
}
else
{
$user_group = sprintf("%-40s", $row[9]);
while(mb_strlen($user_group, 'utf-8')>12) {$user_group = mb_substr("$user_group", 0, -1,'utf8');}
}
}
if ($UidORname > 0)
{
if ($non_latin < 1)
{
$user = sprintf("%-18s", $row[10]);
while(strlen($user)>18) {$user = substr("$user", 0, -1);}
}
else
{
$user = sprintf("%-40s", $row[10]);
while(mb_strlen($user, 'utf-8')>18) {$user = mb_substr("$user", 0, -1,'utf8');}
}
}
if (!eregi("INCALL|QUEUE",$row[3]))
{$call_time_S = ($STARTtime - $row[6]);}
else
{$call_time_S = ($STARTtime - $row[5]);}
$call_time_M = ($call_time_S / 60);
$call_time_M = round($call_time_M, 2);
$call_time_M_int = intval("$call_time_M");
$call_time_SEC = ($call_time_M - $call_time_M_int);
$call_time_SEC = ($call_time_SEC * 60);
$call_time_SEC = round($call_time_SEC, 0);
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
$call_time_MS = "$call_time_M_int:$call_time_SEC";
$call_time_MS = sprintf("%7s", $call_time_MS);
$G = ''; $EG = '';
if ($Lstatus=='INCALL')
{
if ($call_time_S >= 10) {$G='<SPAN class="thistle"><B>'; $EG='</B></SPAN>';}
if ($call_time_M_int >= 1) {$G='<SPAN class="violet"><B>'; $EG='</B></SPAN>';}
if ($call_time_M_int >= 5) {$G='<SPAN class="purple"><B>'; $EG='</B></SPAN>';}
# if ($call_time_M_int >= 10) {$G='<SPAN class="purple"><B>'; $EG='</B></SPAN>';}
}
if (eregi("PAUSED",$row[3]))
{
if ($call_time_M_int >= 30)
{$i++; continue;}
else
{
$agent_paused++; $agent_total++;
$G=''; $EG='';
if ($call_time_S >= 10) {$G='<SPAN class="khaki"><B>'; $EG='</B></SPAN>';}
if ($call_time_M_int >= 1) {$G='<SPAN class="yellow"><B>'; $EG='</B></SPAN>';}
if ($call_time_M_int >= 5) {$G='<SPAN class="olive"><B>'; $EG='</B></SPAN>';}
}
}
# if ( (strlen($row[7])> 4) and ($row[7] != "$row[4]") )
# {$G='<SPAN class="orange"><B>'; $EG='</B></SPAN>';}
if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;}
if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;}
if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) )
{
$G='<SPAN class="lightblue"><B>'; $EG='</B></SPAN>';
if ($call_time_M_int >= 1) {$G='<SPAN class="blue"><B>'; $EG='</B></SPAN>';}
if ($call_time_M_int >= 5) {$G='<SPAN class="midnightblue"><B>'; $EG='</B></SPAN>';}
}
$L='';
$R='';
if ($SIPmonitorLINK>0) {$L=" <a href=\"sip:6$Lsessionid@$server_ip\">LISTEN</a>"; $R='';}
if ($IAXmonitorLINK>0) {$L=" <a href=\"iax:6$Lsessionid@$server_ip\">LISTEN</a>"; $R='';}
if ($SIPmonitorLINK>1) {$R=" | <a href=\"sip:$Lsessionid@$server_ip\">BARGE</a>";}
if ($IAXmonitorLINK>1) {$R=" | <a href=\"iax:$Lsessionid@$server_ip\">BARGE</a>";}
if ($UGdisplay > 0) {$UGD = " $G$user_group$EG |";}
else {$UGD = "";}
if ($SERVdisplay > 0) {$SVD = "$G$server_ip$EG | $G$call_server_ip$EG | ";}
else {$SVD = "";}
$agentcount++;
$Aecho .= "| $G$extension$EG | <a href=\"./user_status.php?user=$Luser\" target=\"_blank\">$G$user$EG</a> |$UGD $G$sessionid$EG$L$R | $G$status$EG $CM | $SVD$G$call_time_MS$EG | $G$campaign_id$EG |\n";
$i++;
}
$Aecho .= "$Aline";
$Aecho .= " $agentcount agents logged in on all servers\n";
$Aecho .= " System Load Average: $load_ave\n\n";
# $Aecho .= " <SPAN class=\"orange\"><B> </SPAN> - Balanced call</B>\n";
$Aecho .= " <SPAN class=\"lightblue\"><B> </SPAN> - Agent waiting for call</B>\n";
$Aecho .= " <SPAN class=\"blue\"><B> </SPAN> - Agent waiting for call > 1 minute</B>\n";
$Aecho .= " <SPAN class=\"midnightblue\"><B> </SPAN> - Agent waiting for call > 5 minutes</B>\n";
$Aecho .= " <SPAN class=\"thistle\"><B> </SPAN> - Agent on call > 10 seconds</B>\n";
$Aecho .= " <SPAN class=\"violet\"><B> </SPAN> - Agent on call > 1 minute</B>\n";
$Aecho .= " <SPAN class=\"purple\"><B> </SPAN> - Agent on call > 5 minutes</B>\n";
$Aecho .= " <SPAN class=\"khaki\"><B> </SPAN> - Agent Paused > 10 seconds</B>\n";
$Aecho .= " <SPAN class=\"yellow\"><B> </SPAN> - Agent Paused > 1 minute</B>\n";
$Aecho .= " <SPAN class=\"olive\"><B> </SPAN> - Agent Paused > 5 minutes</B>\n";
if ($agent_ready > 0) {$B='<FONT class="b1">'; $BG='</FONT>';}
if ($agent_ready > 4) {$B='<FONT class="b2">'; $BG='</FONT>';}
if ($agent_ready > 9) {$B='<FONT class="b3">'; $BG='</FONT>';}
if ($agent_ready > 14) {$B='<FONT class="b4">'; $BG='</FONT>';}
echo "\n<BR>\n";
echo "$NFB$agent_total$NFE agents logged in &nbsp; &nbsp; &nbsp; &nbsp; \n";
echo "$NFB$agent_incall$NFE agents in calls &nbsp; &nbsp; &nbsp; \n";
echo "$NFB$B &nbsp;$agent_ready $BG$NFE agents waiting &nbsp; &nbsp; &nbsp; \n";
echo "$NFB$agent_paused$NFE paused agents &nbsp; &nbsp; &nbsp; \n";
echo "<PRE><FONT SIZE=2>";
echo "";
echo "$Aecho";
}
else
{
echo " NO AGENTS ON CALLS \n";
}
?>
</PRE>
</BODY></HTML>
@@ -1,943 +0,0 @@
<?
# AST_timeonVDADall.php
#
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
# live real-time stats for the VICIDIAL Auto-Dialer all servers
#
# STOP=4000, SLOW=40, GO=4 seconds refresh interval
#
# CHANGELOG:
# 50406-0920 - Added Paused agents < 1 min (Chris Doyle)
# 51130-1218 - Modified layout and info to show all servers in a vicidial system
# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60511-1343 - Added leads and drop info at the top of the screen
# 60608-1539 - Fixed CLOSER tallies for active calls
# 60619-1658 - Added variable filtering to eliminate SQL injection attack threat
# - Added required user/pass to gain access to this page
# 60626-1453 - Added display of system load to bottom (Angelito Manansala)
# 60901-1123 - Changed display elements at the top of the screen
# 60905-1342 - Fixed non INCALL|QUEUE timer column
# 61002-1642 - Added TRUNK SHORT/FILL stats
# 61101-1318 - Added SIP and IAX Listen and Barge links option
# 61101-1647 - Added Usergroup column and user name option as well as sorting
# 61102-1155 - Made display of columns more modular, added ability to hide server info
# 61215-1131 - Added answered calls and drop percent taken from answered calls
# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns
# 70123-1151 - Added non_latin options for substr in display variables, thanks Marin Blu
# 70206-1140 - Added call-type statuses to display(A-Auto, M-Manual, I-Inbound/Closer)
#
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["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["RR"])) {$RR=$_GET["RR"];}
elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];}
if (isset($_GET["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["usergroup"])) {$usergroup=$_GET["usergroup"];}
elseif (isset($_POST["usergroup"])) {$usergroup=$_POST["usergroup"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];}
elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];}
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"];}
if (isset($_GET["SIPmonitorLINK"])) {$SIPmonitorLINK=$_GET["SIPmonitorLINK"];}
elseif (isset($_POST["SIPmonitorLINK"])) {$SIPmonitorLINK=$_POST["SIPmonitorLINK"];}
if (isset($_GET["IAXmonitorLINK"])) {$IAXmonitorLINK=$_GET["IAXmonitorLINK"];}
elseif (isset($_POST["IAXmonitorLINK"])) {$IAXmonitorLINK=$_POST["IAXmonitorLINK"];}
if (isset($_GET["UGdisplay"])) {$UGdisplay=$_GET["UGdisplay"];}
elseif (isset($_POST["UGdisplay"])) {$UGdisplay=$_POST["UGdisplay"];}
if (isset($_GET["UidORname"])) {$UidORname=$_GET["UidORname"];}
elseif (isset($_POST["UidORname"])) {$UidORname=$_POST["UidORname"];}
if (isset($_GET["orderby"])) {$orderby=$_GET["orderby"];}
elseif (isset($_POST["orderby"])) {$orderby=$_POST["orderby"];}
if (isset($_GET["SERVdisplay"])) {$SERVdisplay=$_GET["SERVdisplay"];}
elseif (isset($_POST["SERVdisplay"])) {$SERVdisplay=$_POST["SERVdisplay"];}
if (isset($_GET["RECmonitorLINK"])) {$RECmonitorLINK=$_GET["RECmonitorLINK"];}
elseif (isset($_POST["RECmonitorLINK"])) {$RECmonitorLINK=$_POST["RECmonitorLINK"];}
if (!isset($RR)) {$gRRroup=4;}
if (!isset($group)) {$group='';}
if (!isset($usergroup)) {$usergroup='';}
if (!isset($UGdisplay)) {$UGdisplay=0;} # 0=no, 1=yes
if (!isset($UidORname)) {$UidORname=0;} # 0=id, 1=name
if (!isset($orderby)) {$orderby='timeup';}
if (!isset($SERVdisplay)) {$SERVdisplay=1;} # 0=no, 1=yes
function get_server_load($windows = false) {
$os = strtolower(PHP_OS);
if(strpos($os, "win") === false) {
if(file_exists("/proc/loadavg")) {
$load = file_get_contents("/proc/loadavg");
$load = explode(' ', $load);
return $load[0];
}
elseif(function_exists("shell_exec")) {
$load = explode(' ', `uptime`);
return $load[count($load)-1];
}
else {
return false;
}
}
elseif($windows) {
if(class_exists("COM")) {
$wmi = new COM("WinMgmts:\\\\.");
$cpus = $wmi->InstancesOf("Win32_Processor");
$cpuload = 0;
$i = 0;
while ($cpu = $cpus->Next()) {
$cpuload += $cpu->LoadPercentage;
$i++;
}
$cpuload = round($cpuload / $i, 2);
return "$cpuload%";
}
else {
return false;
}
}
}
$load_ave = get_server_load(true);
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
$stmt="SELECT vicidial_recording from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$authrec=$row[0];
if ($authrec=='1') {$RECmonitorLINK = 1;} else {$RECmonitorLINK = 0;}
$NOW_TIME = date("Y-m-d H:i:s");
$FILE_TIME = date("Ymd-His");
$NOW_DAY = date("Y-m-d");
$NOW_HOUR = date("H:i:s");
$STARTtime = date("U");
$epochSIXhoursAGO = ($STARTtime - 21600);
$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO);
$stmt="select campaign_id from vicidial_campaigns where active='Y';";
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
}
if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link);
if (!isset($DB)) {$DB=0;}
if ($DB) {echo "$stmt\n";}
$groups_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $groups_to_print)
{
$row=mysql_fetch_row($rslt);
$groups[$i] =$row[0];
$i++;
}
$stmt="select * from vicidial_user_groups;";
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
}
if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link);
if (!isset($DB)) {$DB=0;}
if ($DB) {echo "$stmt\n";}
$usergroups_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $usergroups_to_print)
{
$row=mysql_fetch_row($rslt);
$usergroups[$i] =$row[0];
$i++;
}
if (!isset($RR)) {$RR=4;}
$NFB = '<b><font size=6 face="courier">';
$NFE = '</font></b>';
$F=''; $FG=''; $B=''; $BG='';
?>
<HTML>
<HEAD>
<script language="Javascript">
var filenamelog = '';
var admuser = '<? echo $PHP_AUTH_USER ?>';
var filedate = '<? echo $FILE_TIME ?>';
var pass = '<? echo $PHP_AUTH_PW ?>';
var recording_exten = '8309';
var ext_context = 'default';
function conf_send_recording(taskconfrectype,sesname,taskconfrec,taskconffile,leadid,userid,campaignid,serverip,userpass)
{
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
{
xmlhttp = new XMLHttpRequest();
}
if (xmlhttp)
{
var channelrec = "Local/7" + taskconfrec + "@" + ext_context;
if (taskconfrectype=='MonitorConf'){
filenamelog = "AUTO" + "_" + filedate + "_" + admuser + "_" + userid + "_" + campaignid ;
}
else {
filenamelog = taskconffile;
}
confmonitor_query = "server_ip=" + serverip + "&session_name=" + sesname + "&user=" + userid + "&pass=" + userpass + "&ACTION=" + taskconfrectype + "&format=text&channel=" + channelrec + "&filename=" + filenamelog + "&exten=" + recording_exten + "&ext_context=" + ext_context + "&ext_priority=1" + "&lead_id=" + leadid;
xmlhttp.open('POST', 'manager_send.php');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp.send(confmonitor_query);
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
Nactiveext = null;
Nactiveext = xmlhttp.responseText;
}
}
delete xmlhttp;
}
}
</script>
<STYLE type="text/css">
<!--
.green {color: white; background-color: green}
.red {color: white; background-color: red}
.lightblue {color: black; background-color: #ADD8E6}
.blue {color: white; background-color: blue}
.midnightblue {color: white; background-color: #191970}
.purple {color: white; background-color: purple}
.violet {color: black; background-color: #EE82EE}
.thistle {color: black; background-color: #D8BFD8}
.olive {color: white; background-color: #808000}
.yellow {color: black; background-color: yellow}
.khaki {color: black; background-color: #F0E68C}
.orange {color: black; background-color: orange}
.r1 {color: black; background-color: #FFCCCC}
.r2 {color: black; background-color: #FF9999}
.r3 {color: black; background-color: #FF6666}
.r4 {color: white; background-color: #FF0000}
.b1 {color: black; background-color: #CCCCFF}
.b2 {color: black; background-color: #9999FF}
.b3 {color: black; background-color: #6666FF}
.b4 {color: white; background-color: #0000FF}
-->
</STYLE>
<?
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo"<META HTTP-EQUIV=Refresh CONTENT=\"$RR; URL=$PHP_SELF?RR=$RR&DB=$DB&group=$group&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&RECmonitorLINK=$RECmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\">\n";
echo "<TITLE>VICIDIAL: Time On VDAD Campaign: $group</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
echo "VICIDIAL Campaign: \n";
echo "<INPUT TYPE=HIDDEN NAME=RR VALUE=\"$RR\">\n";
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
echo "<INPUT TYPE=HIDDEN NAME=adastats VALUE=\"$adastats\">\n";
echo "<INPUT TYPE=HIDDEN NAME=SIPmonitorLINK VALUE=\"$SIPmonitorLINK\">\n";
echo "<INPUT TYPE=HIDDEN NAME=IAXmonitorLINK VALUE=\"$IAXmonitorLINK\">\n";
echo "<INPUT TYPE=HIDDEN NAME=RECmonitorLINK VALUE=\"$RECmonitorLINK\">\n";
echo "<INPUT TYPE=HIDDEN NAME=usergroup VALUE=\"$usergroup\">\n";
echo "<INPUT TYPE=HIDDEN NAME=UGdisplay VALUE=\"$UGdisplay\">\n";
echo "<INPUT TYPE=HIDDEN NAME=UidORname VALUE=\"$UidORname\">\n";
echo "<INPUT TYPE=HIDDEN NAME=orderby VALUE=\"$orderby\">\n";
echo "<INPUT TYPE=HIDDEN NAME=SERVdisplay VALUE=\"$SERVdisplay\">\n";
echo "<SELECT SIZE=1 NAME=group>\n";
echo "<option value=\"XXXX-ALL-ACTIVE-XXXX\">ALL ACTIVE</option>\n";
$o=0;
while ($groups_to_print > $o)
{
if ($groups[$o] == $group) {echo "<option selected value=\"$groups[$o]\">$groups[$o]</option>\n";}
else {echo "<option value=\"$groups[$o]\">$groups[$o]</option>\n";}
$o++;
}
echo "</SELECT>\n";
if ($UGdisplay > 0)
{
echo "<SELECT SIZE=1 NAME=usergroup>\n";
echo "<option value=\"\">ALL USER GROUPS</option>\n";
$o=0;
while ($usergroups_to_print > $o)
{
if ($usergroups[$o] == $usergroup) {echo "<option selected value=\"$usergroups[$o]\">$usergroups[$o]</option>\n";}
else {echo "<option value=\"$usergroups[$o]\">$usergroups[$o]</option>\n";}
$o++;
}
echo "</SELECT>\n";
}
echo "<INPUT type=submit NAME=SUBMIT VALUE=SUBMIT><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2> &nbsp; &nbsp; &nbsp; &nbsp; \n";
echo "<a href=\"$PHP_SELF?group=$group&RR=4000&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&RECmonitorLINK=$RECmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\">STOP</a> | ";
echo "<a href=\"$PHP_SELF?group=$group&RR=40&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&RECmonitorLINK=$RECmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\">SLOW</a> | ";
echo "<a href=\"$PHP_SELF?group=$group&RR=4&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&RECmonitorLINK=$RECmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\">GO</a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"./admin.php?ADD=34&campaign_id=$group\">MODIFY</a> | \n";
echo "<a href=\"./AST_timeonVDADallSUMMARY.php?group=$group&RR=$RR&DB=$DB&adastats=$adastats\">SUMMARY</a> | \n";
echo "<a href=\"./admin.php?ADD=999999\">REPORTS</a> </FONT>\n";
echo "\n\n";
if (!$group) {echo "<BR><BR>please select a campaign from the pulldown above</FORM>\n"; exit;}
else
{
$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';";
if ($group=='XXXX-ALL-ACTIVE-XXXX')
{
$stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses) from vicidial_campaigns;";
}
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
}
if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$DIALlev = $row[0];
$DIALstatusA = $row[1];
$DIALstatusB = $row[2];
$DIALstatusC = $row[3];
$DIALstatusD = $row[4];
$DIALstatusE = $row[5];
$DIALorder = $row[6];
$DIALfilter = $row[7];
$HOPlev = $row[8];
$DIALmethod = $row[9];
$maxDIALlev = $row[10];
$DROPmax = $row[11];
$targetDIFF = $row[12];
$ADAintense = $row[13];
$ADAavailonly = $row[14];
$TAPERtime = $row[15];
$CALLtime = $row[16];
$DIALtimeout = $row[17];
$DIALstatuses = $row[18];
$DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses));
$DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses));
$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';";
if ($group=='XXXX-ALL-ACTIVE-XXXX')
{
$stmt="select count(*) from vicidial_hopper;";
}
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
}
if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$VDhop = $row[0];
$stmt="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';";
if ($group=='XXXX-ALL-ACTIVE-XXXX')
{
$stmt="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today) from vicidial_campaign_stats;";
}
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
}
if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$DAleads = $row[0];
$callsTODAY = $row[1];
$dropsTODAY = $row[2];
$drpctTODAY = $row[3];
$diffONEMIN = $row[4];
$agentsONEMIN = $row[5];
$balanceFILL = $row[6];
$answersTODAY = $row[7];
if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) )
{
$diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100);
$diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN);
}
else {$diffpctONEMIN = '0.00';}
$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';";
if ($group=='XXXX-ALL-ACTIVE-XXXX')
{
$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats;";
}
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
}
if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$balanceSHORT = $row[0];
echo "<BR><table cellpadding=0 cellspacing=0><TR>";
echo "<TD ALIGN=RIGHT><font size=2><B>DIAL LEVEL:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALlev&nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>TRUNK SHORT/FILL:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $balanceSHORT / $balanceFILL &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>FILTER:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALfilter &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B> TIME:</B> &nbsp; </TD><TD ALIGN=LEFT><font size=2> $NOW_TIME </TD>";
echo "";
echo "</TR>";
if ($adastats>1)
{
echo "<TR BGCOLOR=\"#CCCCCC\">";
echo "<TD ALIGN=RIGHT><a href=\"$PHP_SELF?group=$group&RR=4&DB=$DB&adastats=1\"><font size=1>- min </font></a><font size=2>&nbsp; <B>MAX LEVEL:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $maxDIALlev &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DROPPED MAX:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DROPmax% &nbsp; &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>TARGET DIFF:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $targetDIFF &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>INTENSITY:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $ADAintense &nbsp; &nbsp; </TD>";
echo "</TR>";
echo "<TR BGCOLOR=\"#CCCCCC\">";
echo "<TD ALIGN=RIGHT><font size=2><B>DIAL TIMEOUT:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALtimeout &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>TAPER TIME:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $TAPERtime &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>LOCAL TIME:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $CALLtime &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>AVAIL ONLY:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $ADAavailonly &nbsp;</TD>";
echo "</TR>";
}
echo "<TR>";
echo "<TD ALIGN=RIGHT><font size=2><B>DIALABLE LEADS:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DAleads &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>CALLS TODAY:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $callsTODAY &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>AVG AGENTS:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $agentsONEMIN &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DIAL METHOD:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALmethod &nbsp; &nbsp; </TD>";
echo "</TR>";
echo "<TR>";
echo "<TD ALIGN=RIGHT><font size=2><B>HOPPER LEVEL:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $HOPlev &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DROPPED / ANSWERED:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $dropsTODAY / $answersTODAY &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DL DIFF:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $diffONEMIN &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>STATUSES:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALstatuses &nbsp; &nbsp; </TD>";
echo "</TR>";
echo "<TR>";
echo "<TD ALIGN=RIGHT><font size=2><B>LEADS IN HOPPER:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $VDhop &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DROPPED PERCENT:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $drpctTODAY% &nbsp; &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DIFF:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $diffpctONEMIN% &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>ORDER:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALorder &nbsp; &nbsp; </TD>";
echo "</TR>";
echo "<TR>";
echo "<TD ALIGN=LEFT COLSPAN=8>";
if ($adastats<2)
{
echo "<a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=2&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&RECmonitorLINK=$RECmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\"><font size=1>+ VIEW MORE SETTINGS</font></a>";
}
if ($UGdisplay>0)
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&RECmonitorLINK=$RECmonitorLINK&usergroup=$usergroup&UGdisplay=0&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\"><font size=1>HIDE USER GROUP</font></a>";
}
else
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&RECmonitorLINK=$RECmonitorLINK&usergroup=$usergroup&UGdisplay=1&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay\"><font size=1>VIEW USER GROUP</font></a>";
}
if ($UidORname>0)
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&RECmonitorLINK=$RECmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=0&orderby=$orderby&SERVdisplay=$SERVdisplay\"><font size=1>SHOW AGENT ID</font></a>";
}
else
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&RECmonitorLINK=$RECmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=1&orderby=$orderby&SERVdisplay=$SERVdisplay\"><font size=1>SHOW AGENT NAME</font></a>";
}
if ($SERVdisplay>0)
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&RECmonitorLINK=$RECmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=0\"><font size=1>HIDE SERVER INFO</font></a>";
}
else
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&RECmonitorLINK=$RECmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=1\"><font size=1>SHOW SERVER INFO</font></a>";
}
echo "</TD>";
echo "</TR>";
echo "</TABLE>";
echo "</FORM>\n\n";
}
###################################################################################
###### OUTBOUND CALLS
###################################################################################
if (eregi("(CLOSER|BLEND|INBND|_C$|_B$|_I$)",$group))
{
$stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';";
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
}
if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$closer_campaigns = preg_replace("/^ | -$/","",$row[0]);
$closer_campaigns = preg_replace("/ /","','",$closer_campaigns);
$closer_campaigns = "'$closer_campaigns'";
$stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type='OUT') );";
}
else
{
if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';}
else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";}
$stmt="select status from vicidial_auto_calls where status NOT IN('XFER') $groupSQL;";
}
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
}
if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$parked_to_print = mysql_num_rows($rslt);
if ($parked_to_print > 0)
{
$i=0;
$out_total=0;
$out_ring=0;
$out_live=0;
while ($i < $parked_to_print)
{
$row=mysql_fetch_row($rslt);
if (eregi("LIVE",$row[0]))
{$out_live++;}
else
{
if (eregi("CLOSER",$row[0]))
{$nothing=1;}
else
{$out_ring++;}
}
$out_total++;
$i++;
}
if ($out_live > 0) {$F='<FONT class="r1">'; $FG='</FONT>';}
if ($out_live > 4) {$F='<FONT class="r2">'; $FG='</FONT>';}
if ($out_live > 9) {$F='<FONT class="r3">'; $FG='</FONT>';}
if ($out_live > 14) {$F='<FONT class="r4">'; $FG='</FONT>';}
if (eregi("(CLOSER|BLEND|INBND|_C$|_B$|_I$)",$group))
{echo "$NFB$out_total$NFE current active calls&nbsp; &nbsp; &nbsp; \n";}
else
{echo "$NFB$out_total$NFE calls being placed &nbsp; &nbsp; &nbsp; \n";}
echo "$NFB$out_ring$NFE calls ringing &nbsp; &nbsp; &nbsp; &nbsp; \n";
echo "$NFB$F &nbsp;$out_live $FG$NFE calls waiting for agents &nbsp; &nbsp; &nbsp; \n";
}
else
{
echo " NO LIVE CALLS WAITING \n";
}
###################################################################################
###### TIME ON SYSTEM
###################################################################################
$agent_incall=0;
$agent_ready=0;
$agent_paused=0;
$agent_total=0;
$Aecho = '';
$Aecho .= "VICIDIAL: Agents Time On Calls Campaign: $group $NOW_TIME\n\n";
$HDbegin = "+";
$HTbegin = "|";
$HDstation = "------------+";
$HTstation = " STATION |";
$HDuser = "--------------------+";
$HTuser = " <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&RECmonitorLINK=$RECmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=userup&SERVdisplay=$SERVdisplay\">USER</a> |";
$HDusergroup = "--------------+";
$HTusergroup = " <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&RECmonitorLINK=$RECmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=groupup&SERVdisplay=$SERVdisplay\">USER GROUP</a> |";
$HDsessionid = "------------------+";
$HTsessionid = " SESSIONID |";
$HDbarge = "-------+";
$HTbarge = " BARGE |";
$HDrec = "---------+";
$HTrec = " MONITOR |";
$HDstatus = "----------+";
$HTstatus = " STATUS |";
$HDserver_ip = "-----------------+";
$HTserver_ip = " SERVER IP |";
$HDcall_server_ip = "-----------------+";
$HTcall_server_ip = " CALL SERVER IP |";
$HDtime = "---------+";
$HTtime = " <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&RECmonitorLINK=$RECmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=timeup&SERVdisplay=$SERVdisplay\">MM:SS</a> |";
$HDcampaign = "------------+";
$HTcampaign = " <a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&RECmonitorLINK=$RECmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=campaignup&SERVdisplay=$SERVdisplay\">CAMPAIGN</a> |";
if ($UGdisplay < 1)
{
$HDusergroup = '';
$HTusergroup = '';
}
if ( ($SIPmonitorLINK<1) && ($IAXmonitorLINK<1) )
{
$HDsessionid = "-----------+";
$HTsessionid = " SESSIONID |";
}
if ( ($SIPmonitorLINK<2) && ($IAXmonitorLINK<2) )
{
$HDbarge = '';
$HTbarge = '';
}
if ($SERVdisplay < 1)
{
$HDserver_ip = '';
$HTserver_ip = '';
$HDcall_server_ip = '';
$HTcall_server_ip = '';
}
if ( ($RECmonitorLINK<1) )
{
$HDrec = '';
$HTrec = '';
}
$Aline = "$HDbegin$HDstation$HDuser$HDusergroup$HDsessionid$HDbarge$HDstatus$HDrec$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign\n";
$Bline = "$HTbegin$HTstation$HTuser$HTusergroup$HTsessionid$HTbarge$HTstatus$HTrec$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign\n";
$Aecho .= "$Aline";
$Aecho .= "$Bline";
$Aecho .= "$Aline";
if ($orderby=='timeup') {$orderSQL='status,last_call_time';}
if ($orderby=='timedown') {$orderSQL='status desc,last_call_time desc';}
if ($orderby=='campaignup') {$orderSQL='campaign_id,status,last_call_time';}
if ($orderby=='campaigndown') {$orderSQL='campaign_id desc,status desc,last_call_time desc';}
if ($orderby=='groupup') {$orderSQL='user_group,status,last_call_time';}
if ($orderby=='groupdown') {$orderSQL='user_group desc,status desc,last_call_time desc';}
if ($UidORname > 0)
{
if ($orderby=='userup') {$orderSQL='full_name,status,last_call_time';}
if ($orderby=='userdown') {$orderSQL='full_name desc,status desc,last_call_time desc';}
}
else
{
if ($orderby=='userup') {$orderSQL='vicidial_live_agents.user';}
if ($orderby=='userdown') {$orderSQL='vicidial_live_agents.user desc';}
}
if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';}
else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";}
if (strlen($usergroup)<1) {$usergroupSQL = '';}
else {$usergroupSQL = " and user_group='" . mysql_real_escape_string($usergroup) . "'";}
$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name,vicidial_live_agents.comments,lead_id,vicidial_users.pass from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user $groupSQL $usergroupSQL order by $orderSQL;";
#$stmt="select extension,vicidial_live_agents.user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id,vicidial_users.user_group,vicidial_users.full_name from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user and campaign_id='" . mysql_real_escape_string($group) . "' order by $orderSQL;";
if ($non_latin > 0)
{
$rslt=mysql_query("SET NAMES 'UTF8'");
}
if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$talking_to_print = mysql_num_rows($rslt);
if ($talking_to_print > 0)
{
$i=0;
$agentcount=0;
while ($i < $talking_to_print)
{
$row=mysql_fetch_row($rslt);
if (eregi("READY|PAUSED",$row[3]))
{
$row[5]=$row[6];
}
if ($non_latin < 1)
{
$extension = eregi_replace('Local/',"",$row[0]);
$extension = eregi_replace('IAX2/',"",$row[0]);
$extension = sprintf("%-10s", $extension);
while(strlen($extension)>10) {$extension = substr("$extension", 0, -1);}
}
else
{
$extension = eregi_replace('Local/',"",$row[0]);
$extension = eregi_replace('IAX2/',"",$row[0]);
$extension = sprintf("%-40s", $extension);
while(mb_strlen($extension, 'utf-8')>10) {$extension = mb_substr("$extension", 0, -1,'utf8');}
}
$Luser = $row[1];
$user = sprintf("%-18s", $row[1]);
$Lsessionid = $row[2];
$sessionid = sprintf("%-9s", $row[2]);
$Lstatus = $row[3];
$status = sprintf("%-6s", $row[3]);
$Lserver_ip = $row[4];
$server_ip = sprintf("%-15s", $row[4]);
$call_server_ip = sprintf("%-15s", $row[7]);
$campaign_id = sprintf("%-10s", $row[8]);
$comments= $row[11];
$lead_id = $row[12];
$user_pass = $row[13];
if (eregi("INCALL",$Lstatus))
{
if ( (eregi("AUTO",$comments)) or (strlen($comments)<1) )
{$CM='A';}
else
{
if (eregi("INBOUND",$comments))
{$CM='I';}
else
{$CM='M';}
}
}
else {$CM=' ';}
if ($UGdisplay > 0)
{
if ($non_latin < 1)
{
$user_group = sprintf("%-12s", $row[9]);
while(strlen($user_group)>12) {$user_group = substr("$user_group", 0, -1);}
}
else
{
$user_group = sprintf("%-40s", $row[9]);
while(mb_strlen($user_group, 'utf-8')>12) {$user_group = mb_substr("$user_group", 0, -1,'utf8');}
}
}
if ($UidORname > 0)
{
if ($non_latin < 1)
{
$user = sprintf("%-18s", $row[10]);
while(strlen($user)>18) {$user = substr("$user", 0, -1);}
}
else
{
$user = sprintf("%-40s", $row[10]);
while(mb_strlen($user, 'utf-8')>18) {$user = mb_substr("$user", 0, -1,'utf8');}
}
}
if (!eregi("INCALL|QUEUE",$row[3]))
{$call_time_S = ($STARTtime - $row[6]);}
else
{$call_time_S = ($STARTtime - $row[5]);}
$call_time_M = ($call_time_S / 60);
$call_time_M = round($call_time_M, 2);
$call_time_M_int = intval("$call_time_M");
$call_time_SEC = ($call_time_M - $call_time_M_int);
$call_time_SEC = ($call_time_SEC * 60);
$call_time_SEC = round($call_time_SEC, 0);
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
$call_time_MS = "$call_time_M_int:$call_time_SEC";
$call_time_MS = sprintf("%7s", $call_time_MS);
$G = ''; $EG = '';
if ($Lstatus=='INCALL')
{
if ($call_time_S >= 10) {$G='<SPAN class="thistle"><B>'; $EG='</B></SPAN>';}
if ($call_time_M_int >= 1) {$G='<SPAN class="violet"><B>'; $EG='</B></SPAN>';}
if ($call_time_M_int >= 5) {$G='<SPAN class="purple"><B>'; $EG='</B></SPAN>';}
# if ($call_time_M_int >= 10) {$G='<SPAN class="purple"><B>'; $EG='</B></SPAN>';}
}
if (eregi("PAUSED",$row[3]))
{
if ($call_time_M_int >= 30)
{$i++; continue;}
else
{
$agent_paused++; $agent_total++;
$G=''; $EG='';
if ($call_time_S >= 10) {$G='<SPAN class="khaki"><B>'; $EG='</B></SPAN>';}
if ($call_time_M_int >= 1) {$G='<SPAN class="yellow"><B>'; $EG='</B></SPAN>';}
if ($call_time_M_int >= 5) {$G='<SPAN class="olive"><B>'; $EG='</B></SPAN>';}
}
}
# if ( (strlen($row[7])> 4) and ($row[7] != "$row[4]") )
# {$G='<SPAN class="orange"><B>'; $EG='</B></SPAN>';}
if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;}
if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;}
if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) )
{
$G='<SPAN class="lightblue"><B>'; $EG='</B></SPAN>';
if ($call_time_M_int >= 1) {$G='<SPAN class="blue"><B>'; $EG='</B></SPAN>';}
if ($call_time_M_int >= 5) {$G='<SPAN class="midnightblue"><B>'; $EG='</B></SPAN>';}
}
$L='';
$R='';
$LL='';
$EXTF='6';
$servip= str_replace('.','',$Lserver_ip);
if ($SIPmonitorLINK>0) {$L=" <a href=\"sip:6$Lsessionid@$server_ip\">LISTEN</a>"; $R='';}
if ($IAXmonitorLINK>0) {$L=" <a href=\"tel:$servip$EXTF$Lsessionid\">LISTEN</a>"; $R='';}
if ($SIPmonitorLINK>1) {$R=" | <a href=\"sip:$Lsessionid@$server_ip\">BARGE</a>";}
if ($IAXmonitorLINK>1) {$R=" | <a href=\"tel:$servip$Lsessionid\">BARGE</a>";}
if ($RECmonitorLINK>0)
{
$stmt="select session_name from web_client_sessions where server_ip ='$server_ip' and extension ='$extension' limit 1;";
if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");}
$rslta=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$sess = mysql_num_rows($rslta);
if ($sess > 0)
{
$row=mysql_fetch_row($rslta);
$sessionname = $row[0];
} else
{
$sessionname = "";
}
$stmt="select end_time,channel,extension,lead_id,user,server_ip,filename from recording_log where server_ip ='$server_ip' and user ='$Luser';";
if ($non_latin > 0) {$rslta=mysql_query("SET NAMES 'UTF8'");}
$rslta=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$rec_channels = mysql_num_rows($rslta);
if ($rec_channels > 0)
{
$ii=0;
while ($ii < $rec_channels)
{
$row=mysql_fetch_row($rslta);
$pos=strpos($row[1], $Lsessionid);
if ($pos===false)
{
$LL=" <a href=\"#\" onclick=\"conf_send_recording('MonitorConf','$sessionname', '$Lsessionid','' ,$lead_id,'$Luser','$campaign_id','$Lserver_ip','$user_pass');return false;\">Rec </a>";
}
else
{
if(is_null($row[0])) {
$LL=" <a href=\"#\" onclick=\"conf_send_recording('StopMonitorConf','$sessionname', '$Lsessionid', '$row[6]', $lead_id,'$Luser','$campaign_id','$Lserver_ip','$user_pass');return false;\">Stop</a>";
}
else
{
$LL=" <a href=\"#\" onclick=\"conf_send_recording('MonitorConf','$sessionname', '$Lsessionid','' ,$lead_id,'$Luser','$campaign_id','$Lserver_ip','$user_pass');return false;\">Rec </a>";
}
}
$ii++;
}
}
else
{
$LL=" <a href=\"#\" onclick=\"conf_send_recording('MonitorConf','$sessionname','$Lsessionid', '' , $lead_id,'$Luser','$campaign_id','$Lserver_ip','$user_pass');return false;\">Rec </a>";
}
}
if ($UGdisplay > 0) {$UGD = " $G$user_group$EG |";}
else {$UGD = "";}
if ($SERVdisplay > 0) {$SVD = "$G$server_ip$EG | $G$call_server_ip$EG | ";}
else {$SVD = "";}
$agentcount++;
$Aecho .= "| $G$extension$EG | <a href=\"./user_status.php?user=$Luser\" target=\"_blank\">$G$user$EG</a> |$UGD $G$sessionid$EG$L$R | $G$status$EG $CM | $LL | $SVD$G$call_time_MS$EG | $G$campaign_id$EG |\n";
$i++;
}
$Aecho .= "$Aline";
$Aecho .= " $agentcount agents logged in on all servers\n";
$Aecho .= " System Load Average: $load_ave\n\n";
# $Aecho .= " <SPAN class=\"orange\"><B> </SPAN> - Balanced call</B>\n";
$Aecho .= " <SPAN class=\"lightblue\"><B> </SPAN> - Agent waiting for call</B>\n";
$Aecho .= " <SPAN class=\"blue\"><B> </SPAN> - Agent waiting for call > 1 minute</B>\n";
$Aecho .= " <SPAN class=\"midnightblue\"><B> </SPAN> - Agent waiting for call > 5 minutes</B>\n";
$Aecho .= " <SPAN class=\"thistle\"><B> </SPAN> - Agent on call > 10 seconds</B>\n";
$Aecho .= " <SPAN class=\"violet\"><B> </SPAN> - Agent on call > 1 minute</B>\n";
$Aecho .= " <SPAN class=\"purple\"><B> </SPAN> - Agent on call > 5 minutes</B>\n";
$Aecho .= " <SPAN class=\"khaki\"><B> </SPAN> - Agent Paused > 10 seconds</B>\n";
$Aecho .= " <SPAN class=\"yellow\"><B> </SPAN> - Agent Paused > 1 minute</B>\n";
$Aecho .= " <SPAN class=\"olive\"><B> </SPAN> - Agent Paused > 5 minutes</B>\n";
if ($agent_ready > 0) {$B='<FONT class="b1">'; $BG='</FONT>';}
if ($agent_ready > 4) {$B='<FONT class="b2">'; $BG='</FONT>';}
if ($agent_ready > 9) {$B='<FONT class="b3">'; $BG='</FONT>';}
if ($agent_ready > 14) {$B='<FONT class="b4">'; $BG='</FONT>';}
echo "\n<BR>\n";
echo "$NFB$agent_total$NFE agents logged in &nbsp; &nbsp; &nbsp; &nbsp; \n";
echo "$NFB$agent_incall$NFE agents in calls &nbsp; &nbsp; &nbsp; \n";
echo "$NFB$B &nbsp;$agent_ready $BG$NFE agents waiting &nbsp; &nbsp; &nbsp; \n";
echo "$NFB$agent_paused$NFE paused agents &nbsp; &nbsp; &nbsp; \n";
echo "<PRE><FONT SIZE=2>";
echo "";
echo "$Aecho";
}
else
{
echo " NO AGENTS ON CALLS \n";
}
?>
</PRE>
</BODY></HTML>
@@ -1,442 +0,0 @@
<?
# AST_timeonVDADallSUMMARY.php
#
# Copyright (C) 2007 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
# Summary for all campaigns live real-time stats for the VICIDIAL Auto-Dialer all servers
#
# STOP=4000, SLOW=40, GO=4 seconds refresh interval
#
# changes:
# 61102-1616 - first build
# 61215-1131 - added answered calls and drop percent taken from answered calls
# 70111-1600 - added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns
# 70619-1339 - Added Status Category tally display
# 71029-1900 - Changed CLOSER-type to not require campaign_id restriction
#
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["RR"])) {$RR=$_GET["RR"];}
elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];}
elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];}
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"];}
if (!isset($RR)) {$gRRroup=4;}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
$stmt="select campaign_id from vicidial_campaigns where active='Y';";
$rslt=mysql_query($stmt, $link);
if (!isset($DB)) {$DB=0;}
if ($DB) {echo "$stmt\n";}
$groups_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $groups_to_print)
{
$row=mysql_fetch_row($rslt);
$groups[$i] =$row[0];
$i++;
}
if (!isset($RR)) {$RR=4;}
?>
<HTML>
<HEAD>
<STYLE type="text/css">
<!--
.green {color: white; background-color: green}
.red {color: white; background-color: red}
.lightblue {color: black; background-color: #ADD8E6}
.blue {color: white; background-color: blue}
.midnightblue {color: white; background-color: #191970}
.purple {color: white; background-color: purple}
.violet {color: black; background-color: #EE82EE}
.thistle {color: black; background-color: #D8BFD8}
.olive {color: white; background-color: #808000}
.yellow {color: black; background-color: yellow}
.khaki {color: black; background-color: #F0E68C}
.orange {color: black; background-color: orange}
.r1 {color: black; background-color: #FFCCCC}
.r2 {color: black; background-color: #FF9999}
.r3 {color: black; background-color: #FF6666}
.r4 {color: white; background-color: #FF0000}
.b1 {color: black; background-color: #CCCCFF}
.b2 {color: black; background-color: #9999FF}
.b3 {color: black; background-color: #6666FF}
.b4 {color: white; background-color: #0000FF}
-->
</STYLE>
<?
echo"<META HTTP-EQUIV=Refresh CONTENT=\"$RR; URL=$PHP_SELF?RR=$RR&DB=$DB&adastats=$adastats\">\n";
echo "<TITLE>VICIDIAL: Realtime All Campaigns Summary</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
echo "<b>VICIDIAL: Realtime All Campaigns Summary</b> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \n";
echo "<a href=\"$PHP_SELF?group=$group&RR=4000&DB=$DB&adastats=$adastats\">STOP</a> | ";
echo "<a href=\"$PHP_SELF?group=$group&RR=40&DB=$DB&adastats=$adastats\">SLOW</a> | ";
echo "<a href=\"$PHP_SELF?group=$group&RR=4&DB=$DB&adastats=$adastats\">GO</a> ";
echo " &nbsp; &nbsp; &nbsp; </FONT>\n";
if ($adastats<2)
{
echo "<a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=2\"><font size=1>+ VIEW MORE SETTINGS</font></a>";
}
else
{
echo "<a href=\"$PHP_SELF?group=$group&RR=$RR&DB=$DB&adastats=1\"><font size=1>- VIEW LESS SETTINGS</font></a>";
}
echo " &nbsp; &nbsp; &nbsp; <a href=\"./admin.php?ADD=999999\">REPORTS</a>";
echo "<BR><BR>\n\n";
$k=0;
while($k<$groups_to_print)
{
$NFB = '<b><font size=3 face="courier">';
$NFE = '</font></b>';
$F=''; $FG=''; $B=''; $BG='';
$group = $groups[$k];
echo "<b><a href=\"./AST_timeonVDADall.php?group=$group&RR=$RR&DB=$DB&adastats=$adastats\">$group</a></b> &nbsp; - &nbsp; ";
echo "<a href=\"./admin.php?ADD=34&campaign_id=$group\">Modify</a>\n";
$stmt = "select count(*) from vicidial_campaigns where campaign_id='$group' and campaign_allow_inbound='Y';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$campaign_allow_inbound = $row[0];
$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$DIALlev = $row[0];
$DIALstatusA = $row[1];
$DIALstatusB = $row[2];
$DIALstatusC = $row[3];
$DIALstatusD = $row[4];
$DIALstatusE = $row[5];
$DIALorder = $row[6];
$DIALfilter = $row[7];
$HOPlev = $row[8];
$DIALmethod = $row[9];
$maxDIALlev = $row[10];
$DROPmax = $row[11];
$targetDIFF = $row[12];
$ADAintense = $row[13];
$ADAavailonly = $row[14];
$TAPERtime = $row[15];
$CALLtime = $row[16];
$DIALtimeout = $row[17];
$DIALstatuses = $row[18];
$DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses));
$DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses));
$stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$VDhop = $row[0];
$stmt="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$DAleads = $row[0];
$callsTODAY = $row[1];
$dropsTODAY = $row[2];
$drpctTODAY = $row[3];
$diffONEMIN = $row[4];
$agentsONEMIN = $row[5];
$balanceFILL = $row[6];
$answersTODAY = $row[7];
$VSCcat1 = $row[8];
$VSCcat1tally = $row[9];
$VSCcat2 = $row[10];
$VSCcat2tally = $row[11];
$VSCcat3 = $row[12];
$VSCcat3tally = $row[13];
$VSCcat4 = $row[14];
$VSCcat4tally = $row[15];
if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) )
{
$diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100);
$diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN);
}
else {$diffpctONEMIN = '0.00';}
$stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$balanceSHORT = $row[0];
echo "<BR><table cellpadding=0 cellspacing=0><TR>";
echo "<TD ALIGN=RIGHT><font size=2><B>DIAL LEVEL:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALlev&nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>TRUNK SHORT/FILL:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $balanceSHORT / $balanceFILL &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>FILTER:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALfilter &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B> TIME:</B> &nbsp; </TD><TD ALIGN=LEFT><font size=2> $NOW_TIME </TD>";
echo "";
echo "</TR>";
if ($adastats>1)
{
echo "<TR BGCOLOR=\"#CCCCCC\">";
echo "<TD ALIGN=RIGHT><font size=2>&nbsp; <B>MAX LEVEL:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $maxDIALlev &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DROPPED MAX:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DROPmax% &nbsp; &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>TARGET DIFF:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $targetDIFF &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>INTENSITY:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $ADAintense &nbsp; &nbsp; </TD>";
echo "</TR>";
echo "<TR BGCOLOR=\"#CCCCCC\">";
echo "<TD ALIGN=RIGHT><font size=2><B>DIAL TIMEOUT:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALtimeout &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>TAPER TIME:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $TAPERtime &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>LOCAL TIME:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $CALLtime &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>AVAIL ONLY:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $ADAavailonly &nbsp;</TD>";
echo "</TR>";
}
echo "<TR>";
echo "<TD ALIGN=RIGHT><font size=2><B>DIALABLE LEADS:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DAleads &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>CALLS TODAY:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $callsTODAY &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>AVG AGENTS:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $agentsONEMIN &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DIAL METHOD:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALmethod &nbsp; &nbsp; </TD>";
echo "</TR>";
echo "<TR>";
echo "<TD ALIGN=RIGHT><font size=2><B>HOPPER LEVEL:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $HOPlev &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DROPPED / ANSWERED:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $dropsTODAY / $answersTODAY &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DL DIFF:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $diffONEMIN &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>STATUSES:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALstatuses &nbsp; &nbsp; </TD>";
echo "</TR>";
echo "<TR>";
echo "<TD ALIGN=RIGHT><font size=2><B>LEADS IN HOPPER:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $VDhop &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DROPPED PERCENT:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; ";
if ($drpctTODAY >= $DROPmax)
{echo "<font color=red><B>$drpctTODAY%</B></font>";}
else
{echo "$drpctTODAY%";}
echo " &nbsp; &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DIFF:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $diffpctONEMIN% &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>ORDER:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALorder &nbsp; &nbsp; </TD>";
echo "</TR>";
echo "<TR>";
echo "<TD ALIGN=LEFT COLSPAN=8>";
if ( (!eregi('NULL',$VSCcat1)) and (strlen($VSCcat1)>0) )
{echo "<font size=2><B>$VSCcat1:</B> &nbsp; $VSCcat1tally &nbsp; &nbsp; &nbsp; \n";}
if ( (!eregi('NULL',$VSCcat2)) and (strlen($VSCcat2)>0) )
{echo "<font size=2><B>$VSCcat2:</B> &nbsp; $VSCcat2tally &nbsp; &nbsp; &nbsp; \n";}
if ( (!eregi('NULL',$VSCcat3)) and (strlen($VSCcat3)>0) )
{echo "<font size=2><B>$VSCcat3:</B> &nbsp; $VSCcat3tally &nbsp; &nbsp; &nbsp; \n";}
if ( (!eregi('NULL',$VSCcat4)) and (strlen($VSCcat4)>0) )
{echo "<font size=2><B>$VSCcat4:</B> &nbsp; $VSCcat4tally &nbsp; &nbsp; &nbsp; \n";}
echo "</TD></TR>";
echo "<TR>";
echo "<TD ALIGN=LEFT COLSPAN=8>";
### Header finish
################################################################################
### START calculating calls/agents
################################################################################
################################################################################
###### OUTBOUND CALLS
################################################################################
if ($campaign_allow_inbound > 0)
{
$stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$closer_campaigns = preg_replace("/^ | -$/","",$row[0]);
$closer_campaigns = preg_replace("/ /","','",$closer_campaigns);
$closer_campaigns = "'$closer_campaigns'";
$stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type='OUT') );";
}
else
{
if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';}
else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";}
$stmt="select status from vicidial_auto_calls where status NOT IN('XFER') $groupSQL;";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$parked_to_print = mysql_num_rows($rslt);
if ($parked_to_print > 0)
{
$i=0;
$out_total=0;
$out_ring=0;
$out_live=0;
while ($i < $parked_to_print)
{
$row=mysql_fetch_row($rslt);
if (eregi("LIVE",$row[0]))
{$out_live++;}
else
{
if (eregi("CLOSER",$row[0]))
{$nothing=1;}
else
{$out_ring++;}
}
$out_total++;
$i++;
}
if ($out_live > 0) {$F='<FONT class="r1">'; $FG='</FONT>';}
if ($out_live > 4) {$F='<FONT class="r2">'; $FG='</FONT>';}
if ($out_live > 9) {$F='<FONT class="r3">'; $FG='</FONT>';}
if ($out_live > 14) {$F='<FONT class="r4">'; $FG='</FONT>';}
if ($campaign_allow_inbound > 0)
{echo "$NFB$out_total$NFE current active calls&nbsp; &nbsp; &nbsp; \n";}
else
{echo "$NFB$out_total$NFE calls being placed &nbsp; &nbsp; &nbsp; \n";}
echo "$NFB$out_ring$NFE calls ringing &nbsp; &nbsp; &nbsp; &nbsp; \n";
echo "$NFB$F &nbsp;$out_live $FG$NFE calls waiting for agents &nbsp; &nbsp; &nbsp; \n";
}
else
{
echo " NO LIVE CALLS WAITING \n";
}
###################################################################################
###### TIME ON SYSTEM
###################################################################################
$agent_incall=0;
$agent_ready=0;
$agent_paused=0;
$agent_total=0;
$stmt="select extension,user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id from vicidial_live_agents where campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$talking_to_print = mysql_num_rows($rslt);
if ($talking_to_print > 0)
{
$i=0;
$agentcount=0;
while ($i < $talking_to_print)
{
$row=mysql_fetch_row($rslt);
if (eregi("READY|PAUSED",$row[3]))
{
$row[5]=$row[6];
}
$Lstatus = $row[3];
$status = sprintf("%-6s", $row[3]);
if (!eregi("INCALL|QUEUE",$row[3]))
{$call_time_S = ($STARTtime - $row[6]);}
else
{$call_time_S = ($STARTtime - $row[5]);}
$call_time_M = ($call_time_S / 60);
$call_time_M = round($call_time_M, 2);
$call_time_M_int = intval("$call_time_M");
$call_time_SEC = ($call_time_M - $call_time_M_int);
$call_time_SEC = ($call_time_SEC * 60);
$call_time_SEC = round($call_time_SEC, 0);
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
$call_time_MS = "$call_time_M_int:$call_time_SEC";
$call_time_MS = sprintf("%7s", $call_time_MS);
$G = ''; $EG = '';
if (eregi("PAUSED",$row[3]))
{
if ($call_time_M_int >= 30)
{$i++; continue;}
else
{
$agent_paused++; $agent_total++;
}
}
if ( (eregi("INCALL",$status)) or (eregi("QUEUE",$status)) ) {$agent_incall++; $agent_total++;}
if ( (eregi("READY",$status)) or (eregi("CLOSER",$status)) ) {$agent_ready++; $agent_total++;}
$agentcount++;
$i++;
}
if ($agent_ready > 0) {$B='<FONT class="b1">'; $BG='</FONT>';}
if ($agent_ready > 4) {$B='<FONT class="b2">'; $BG='</FONT>';}
if ($agent_ready > 9) {$B='<FONT class="b3">'; $BG='</FONT>';}
if ($agent_ready > 14) {$B='<FONT class="b4">'; $BG='</FONT>';}
echo "\n<BR>\n";
echo "$NFB$agent_total$NFE agents logged in &nbsp; &nbsp; &nbsp; &nbsp; \n";
echo "$NFB$agent_incall$NFE agents in calls &nbsp; &nbsp; &nbsp; \n";
echo "$NFB$B &nbsp;$agent_ready $BG$NFE agents waiting &nbsp; &nbsp; &nbsp; \n";
echo "$NFB$agent_paused$NFE paused agents &nbsp; &nbsp; &nbsp; \n";
echo "<PRE><FONT SIZE=2>";
echo "";
}
else
{
echo " NO AGENTS ON CALLS<BR>\n";
}
################################################################################
### END calculating calls/agents
################################################################################
echo "</TD>";
echo "</TR>";
echo "</TABLE>";
echo "</FORM>\n\n";
$k++;
}
?>
</PRE>
</BODY></HTML>
-180
View File
@@ -1,180 +0,0 @@
<?
### AST_timeoncall.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
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["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];}
elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];}
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"];}
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
?>
<HTML>
<HEAD>
<STYLE type="text/css">
<!--
.green {color: white; background-color: green}
.red {color: white; background-color: red}
-->
</STYLE>
<?
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo"<META HTTP-EQUIV=Refresh CONTENT=\"15; URL=$PHP_SELF?server_ip=$server_ip&DB=$DB\">\n";
echo "<TITLE>VICIDIAL: Time On Call</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
echo "<PRE>\n\n";
echo "VICIDIAL: Time On Call $NOW_TIME\n\n";
echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
echo "| STATION | SESSIONID | CHANNEL | NUMBER DIALED | START TIME | MINUTES |\n";
echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
$stmt="SELECT count(*) from live_sip_channels where server_ip='$server_ip';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$parked_count = $row[0];
if ($parked_count > 0)
{
$stmt="select extension from live_channels where server_ip='$server_ip';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$ext_to_print = mysql_num_rows($rslt);
$i=0;
$live_zap_counter=0;
$sessions = '';
while ($i < $ext_to_print)
{
$row=mysql_fetch_row($rslt);
if (preg_match("/^8600/i",$row[0]))
{
$sessions .= "$row[0]|";
}
$i++;
}
$sessions = preg_replace("/\|$/",'',$sessions);
if ($DB) {echo "SESSIONS: -$sessions-\n";}
$stmt="select * from live_sip_channels where server_ip='$server_ip' order by channel;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$parked_to_print = mysql_num_rows($rslt);
$i=0;
$live_calls_counter=0;
while ($i < $parked_to_print)
{
$row=mysql_fetch_row($rslt);
if ( (preg_match("/Zap\/|internal|ring/i",$row[3])) or (preg_match("/Local\//i",$row[0])) )
{
if ($DB) {echo "NOT STATION |$row[0]|$row[3]|\n";}
$session_id = '';
}
else
{
if (preg_match("/$row[3]/i",$sessions))
{
if ($DB) {echo "LIVE STATION|$row[0]|$row[3]|\n";}
$session_id = $row[3];
$station = preg_replace("/SIP\//",'',$row[0]);
$station = preg_replace("/-.*/",'',$station);
$LIVE_sessions[$live_calls_counter] = "$session_id";
$LIVE_sessions_FORMAT[$live_calls_counter] = sprintf("%-9s", $session_id);
$LIVE_stations[$live_calls_counter] = "$station";
$LIVE_stations_FORMAT[$live_calls_counter] = sprintf("%-10s", $station);
# echo "| $station | $session_id | \n";
$live_calls_counter++;
}
else
{
if ($DB) {echo "NOT STATIONZ|$row[0]|$row[3]|\n";}
$session_id = '';
}
}
$i++;
}
if ($live_calls_counter > 0)
{
$i=0;
$LC_counter = $live_calls_counter;
while ($i < $live_calls_counter)
{
$stmt="select channel,extension,number_dialed,start_time,start_epoch from call_log where extension='$LIVE_stations[$i]' and server_ip='$server_ip' order by uniqueid desc LIMIT 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$parked_to_print = mysql_num_rows($rslt);
$row=mysql_fetch_row($rslt);
$channel = sprintf("%-9s", $row[0]);
$number_dialed = sprintf("%-16s", $row[2]);
$start_time = sprintf("%-19s", $row[3]);
$call_time_S = ($STARTtime - $row[4]);
$call_time_M = ($call_time_S / 60);
$call_time_M = round($call_time_M, 2);
$call_time_M_int = intval("$call_time_M");
$call_time_SEC = ($call_time_M - $call_time_M_int);
$call_time_SEC = ($call_time_SEC * 60);
$call_time_SEC = round($call_time_SEC, 0);
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
$call_time_MS = "$call_time_M_int:$call_time_SEC";
$call_time_MS = sprintf("%7s", $call_time_MS);
$G = ''; $EG = '';
if ($call_time_M_int >= 12) {$G='<SPAN class="green"><B>'; $EG='</B></SPAN>';}
if ($call_time_M_int >= 31) {$G='<SPAN class="red"><B>'; $EG='</B></SPAN>';}
echo "| $G$LIVE_stations_FORMAT[$i]$EG | $G$LIVE_sessions_FORMAT[$i]$EG | $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
$i++;
}
echo "+------------+-----------+-----------+------------------+---------------------+---------+\n";
echo " $i stations on live calls on server $server_ip\n\n";
echo " <SPAN class=\"green\"><B> </SPAN> - 12 minutes or more on live call\n";
echo " <SPAN class=\"red\"><B> </SPAN> - Over 30 minutes on live call\n";
}
else
{
echo "*****************************************************************************************\n";
echo "*****************************************************************************************\n";
echo "*************************************** NO LIVE STATIONS ********************************\n";
echo "*****************************************************************************************\n";
echo "*****************************************************************************************\n";
}
}
else
{
echo "*****************************************************************************************\n";
echo "*****************************************************************************************\n";
echo "*************************************** NO LIVE STATIONS ********************************\n";
echo "*****************************************************************************************\n";
echo "*****************************************************************************************\n";
}
?>
</PRE>
</BODY></HTML>
-219
View File
@@ -1,219 +0,0 @@
<?
### AST_timeonpark.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
# CHANGES
#
# 60620-1042 - Added variable filtering to eliminate SQL injection attack threat
# - Added required user/pass to gain access to this page
#
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["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["reset_counter"])) {$reset_counter=$_GET["reset_counter"];}
elseif (isset($_POST["reset_counter"])) {$reset_counter=$_POST["reset_counter"];}
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);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
$timeONEhoursAGO = ($STARTtime - 3600);
$epochHALFhoursAGO = ($STARTtime - 1860);
$timeONEhoursAGO = date("Y-m-d H:i:s",$timeONEhoursAGO);
$timeHALFhoursAGO = date("Y-m-d H:i:s",$epochHALFhoursAGO);
$reset_counter++;
if ($reset_counter > 7)
{
$reset_counter=0;
$stmt="update park_log set status='HUNGUP' where hangup_time is not null;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
if ($DB)
{
$stmt="delete from park_log where status='TALKING' and grab_time < '$timeONEhoursAGO' and (hangup_time is null or hangup_time='');";
$rslt=mysql_query($stmt, $link);
echo "$stmt\n";
$stmt="delete from park_log where status='PARKED' and parked_time < '$timeHALFhoursAGO' and (hangup_time is null or hangup_time='');";
$rslt=mysql_query($stmt, $link);
echo "$stmt\n";
}
}
?>
<HTML>
<HEAD>
<STYLE type="text/css">
<!--
.green {color: white; background-color: green}
.red {color: white; background-color: red}
.blue {color: white; background-color: blue}
.purple {color: white; background-color: purple}
-->
</STYLE>
<?
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo"<META HTTP-EQUIV=Refresh CONTENT=\"7; URL=$PHP_SELF?server_ip=$server_ip&DB=$DB&reset_counter=$reset_counter\">\n";
echo "<TITLE>VICIDIAL: Time On Park</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
echo "<PRE><FONT SIZE=3>\n\n";
echo "VICIDIAL: Time On Park $NOW_TIME <a href=\"./admin.php?ADD=999999\">REPORTS</a>\n\n";
echo "+------------+-----------------+---------------------+---------+\n";
echo "| CHANNEL | GROUP | START TIME | MINUTES |\n";
echo "+------------+-----------------+---------------------+---------+\n";
#$link=mysql_connect("localhost", "cron", "1234");
# $linkX=mysql_connect("localhost", "cron", "1234");
#mysql_select_db("asterisk");
$stmt="select extension,user,channel,channel_group,parked_time,UNIX_TIMESTAMP(parked_time) from park_log where status ='PARKED' and server_ip='" . mysql_real_escape_string($server_ip) . "' order by uniqueid;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$parked_to_print = mysql_num_rows($rslt);
if ($parked_to_print > 0)
{
$i=0;
while ($i < $parked_to_print)
{
$row=mysql_fetch_row($rslt);
$channel = sprintf("%-10s", $row[2]);
$number_dialed = sprintf("%-15s", $row[3]);
$start_time = sprintf("%-19s", $row[4]);
$call_time_S = ($STARTtime - $row[5]);
$call_time_M = ($call_time_S / 60);
$call_time_M = round($call_time_M, 2);
$call_time_M_int = intval("$call_time_M");
$call_time_SEC = ($call_time_M - $call_time_M_int);
$call_time_SEC = ($call_time_SEC * 60);
$call_time_SEC = round($call_time_SEC, 0);
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
$call_time_MS = "$call_time_M_int:$call_time_SEC";
$call_time_MS = sprintf("%7s", $call_time_MS);
$G = ''; $EG = '';
if ($call_time_M_int >= 1) {$G='<SPAN class="green"><B>'; $EG='</B></SPAN>';}
if ($call_time_M_int >= 6) {$G='<SPAN class="red"><B>'; $EG='</B></SPAN>';}
echo "| $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
$i++;
}
echo "+------------+-----------------+---------------------+---------+\n";
echo " $i callers waiting on server $server_ip\n\n";
echo " <SPAN class=\"green\"><B> </SPAN> - 1 minute or more on hold</B>\n";
echo " <SPAN class=\"red\"><B> </SPAN> - Over 5 minutes on hold</B>\n";
}
else
{
echo "****************************************************************\n";
echo "****************************************************************\n";
echo "******************** NO LIVE CALLS WAITING *********************\n";
echo "****************************************************************\n";
echo "****************************************************************\n";
}
###################################################################################
###### TIME ON INBOUND CALLS
###################################################################################
echo "\n\n";
echo "----------------------------------------------------------------------------------------";
echo "\n\n";
echo "VICIDIAL: Agents Time On Inbound Calls $NOW_TIME\n\n";
echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
echo "| STATION | USER | CHANNEL | GROUP | START TIME | MINUTES |\n";
echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
$stmt="select extension,user,channel,channel_group,grab_time,UNIX_TIMESTAMP(grab_time) from park_log where status ='TALKING' and server_ip='" . mysql_real_escape_string($server_ip) . "' order by uniqueid;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$talking_to_print = mysql_num_rows($rslt);
if ($talking_to_print > 0)
{
$i=0;
while ($i < $talking_to_print)
{
$row=mysql_fetch_row($rslt);
$extension = sprintf("%-10s", $row[0]);
$user = sprintf("%-6s", $row[1]);
$channel = sprintf("%-10s", $row[2]);
$number_dialed = sprintf("%-15s", $row[3]);
$start_time = sprintf("%-19s", $row[4]);
$call_time_S = ($STARTtime - $row[5]);
$call_time_M = ($call_time_S / 60);
$call_time_M = round($call_time_M, 2);
$call_time_M_int = intval("$call_time_M");
$call_time_SEC = ($call_time_M - $call_time_M_int);
$call_time_SEC = ($call_time_SEC * 60);
$call_time_SEC = round($call_time_SEC, 0);
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
$call_time_MS = "$call_time_M_int:$call_time_SEC";
$call_time_MS = sprintf("%7s", $call_time_MS);
$G = ''; $EG = '';
if ($call_time_M_int >= 12) {$G='<SPAN class="blue"><B>'; $EG='</B></SPAN>';}
if ($call_time_M_int >= 31) {$G='<SPAN class="purple"><B>'; $EG='</B></SPAN>';}
echo "| $G$extension$EG | $G$user$EG | $G$channel$EG | $G$number_dialed$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
$i++;
}
echo "+------------|--------+------------+-----------------+---------------------+---------+\n";
echo " $i agents on calls on server $server_ip\n\n";
echo " <SPAN class=\"blue\"><B> </SPAN> - 12 minutes or more on call</B>\n";
echo " <SPAN class=\"purple\"><B> </SPAN> - Over 30 minutes on call</B>\n";
}
else
{
echo "**************************************************************************************\n";
echo "**************************************************************************************\n";
echo "********************************* NO AGENTS ON CALLS *********************************\n";
echo "**************************************************************************************\n";
echo "**************************************************************************************\n";
}
?>
</PRE>
</BODY></HTML>
File diff suppressed because it is too large Load Diff
-610
View File
@@ -1,610 +0,0 @@
<?
# admin_modify_lead.php
#
# Copyright (C) 2007 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
# CHANGES
#
# 70702-1259 - Added recording location link and truncation
# 70906-2132 - Added closer_log records display
#
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["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];}
elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];}
if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];}
elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];}
if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];}
elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];}
elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];}
if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];}
elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];}
if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];}
elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];}
if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["extension"])) {$extension=$_GET["extension"];}
elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];}
if (isset($_GET["channel"])) {$channel=$_GET["channel"];}
elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];}
if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];}
elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];}
if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];}
elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];}
if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];}
elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];}
if (isset($_GET["address1"])) {$address1=$_GET["address1"];}
elseif (isset($_POST["address1"])) {$address1=$_POST["address1"];}
if (isset($_GET["address2"])) {$address2=$_GET["address2"];}
elseif (isset($_POST["address2"])) {$address2=$_POST["address2"];}
if (isset($_GET["address3"])) {$address3=$_GET["address3"];}
elseif (isset($_POST["address3"])) {$address3=$_POST["address3"];}
if (isset($_GET["city"])) {$city=$_GET["city"];}
elseif (isset($_POST["city"])) {$city=$_POST["city"];}
if (isset($_GET["state"])) {$state=$_GET["state"];}
elseif (isset($_POST["state"])) {$state=$_POST["state"];}
if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];}
elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];}
if (isset($_GET["province"])) {$province=$_GET["province"];}
elseif (isset($_POST["province"])) {$province=$_POST["province"];}
if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];}
elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];}
if (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];}
elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];}
if (isset($_GET["email"])) {$email=$_GET["email"];}
elseif (isset($_POST["email"])) {$email=$_POST["email"];}
if (isset($_GET["security"])) {$security=$_GET["security"];}
elseif (isset($_POST["security"])) {$security=$_POST["security"];}
if (isset($_GET["comments"])) {$comments=$_GET["comments"];}
elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];}
if (isset($_GET["status"])) {$status=$_GET["status"];}
elseif (isset($_POST["status"])) {$status=$_POST["status"];}
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"];}
if (isset($_GET["CBchangeUSERtoANY"])) {$CBchangeUSERtoANY=$_GET["CBchangeUSERtoANY"];}
elseif (isset($_POST["CBchangeUSERtoANY"])) {$CBchangeUSERtoANY=$_POST["CBchangeUSERtoANY"];}
if (isset($_GET["CBchangeUSERtoUSER"])) {$CBchangeUSERtoUSER=$_GET["CBchangeUSERtoUSER"];}
elseif (isset($_POST["CBchangeUSERtoUSER"])) {$CBchangeUSERtoUSER=$_POST["CBchangeUSERtoUSER"];}
if (isset($_GET["CBchangeANYtoUSER"])) {$CBchangeANYtoUSER=$_GET["CBchangeANYtoUSER"];}
elseif (isset($_POST["CBchangeANYtoUSER"])) {$CBchangeANYtoUSER=$_POST["CBchangeANYtoUSER"];}
if (isset($_GET["callback_id"])) {$callback_id=$_GET["callback_id"];}
elseif (isset($_POST["callback_id"])) {$callback_id=$_POST["callback_id"];}
if (isset($_GET["CBuser"])) {$CBuser=$_GET["CBuser"];}
elseif (isset($_POST["CBuser"])) {$CBuser=$_POST["CBuser"];}
if (isset($_GET["modify_logs"])) {$modify_logs=$_GET["modify_logs"];}
elseif (isset($_POST["modify_logs"])) {$modify_logs=$_POST["modify_logs"];}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
### AST GUI database administration modify lead in vicidial_list
### admin_modify_lead.php
# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead
# CHANGES
#
# 60419-1705 - Added ability to change lead callback record from USERONLY to ANYONE or USERONLY-user
# 60421-1459 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60609-1112 - Added DNC list addition if status changed to DNC
# 60619-1539 - Added variable filtering to eliminate SQL injection attack threat
# 61130-1639 - Added recording_log lookup and list for this lead_id
# 61201-1136 - Added recording_log user(TSR) display and link
# 70305-1133 - Changed to default CHECKED modify logs upon status change
# 70424-1128 - Added campaign-specific statuses, reformatted recordings list
#
$STARTtime = date("U");
$TODAY = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_leads='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if ($WeBRooTWritablE > 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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
else
{
if($auth>0)
{
$stmt="SELECT full_name,modify_leads 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];
$LOGmodify_leads =$row[1];
if ($WeBRooTWritablE > 0)
{
fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n");
fclose($fp);
}
}
else
{
if ($WeBRooTWritablE > 0)
{
fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n");
fclose($fp);
}
}
}
?>
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<title>VICIDIAL ADMIN: Lead record modification</title>
</head>
<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
<CENTER><FONT FACE="Courier" COLOR=BLACK SIZE=3>
<?
echo "<a href=\"./admin.php?ADD=100\">VICIDIAL ADMIN</a>: Lead record modification<BR>\n";
if ($end_call > 0)
{
$call_length = ($STARTtime - $call_began);
### insert a NEW record to the vicidial_closer_log table
$stmt="INSERT INTO vicidial_closer_log (lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed) values('" . mysql_real_escape_string($lead_id) . "','" . mysql_real_escape_string($list_id) . "','" . mysql_real_escape_string($campaign_id) . "','" . mysql_real_escape_string($parked_time) . "','" . mysql_real_escape_string($call_began) . "','$STARTtime','" . mysql_real_escape_string($call_length) . "','" . mysql_real_escape_string($status) . "','" . mysql_real_escape_string($phone_code) . "','" . mysql_real_escape_string($phone_number) . "','$PHP_AUTH_USER','" . mysql_real_escape_string($comments) . "','Y')";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
### update the lead record in the vicidial_list table
$stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',first_name='" . mysql_real_escape_string($first_name) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "'";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
echo "information modified<BR><BR>\n";
echo "<form><input type=button value=\"Close This Window\" onClick=\"javascript:window.close();\"></form>\n";
if ( ($dispo != $status) and ($dispo == 'CBHOLD') )
{
### inactivate vicidial_callbacks record for this lead
$stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='" . mysql_real_escape_string($lead_id) . "' and status='ACTIVE';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
echo "<BR>vicidial_callback record inactivated: $lead_id<BR>\n";
}
if ( ($dispo != $status) and ($dispo == 'CALLBK') )
{
### inactivate vicidial_callbacks record for this lead
$stmt="UPDATE vicidial_callbacks set status='INACTIVE' where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE');";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
echo "<BR>vicidial_callback record inactivated: $lead_id<BR>\n";
}
if ( ($dispo != $status) and ($status == 'DNC') )
{
### add lead to the internal DNC list
$stmt="INSERT INTO vicidial_dnc (phone_number) values('" . mysql_real_escape_string($phone_number) . "');";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
echo "<BR>Lead added to DNC List: $lead_id - $phone_number<BR>\n";
}
### update last record in vicidial_agent_log and vicidial_log tables
if (($dispo != $status) and ($modify_logs > 0))
{
$stmt="UPDATE vicidial_log set status='" . mysql_real_escape_string($status) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by call_date desc limit 1";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$stmt="UPDATE vicidial_agent_log set status='" . mysql_real_escape_string($status) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by agent_log_id desc limit 1";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
}
}
else
{
if ($CBchangeUSERtoANY == 'YES')
{
### inactivate vicidial_callbacks record for this lead
$stmt="UPDATE vicidial_callbacks set recipient='ANYONE' where callback_id='" . mysql_real_escape_string($callback_id) . "';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
echo "<BR>vicidial_callback record changed to ANYONE<BR>\n";
}
if ($CBchangeUSERtoUSER == 'YES')
{
### inactivate vicidial_callbacks record for this lead
$stmt="UPDATE vicidial_callbacks set user='" . mysql_real_escape_string($CBuser) . "' where callback_id='" . mysql_real_escape_string($callback_id) . "';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
echo "<BR>vicidial_callback record user changed to $CBuser<BR>\n";
}
if ($CBchangeANYtoUSER == 'YES')
{
### inactivate vicidial_callbacks record for this lead
$stmt="UPDATE vicidial_callbacks set user='" . mysql_real_escape_string($CBuser) . "',recipient='USERONLY' where callback_id='" . mysql_real_escape_string($callback_id) . "';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
echo "<BR>vicidial_callback record changed to USERONLY, user: $CBuser<BR>\n";
}
$stmt="SELECT count(*) from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$lead_count = $row[0];
if ($lead_count > 0)
{
$stmt="select * from vicidial_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by uniqueid desc limit 500;";
$rslt=mysql_query($stmt, $link);
$logs_to_print = mysql_num_rows($rslt);
$u=0;
$call_log = '';
$log_campaign = '';
while ($logs_to_print > $u)
{
$row=mysql_fetch_row($rslt);
if (strlen($log_campaign)<1) {$log_campaign = $row[3];}
if (eregi("1$|3$|5$|7$|9$", $u))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
$u++;
$call_log .= "<tr $bgcolor>";
$call_log .= "<td><font size=1>$u</td>";
$call_log .= "<td><font size=2>$row[4]</td>";
$call_log .= "<td align=left><font size=2> $row[7]</td>\n";
$call_log .= "<td align=left><font size=2> $row[8]</td>\n";
$call_log .= "<td align=left><font size=2> <A HREF=\"user_stats.php?user=$row[11]\" target=\"_blank\">$row[11]</A> </td>\n";
$call_log .= "<td align=right><font size=2> $row[3] </td>\n";
$call_log .= "<td align=right><font size=2> $row[2] </td>\n";
$call_log .= "<td align=right><font size=2> $row[1] </td></tr>\n";
}
$stmt="select * from vicidial_closer_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by closecallid desc limit 500;";
$rslt=mysql_query($stmt, $link);
$Clogs_to_print = mysql_num_rows($rslt);
$y=0;
$closer_log = '';
$Clog_campaign = '';
while ($Clogs_to_print > $y)
{
$row=mysql_fetch_row($rslt);
if (strlen($Clog_campaign)<1) {$Clog_campaign = $row[3];}
if (eregi("1$|3$|5$|7$|9$", $y))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
$y++;
$closer_log .= "<tr $bgcolor>";
$closer_log .= "<td><font size=1>$y</td>";
$closer_log .= "<td><font size=2>$row[4]</td>";
$closer_log .= "<td align=left><font size=2> $row[7]</td>\n";
$closer_log .= "<td align=left><font size=2> $row[8]</td>\n";
$closer_log .= "<td align=left><font size=2> <A HREF=\"user_stats.php?user=$row[11]\" target=\"_blank\">$row[11]</A> </td>\n";
$closer_log .= "<td align=right><font size=2> $row[3] </td>\n";
$closer_log .= "<td align=right><font size=2> $row[2] </td>\n";
$closer_log .= "<td align=right><font size=2> $row[1] </td>\n";
$closer_log .= "<td align=right><font size=2> &nbsp; $row[14] </td></tr>\n";
}
$stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$lead_id = "$row[0]";
$dispo = "$row[3]";
$tsr = "$row[4]";
$vendor_id = "$row[5]";
$list_id = "$row[7]";
$campaign_id = "$row[8]";
$phone_code = "$row[10]";
$phone_number = "$row[11]";
$title = "$row[12]";
$first_name = "$row[13]"; #
$middle_initial = "$row[14]";
$last_name = "$row[15]"; #
$address1 = "$row[16]"; #
$address2 = "$row[17]"; #
$address3 = "$row[18]"; #
$city = "$row[19]"; #
$state = "$row[20]"; #
$province = "$row[21]"; #
$postal_code = "$row[22]"; #
$country_code = "$row[23]"; #
$gender = "$row[24]";
$date_of_birth = "$row[25]";
$alt_phone = "$row[26]"; #
$email = "$row[27]"; #
$security = "$row[28]"; #
$comments = "$row[29]"; #
echo "<br>Call information: $first_name $last_name - $phone_number<br><br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=end_call value=1>\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=dispo value=\"$dispo\">\n";
echo "<input type=hidden name=list_id value=\"$list_id\">\n";
echo "<input type=hidden name=campaign_id value=\"$campaign_id\">\n";
echo "<input type=hidden name=phone_code value=\"$phone_code\">\n";
echo "<input type=hidden name=phone_number value=\"$phone_number\">\n";
echo "<input type=hidden name=server_ip value=\"$server_ip\">\n";
echo "<input type=hidden name=extension value=\"$extension\">\n";
echo "<input type=hidden name=channel value=\"$channel\">\n";
echo "<input type=hidden name=call_began value=\"$call_began\">\n";
echo "<input type=hidden name=parked_time value=\"$parked_time\">\n";
echo "<table cellpadding=1 cellspacing=0>\n";
echo "<tr><td colspan=2>Vendor ID: $vendor_id &nbsp; &nbsp; Lead ID: $lead_id</td></tr>\n";
echo "<tr><td colspan=2>Fronter: <A HREF=\"user_stats.php?user=$tsr\">$tsr</A> &nbsp; &nbsp; List ID: $list_id</td></tr>\n";
echo "<tr><td align=right>First Name: </td><td align=left><input type=text name=first_name size=15 maxlength=30 value=\"$first_name\"> &nbsp; \n";
echo " Last Name: <input type=text name=last_name size=15 maxlength=30 value=\"$last_name\"> </td></tr>\n";
echo "<tr><td align=right>Address 1 : </td><td align=left><input type=text name=address1 size=30 maxlength=30 value=\"$address1\"></td></tr>\n";
echo "<tr><td align=right>Address 2 : </td><td align=left><input type=text name=address2 size=30 maxlength=30 value=\"$address2\"></td></tr>\n";
echo "<tr><td align=right>Address 3 : </td><td align=left><input type=text name=address3 size=30 maxlength=30 value=\"$address3\"></td></tr>\n";
echo "<tr><td align=right>City : </td><td align=left><input type=text name=city size=30 maxlength=30 value=\"$city\"></td></tr>\n";
echo "<tr><td align=right>State: </td><td align=left><input type=text name=state size=2 maxlength=2 value=\"$state\"> &nbsp; \n";
echo " Postal Code: <input type=text name=postal_code size=10 maxlength=10 value=\"$postal_code\"> </td></tr>\n";
echo "<tr><td align=right>Province : </td><td align=left><input type=text name=province size=30 maxlength=30 value=\"$province\"></td></tr>\n";
echo "<tr><td align=right>Country : </td><td align=left><input type=text name=country_code size=3 maxlength=3 value=\"$country_code\"></td></tr>\n";
echo "<tr><td align=right>Alt Phone : </td><td align=left><input type=text name=alt_phone size=10 maxlength=10 value=\"$alt_phone\"></td></tr>\n";
echo "<tr><td align=right>Email : </td><td align=left><input type=text name=email size=30 maxlength=50 value=\"$email\"></td></tr>\n";
echo "<tr><td align=right>Security : </td><td align=left><input type=text name=security size=30 maxlength=100 value=\"$security\"></td></tr>\n";
echo "<tr><td align=right>Comments : </td><td align=left><input type=text name=comments size=30 maxlength=255 value=\"$comments\"></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Disposition: </td><td align=left><select size=1 name=status>\n";
$stmt="SELECT * from vicidial_statuses where selectable='Y' order by status";
$rslt=mysql_query($stmt, $link);
$statuses_to_print = mysql_num_rows($rslt);
$statuses_list='';
$o=0;
$DS=0;
while ($statuses_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
if ( (strlen($dispo) == strlen($rowx[0])) and (eregi($dispo,$rowx[0])) )
{$statuses_list .= "<option SELECTED value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; $DS++;}
else
{$statuses_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";}
$o++;
}
$stmt="SELECT * from vicidial_campaign_statuses where selectable='Y' and campaign_id='$log_campaign' order by status";
$rslt=mysql_query($stmt, $link);
$CAMPstatuses_to_print = mysql_num_rows($rslt);
$o=0;
while ($CAMPstatuses_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
if ( (strlen($dispo) == strlen($rowx[0])) and (eregi($dispo,$rowx[0])) )
{$statuses_list .= "<option SELECTED value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; $DS++;}
else
{$statuses_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";}
$o++;
}
if ($DS < 1) {$statuses_list .= "<option SELECTED value=\"$dispo\">$dispo</option>\n";}
echo "$statuses_list";
echo "</select> <i>(with $log_campaign statuses)</i></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=left>Modify agent and vicidial logs </td><td align=left><input type=checkbox name=modify_logs value=\"1\" CHECKED></td></tr>\n";
echo "<tr><td colspan=2 align=center><input type=submit name=submit value=\"SUBMIT\"></td></tr>\n";
echo "</table></form>\n";
echo "<BR><BR><BR>\n";
if ( ($dispo == 'CALLBK') or ($dispo == 'CBHOLD') )
{
### find any vicidial_callback records for this lead
$stmt="select * from vicidial_callbacks where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE') order by callback_id desc LIMIT 1;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$CB_to_print = mysql_num_rows($rslt);
$rowx=mysql_fetch_row($rslt);
if ($CB_to_print>0)
{
if ($rowx[9] == 'USERONLY')
{
echo "<br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=CBchangeUSERtoANY value=\"YES\">\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=callback_id value=\"$rowx[0]\">\n";
echo "<input type=submit name=submit value=\"CHANGE TO ANYONE CALLBACK\"></form><BR>\n";
echo "<br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=CBchangeUSERtoUSER value=\"YES\">\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=callback_id value=\"$rowx[0]\">\n";
echo "New Callback Owner UserID: <input type=text name=CBuser size=8 maxlength=10 value=\"$rowx[8]\"> \n";
echo "<input type=submit name=submit value=\"CHANGE USERONLY CALLBACK USER\"></form><BR>\n";
}
else
{
echo "<br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=CBchangeANYtoUSER value=\"YES\">\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=callback_id value=\"$rowx[0]\">\n";
echo "New Callback Owner UserID: <input type=text name=CBuser size=8 maxlength=10 value=\"$rowx[8]\"> \n";
echo "<input type=submit name=submit value=\"CHANGE TO USERONLY CALLBACK\"></form><BR>\n";
}
}
else
{
echo "<BR>No Callback records found<BR>\n";
}
}
}
else
{
echo "lead lookup FAILED for lead_id $lead_id &nbsp; &nbsp; &nbsp; $NOW_TIME\n<BR><BR>\n";
# echo "<a href=\"$PHP_SELF\">Close this window</a>\n<BR><BR>\n";
}
echo "<br><br>\n";
echo "<center>\n";
echo "<B>CALLS TO THIS LEAD:</B>\n";
echo "<TABLE width=550 cellspacing=0 cellpadding=1>\n";
echo "<tr><td><font size=1># </td><td><font size=2>DATE/TIME </td><td align=left><font size=2>LENGTH</td><td align=left><font size=2> STATUS</td><td align=left><font size=2> TSR</td><td align=right><font size=2> CAMPAIGN</td><td align=right><font size=2> LIST</td><td align=right><font size=2> LEAD</td></tr>\n";
echo "$call_log\n";
echo "</TABLE>\n";
echo "<BR><BR>\n";
echo "<B>CLOSER RECORDS FOR THIS LEAD:</B>\n";
echo "<TABLE width=650 cellspacing=0 cellpadding=1>\n";
echo "<tr><td><font size=1># </td><td><font size=2>DATE/TIME </td><td align=left><font size=2>LENGTH</td><td align=left><font size=2> STATUS</td><td align=left><font size=2> TSR</td><td align=right><font size=2> CAMPAIGN</td><td align=right><font size=2> LIST</td><td align=right><font size=2> LEAD</td><td align=right><font size=2> WAIT</td></tr>\n";
echo "$closer_log\n";
echo "</TABLE></center>\n";
echo "<BR><BR>\n";
echo "<B>RECORDINGS FOR THIS LEAD:</B>\n";
echo "<TABLE width=750 cellspacing=1 cellpadding=1>\n";
echo "<tr><td><font size=1># </td><td align=left><font size=2> LEAD</td><td><font size=2>DATE/TIME </td><td align=left><font size=2>SECONDS </td><td align=left><font size=2> &nbsp; RECID</td><td align=center><font size=2>FILENAME</td><td align=left><font size=2>LOCATION</td><td align=left><font size=2>TSR</td></tr>\n";
$stmt="select * from recording_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by recording_id desc limit 500;";
$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"';}
$location = $row[11];
if (strlen($location)>30)
{$locat = substr($location,0,27); $locat = "$locat...";}
else
{$locat = $location;}
if (eregi("http",$location))
{$location = "<a href=\"$location\">$locat</a>";}
else
{$location = $locat;}
$u++;
echo "<tr $bgcolor>";
echo "<td><font size=1>$u</td>";
echo "<td align=left><font size=2> $row[12] </td>";
echo "<td align=left><font size=1> $row[4] </td>\n";
echo "<td align=left><font size=2> $row[8] </td>\n";
echo "<td align=left><font size=2> $row[0] &nbsp;</td>\n";
echo "<td align=center><font size=1> $row[10] </td>\n";
echo "<td align=left><font size=2> $location </td>\n";
echo "<td align=left><font size=2> <A HREF=\"user_stats.php?user=$row[13]\" target=\"_blank\">$row[13]</A> </td>";
echo "</tr>\n";
}
echo "</TABLE></center>\n";
}
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\n\n\n<br><br><br>\n\n";
echo "<font size=0>\n\n\n<br><br><br>\nscript runtime: $RUNtime seconds</font>";
?>
</body>
</html>
<?
exit;
?>
-225
View File
@@ -1,225 +0,0 @@
<?
### admin_search_lead.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
### AST GUI database administration search for lead info
### admin_modify_lead.php
#
# this is the administration lead information modifier screen, the administrator just needs to enter the leadID and then they can view and modify the information in the record for that lead
#
# changes:
# 60620-1055 - Added variable filtering to eliminate SQL injection attack threat
# - Added required user/pass to gain access to this page
# - Changed results to multi-record
#
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["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
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"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
$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");
$NOW_TIME = date("Y-m-d H:i:s");
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_leads='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if ($WeBRooTWritablE > 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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
else
{
if($auth>0)
{
$office_no=strtoupper($PHP_AUTH_USER);
$password=strtoupper($PHP_AUTH_PW);
$stmt="SELECT full_name,modify_leads 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];
$LOGmodify_leads =$row[1];
if ($WeBRooTWritablE > 0)
{
fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n");
fclose($fp);
}
}
else
{
if ($WeBRooTWritablE > 0)
{
fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n");
fclose($fp);
}
}
}
?>
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<title>VICIDIAL ADMIN: Lead Search</title>
</head>
<title>Lead Lookup</title>
</head>
<body bgcolor=white>
<?
echo "<a href=\"./admin.php?ADD=100\">VICIDIAL ADMIN</a>: Lead search<BR>\n";
if ( (!$vendor_id) and (!$phone) and (!$lead_id) )
{
echo date("l F j, Y G:i:s A");
echo "\n<br><br><center>\n";
echo "<form method=post name=search action=\"$PHP_SELF\">\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<b>Please enter a:<br> Vendor ID(vendor lead code): <input type=text name=vendor_id size=10 maxlength=10> or \n";
echo "<br><b>a Home Phone Number: <input type=text name=phone size=10 maxlength=10> or\n";
echo "<br><b>a lead ID: <input type=text name=lead_id size=10 maxlength=10> <br><br>\n";
echo "<input type=submit name=submit value=SUBMIT></b>\n";
echo "</form>\n</center>\n";
echo "</body></html>\n";
exit;
}
else
{
if ($vendor_id)
{
$stmt="SELECT * from vicidial_list where vendor_lead_code='" . mysql_real_escape_string($vendor_id) . "' order by modify_date desc limit 1000";
}
else
{
if ($phone)
{
$stmt="SELECT * from vicidial_list where phone_number='" . mysql_real_escape_string($phone) . "' order by modify_date desc limit 1000";
}
else
{
if ($lead_id)
{
$stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "' order by modify_date desc limit 1000";
}
else
{
print "ERROR: you must search for something! Go back and search for something";
exit;
}
}
}
if ($DB)
{
echo "\n\n$stmt\n\n";
}
$rslt=mysql_query($stmt, $link);
$results_to_print = mysql_num_rows($rslt);
if ($results_to_print < 1)
{
echo date("l F j, Y G:i:s A");
echo "\n<br><br><center>\n";
echo "<b>The search variables you entered are not active in the system</b><br><br>\n";
echo "<b>Please go back and double check the information you entered and submit again</b>\n";
echo "</center>\n";
echo "</body></html>\n";
exit;
}
else
{
echo "<b>RESULTS: $results_to_print</b><BR><BR>\n";
echo "<TABLE BGCOLOR=WHITE CELLPADDING=1 CELLSPACING=0>\n";
echo "<TR BGCOLOR=BLACK>\n";
echo "<TD ALIGN=LEFT><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>#</B></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>LEAD ID</B></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>STATUS</B></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>VENDOR ID</B></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>LAST AGENT</B></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>LIST ID</B></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>PHONE</B></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>NAME</B></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>CITY</B></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>SECURITY</B></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>LAST CALL</B></FONT></TD>\n";
echo "</TR>\n";
$o=0;
while ($results_to_print > $o)
{
$row=mysql_fetch_row($rslt);
$o++;
if (eregi("1$|3$|5$|7$|9$", $o))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
echo "<TR $bgcolor>\n";
echo "<TD ALIGN=LEFT><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$o</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1><a href=\"admin_modify_lead.php?lead_id=$row[0]\">$row[0]</a></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[3]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[5]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[4]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[7]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[11]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[13] $row[15]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[19]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[28]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[2]</FONT></TD>\n";
echo "</TR>\n";
}
echo "</TABLE>\n";
}
}
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\n\n\n<br><br><br>\n<a href=\"$PHP_SELF\">NEW SEARCH</a>";
echo "\n\n\n<br><br><br>\nscript runtime: $RUNtime seconds";
?>
</body>
</html>
-1
View File
@@ -1 +0,0 @@
-49
View File
@@ -1,49 +0,0 @@
<?
#
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
if ( file_exists("/etc/astguiclient.conf") )
{
$DBCagc = file("/etc/astguiclient.conf");
foreach ($DBCagc as $DBCline)
{
$DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline);
if (ereg("^PATHlogs", $DBCline))
{$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);}
if (ereg("^PATHweb", $DBCline))
{$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);}
if (ereg("^VARDB_server", $DBCline))
{$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);}
if (ereg("^VARDB_database", $DBCline))
{$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);}
if (ereg("^VARDB_user", $DBCline))
{$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);}
if (ereg("^VARDB_pass", $DBCline))
{$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);}
if (ereg("^VARDB_port", $DBCline))
{$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);}
}
}
else
{
#defaults for DB connection
$VARDB_server = 'localhost';
$VARDB_user = 'cron';
$VARDB_pass = '1234';
$VARDB_database = '1234';
$WeBServeRRooT = '/usr/local/apache2/htdocs';
}
$link=mysql_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass");
mysql_select_db("$VARDB_database");
$local_DEF = 'Local/';
$conf_silent_prefix = '7';
$local_AMP = '@';
$ext_context = 'demo';
$recording_exten = '8309';
$WeBRooTWritablE = '1';
$non_latin = '0'; # set to 1 for UTF rules
?>
-252
View File
@@ -1,252 +0,0 @@
<?
### group_hourly_stats.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
# CHANGES
#
# 60620-1014 - Added variable filtering to eliminate SQL injection attack threat
# - Added required user/pass to gain access to this page
#
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["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["status"])) {$status=$_GET["status"];}
elseif (isset($_POST["status"])) {$status=$_POST["status"];}
if (isset($_GET["date_with_hour"])) {$date_with_hour=$_GET["date_with_hour"];}
elseif (isset($_POST["date_with_hour"])) {$date_with_hour=$_POST["date_with_hour"];}
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);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
$STARTtime = date("U");
$TODAY = date("Y-m-d");
$date_with_hour_default = date("Y-m-d H");
$date_no_hour_default = $TODAY;
if (!isset($date_with_hour)) {$date_with_hour = $date_with_hour_default;}
$date_no_hour = $date_with_hour;
$date_no_hour = eregi_replace(" ([0-9]{2})",'',$date_no_hour);
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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
else
{
header ("Content-type: text/html; charset=utf-8");
if($auth>0)
{
$office_no=strtoupper($PHP_AUTH_USER);
$password=strtoupper($PHP_AUTH_PW);
$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];
}
?>
<html>
<head>
<title>VICIDIAL ADMIN: Group Hourly Stats</title>
<?
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
?>
</head>
<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
<CENTER>
<TABLE WIDTH=620 BGCOLOR=#D9E6FE cellpadding=2 cellspacing=0><TR BGCOLOR=#015B91><TD ALIGN=LEFT><? echo "<a href=\"./admin.php?ADD=100000\">" ?><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B> &nbsp; VICIDIAL ADMIN</a>: Group Hourly Stats <? echo $group ?></TD><TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B><? echo date("l F j, Y G:i:s A") ?> &nbsp; </TD></TR>
<?
if ( ($group) and ($status) and ($date_with_hour) )
{
$stmt="SELECT user,full_name from vicidial_users where user_group = '" . mysql_real_escape_string($group) . "' order by full_name desc;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$tsrs_to_print = mysql_num_rows($rslt);
$o=0;
while($o < $tsrs_to_print)
{
$row=mysql_fetch_row($rslt);
$VDuser[$o] = "$row[0]";
$VDname[$o] = "$row[1]";
$o++;
}
$o=0;
while($o < $tsrs_to_print)
{
$stmt="select count(*) from vicidial_log where call_date >= '" . mysql_real_escape_string($date_with_hour) . ":00:00' and call_date <= '" . mysql_real_escape_string($date_with_hour) . ":59:59' and user='$VDuser[$o]';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$VDtotal[$o] = "$row[0]";
$stmt="select count(*) from vicidial_log where call_date >= '" . mysql_real_escape_string($date_no_hour) . " 00:00:00' and call_date <= '" . mysql_real_escape_string($date_no_hour) . " 23:59:59' and user='$VDuser[$o]' and status='" . mysql_real_escape_string($status) . "';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$VDday[$o] = "$row[0]";
$stmt="select count(*) from vicidial_log where call_date >= '" . mysql_real_escape_string($date_with_hour) . ":00:00' and call_date <= '" . mysql_real_escape_string($date_with_hour) . ":59:59' and user='$VDuser[$o]' and status='" . mysql_real_escape_string($status) . "';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$VDcount[$o] = "$row[0]";
$o++;
}
echo "<TR><TD ALIGN=LEFT COLSPAN=2>\n";
echo "<br><center>\n";
echo "<B>TSR HOUR COUNTS: <a href=\"./admin.php?ADD=3111&group_id=$group\">$group</a> | $status | $date_with_hour | $date_no_hour</B>\n";
echo "<center><TABLE width=600 cellspacing=0 cellpadding=1>\n";
echo "<tr><td><font size=2>TSR </td><td align=left><font size=2>ID </td><td align=right><font size=2> &nbsp; $status</td><td align=right><font size=2> &nbsp; TOTAL CALLS</td><td align=right><font size=2> &nbsp; $status DAY</td><td align=right><font size=2> &nbsp; &nbsp; </td></tr>\n";
$day_calls=0;
$hour_calls=0;
$total_calls=0;
$o=0;
while($o < $tsrs_to_print)
{
if (eregi("1$|3$|5$|7$|9$", $o))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
echo "<tr $bgcolor><td><font size=2>$VDuser[$o]</td>";
echo "<td align=left><font size=2> $VDname[$o]</td>\n";
echo "<td align=right><font size=2> $VDcount[$o]</td>\n";
echo "<td align=right><font size=2> $VDtotal[$o]</td>\n";
echo "<td align=right><font size=2> $VDday[$o]</td>\n";
echo "<td align=right><font size=1><a href=\"./admin.php?ADD=3&user=$VDuser[$o]\">MODIFY</a> | <a href=\"./user_stats.php?user=$VDuser[$o]\">STATS</a></td></tr>\n";
$total_calls = ($total_calls + $VDtotal[$o]);
$hour_calls = ($hour_calls + $VDcount[$o]);
$day_calls = ($day_calls + $VDday[$o]);
$o++;
}
echo "<tr><td><font size=2>TOTAL </td><td align=right><font size=2> $status </td><td align=right><font size=2> $hour_calls</td><td align=right><font size=2> $total_calls</td><td align=right><font size=2> $day_calls</td></tr>\n";
}
echo "</TABLE></center>\n";
echo "<br><br>\n";
echo "<br>Please enter the group you want to get hourly stats for: <form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=DB value=$DB>\n";
echo "group: <select size=1 name=group>\n";
$stmt="SELECT * from vicidial_user_groups order by user_group";
$rslt=mysql_query($stmt, $link);
$groups_to_print = mysql_num_rows($rslt);
$o=0;
$groups_list='';
while ($groups_to_print > $o) {
$rowx=mysql_fetch_row($rslt);
if ($group == $group)
{$groups_list .= "<option selected value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";}
else
{$groups_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";}
$o++;
}
echo "$groups_list</select><br>\n";
echo "status: <input type=text name=status size=10 maxlength=10 value=\"$status\"> &nbsp; (example: XFER)<br>\n";
echo "date with hour: <input type=text name=date_with_hour size=14 maxlength=13 value=\"$date_with_hour\"> &nbsp; (example: 2004-06-25 14)<br>\n";
echo "<input type=submit name=submit value=SUBMIT>\n";
echo "<BR><BR><BR>\n";
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\n\n\n<br><br><br>\n\n";
echo "<font size=0>\n\n\n<br><br><br>\nscript runtime: $RUNtime seconds</font>";
?>
</TD></TR><TABLE>
</body>
</html>
<?
exit;
?>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 492 B

-926
View File
@@ -1,926 +0,0 @@
<?
# listloader.php
#
# Copyright (C) 2007 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: GPLv2
#
# AST Web GUI lead loader from formatted file
#
# CHANGES
# 50602-1640 - First version created by Joe Johnson
# 51128-1108 - Removed PHP global vars requirement
# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60616-1006 - added listID override and gmt_offset lookup while loading
# 60619-1652 - Added variable filtering to eliminate SQL injection attack threat
# 60822-1105 - fixed for nonwritable directories
# 60906-1059 - added filter of non-digits in alt_phone field
# 61110-1222 - added new USA-Canada DST scheme and Brazil DST scheme
# 61128-1046 - added postal code GMT lookup and duplicate check options
# 70205-1703 - Defaulted phone_code to 1 if not populated
# 70417-1059 - Fixed default phone_code bug
#
# make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time.
#
$version = '2.0.3';
$build = '770417-1059';
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'];
$leadfile=$_FILES["leadfile"];
$LF_orig = $_FILES['leadfile']['name'];
$LF_path = $_FILES['leadfile']['tmp_name'];
$submit_file=$_GET["submit_file"]; if (!$submit_file) {$submit_file=$_POST["submit_file"];}
$list_id_override=$_GET["list_id_override"]; if (!$list_id_override) {$list_id_override=$_POST["list_id_override"];}
$list_id_override = (preg_replace("/\D/","",$list_id_override));
$submit=$_GET["submit"]; if (!$submit) {$submit=$_POST["submit"];}
$SUBMIT=$_GET["SUBMIT"]; if (!$SUBMIT) {$SUBMIT=$_POST["SUBMIT"];}
if (isset($_GET["dupcheck"])) {$dupcheck=$_GET["dupcheck"];}
elseif (isset($_POST["dupcheck"])) {$dupcheck=$_POST["dupcheck"];}
if (isset($_GET["postalgmt"])) {$postalgmt=$_GET["postalgmt"];}
elseif (isset($_POST["postalgmt"])) {$postalgmt=$_POST["postalgmt"];}
#$DB=1;
#$DBX=1;
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$list_id_override = ereg_replace("[^0-9]","",$list_id_override);
$script_name = getenv("SCRIPT_NAME");
$server_name = getenv("SERVER_NAME");
$server_port = getenv("SERVER_PORT");
if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';}
else {$HTTPprotocol = 'http://';}
$admDIR = "$HTTPprotocol$server_name$script_name";
$admDIR = eregi_replace('listloader.php','',$admDIR);
$admSCR = 'admin.php';
$NWB = " &nbsp; <a href=\"javascript:openNewWindow('$admDIR$admSCR?ADD=99999";
$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP></A>";
$secX = date("U");
$hour = date("H");
$min = date("i");
$sec = date("s");
$mon = date("m");
$mday = date("d");
$year = date("Y");
$isdst = date("I");
$Shour = date("H");
$Smin = date("i");
$Ssec = date("s");
$Smon = date("m");
$Smday = date("d");
$Syear = date("Y");
$pulldate0 = "$year-$mon-$mday $hour:$min:$sec";
$inSD = $pulldate0;
$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec );
### Grab Server GMT value from the database
$stmt="SELECT local_gmt FROM servers where server_ip = '$server_ip';";
$rslt=mysql_query($stmt, $link);
$gmt_recs = mysql_num_rows($rslt);
if ($gmt_recs > 0)
{
$row=mysql_fetch_row($rslt);
$DBSERVER_GMT = "$row[0]";
if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;}
if ($isdst) {$SERVER_GMT++;}
}
else
{
$SERVER_GMT = date("O");
$SERVER_GMT = eregi_replace("\+","",$SERVER_GMT);
$SERVER_GMT = ($SERVER_GMT + 0);
$SERVER_GMT = ($SERVER_GMT / 100);
}
$LOCAL_GMT_OFF = $SERVER_GMT;
$LOCAL_GMT_OFF_STD = $SERVER_GMT;
#if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";}
echo "<html>\n";
echo "<head>\n";
echo "<!-- VERSION: $version BUILD: $build -->\n";
echo "<!-- SEED TIME $secX: $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF DST: $isdst -->\n";
?>
<script language="JavaScript1.2">
function openNewWindow(url) {
window.open (url,"",'width=500,height=300,scrollbars=yes,menubar=yes,address=yes');
}
function ShowProgress(good, bad, total, dup, post) {
parent.lead_count.document.open();
parent.lead_count.document.write('<html><body><table border=0 width=200 cellpadding=10 cellspacing=0 align=center valign=top><tr bgcolor="#000000"><th colspan=2><font face="arial, helvetica" size=3 color=white>Current file status:</font></th></tr><tr bgcolor="#009900"><td align=right><font face="arial, helvetica" size=2 color=white><B>Good:</B></font></td><td align=left><font face="arial, helvetica" size=2 color=white><B>'+good+'</B></font></td></tr><tr bgcolor="#990000"><td align=right><font face="arial, helvetica" size=2 color=white><B>Bad:</B></font></td><td align=left><font face="arial, helvetica" size=2 color=white><B>'+bad+'</B></font></td></tr><tr bgcolor="#000099"><td align=right><font face="arial, helvetica" size=2 color=white><B>Total:</B></font></td><td align=left><font face="arial, helvetica" size=2 color=white><B>'+total+'</B></font></td></tr><tr bgcolor="#009900"><td align=right><font face="arial, helvetica" size=2 color=white><B> &nbsp; </B></font></td><td align=left><font face="arial, helvetica" size=2 color=white><B> &nbsp; </B></font></td></tr><tr bgcolor="#009900"><td align=right><font face="arial, helvetica" size=2 color=white><B>Duplicate:</B></font></td><td align=left><font face="arial, helvetica" size=2 color=white><B>'+dup+'</B></font></td></tr><tr bgcolor="#009900"><td align=right><font face="arial, helvetica" size=2 color=white><B>Postal Match:</B></font></td><td align=left><font face="arial, helvetica" size=2 color=white><B>'+post+'</B></font></td></tr></table><body></html>');
parent.lead_count.document.close();
}
</script>
</head>
<body>
<form action=<?=$PHP_SELF ?> method=post enctype="multipart/form-data">
<table align=center width="500" border=0 cellpadding=5 cellspacing=0 bgcolor=#D9E6FE>
<tr>
<td align=right width="25%"><font face="arial, helvetica" size=2>Load leads from this file:</font></td>
<td align=left width="75%"><input type=file name="leadfile" value="<?=$leadfile ?>"> <? echo "$NWB#vicidial_list_loader$NWE"; ?></td>
</tr>
<tr>
<td align=right width="25%"><font face="arial, helvetica" size=2>List ID Override: </font></td>
<td align=left width="75%"><font face="arial, helvetica" size=1><input type=text value="" name='list_id_override' size=10 maxlength=8> (numbers only or leave blank for values in the file)</td>
</tr>
<tr>
<td align=right width="25%"><font face="arial, helvetica" size=2>Lead Duplicate Check: </font></td>
<td align=left width="75%"><font face="arial, helvetica" size=1><select size=1 name=dupcheck><option selected value="NONE">NO DUPLICATE CHECK</option><option value="DUP">CHECK FOR DUPLICATES BY PHONE IN LIST ID</option></select></td>
</tr>
<tr>
<td align=right width="25%"><font face="arial, helvetica" size=2>Lead Time Zone Lookup: </font></td>
<td align=left width="75%"><font face="arial, helvetica" size=1><select size=1 name=postalgmt><option selected value="AREA">COUNTRY CODE AND AREA CODE ONLY</option><option value="POSTAL">POSTAL CODE FIRST</option></select></td>
</tr>
<tr>
<td align=center><input type=submit value="SUBMIT" name='submit_file'></td>
<td align=center><input type=button onClick="javascript:document.location='listloader.php'" value="START OVER" name='reload_page'></td>
</tr>
<tr><td colspan=2><font size=1><a href="new_listloader_superL.php" target="_parent">CLICK HERE TO GO TO THE SUPER LEAD LOADER (BETA VERSION)</a> &nbsp; &nbsp; <a href="admin.php" target="_parent">BACK TO ADMIN</a></font></td></tr>
</table>
</form>
<?
#echo "|$LF_orig|$LF_path|\n";
if ($leadfile and filesize($LF_path)<=8388608) {
print "<script language='JavaScript1.2'>document.forms[0].leadfile.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;</script>";
flush();
if ($WeBRooTWritablE > 0)
{
copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt");
$lead_file = "./vicidial_temp_file.txt";
}
else
{
$lead_file = "$LF_path";
}
$file=fopen("$lead_file", "r");
if ($WeBRooTWritablE > 0)
{$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");}
$pulldate=date("Y-m-d H:i:s");
$buffer=fgets($file, 4096);
$tab_count=substr_count($buffer, "\t");
$pipe_count=substr_count($buffer, "|");
if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";}
$field_check=explode($delimiter, $buffer);
if (count($field_check)>=5) {
flush();
$file=fopen("$lead_file", "r");
$total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list='';
print "<center><font face='arial, helvetica' size=3 color='#009900'><B>Processing $delim_name-delimited file... ($tab_count|$pipe_count)\n";
if (strlen($list_id_override)>0)
{
print "<BR><BR>LIST ID OVERRIDE FOR THIS FILE: $list_id_override<BR><BR>";
}
while (!feof($file)) {
$record++;
$buffer=rtrim(fgets($file, 4096));
$buffer=stripslashes($buffer);
if (strlen($buffer)>0) {
$row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer));
$vendor_lead_code = $row[0];
$source_code = $row[1];
$source_id=$source_code;
$list_id = $row[2];
$phone_code = eregi_replace("[^0-9]", "", $row[3]);
$phone_number = eregi_replace("[^0-9]", "", $row[4]);
$USarea = substr($phone_number, 0, 3);
$title = $row[5];
$first_name = $row[6];
$middle_initial = $row[7];
$last_name = $row[8];
$address1 = $row[9];
$address2 = $row[10];
$address3 = $row[11];
$city = $row[12];
$state = $row[13];
$province = $row[14];
$postal_code = $row[15];
$country = $row[16];
$gender = $row[17];
$date_of_birth = $row[18];
$alt_phone = eregi_replace("[^0-9]", "", $row[19]);
$email = $row[20];
$security_phrase = $row[21];
$comments = trim($row[22]);
if (strlen($list_id_override)>0)
{
# print "<BR><BR>LIST ID OVERRIDE FOR THIS FILE: $list_id_override<BR><BR>";
$list_id = $list_id_override;
}
##### Check for duplicate phone numbers in vicidial_list table #####
if (eregi("DUP",$dupcheck))
{
$dup_lead=0;
$stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';";
$rslt=mysql_query($stmt, $link);
$pc_recs = mysql_num_rows($rslt);
if ($pc_recs > 0)
{
$row=mysql_fetch_row($rslt);
$dup_lead = $row[0];
}
if ($dup_lead < 1)
{
if (eregi("$phone_number$US$list_id",$phone_list))
{$dup_lead++; $dup++;}
}
}
if ( (strlen($phone_number)>6) and ($dup_lead<1) )
{
$US='_';
$entry_date = "$pulldate";
$modify_date = "";
$status = "NEW";
$user = "";
$gmt_offset = '0';
$called_since_last_reset='N';
$phone_list .= "$phone_number$US$list_id|";
if (strlen($phone_code)<1) {$phone_code = '1';}
$postalgmt_found=0;
if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) )
{
if (preg_match('/^1$/', $phone_code))
{
$stmt="select * from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";";
$rslt=mysql_query($stmt, $link);
$pc_recs = mysql_num_rows($rslt);
if ($pc_recs > 0)
{
$row=mysql_fetch_row($rslt);
$gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset);
$dst = $row[3];
$dst_range = $row[4];
$PC_processed++;
$postalgmt_found++;
$post++;
}
}
}
if ($postalgmt_found < 1)
{
$PC_processed=0;
### UNITED STATES ###
if ($phone_code =='1')
{
$stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
$rslt=mysql_query($stmt, $link);
$pc_recs = mysql_num_rows($rslt);
if ($pc_recs > 0)
{
$row=mysql_fetch_row($rslt);
$gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset);
$dst = $row[5];
$dst_range = $row[6];
$PC_processed++;
}
}
### MEXICO ###
if ($phone_code =='52')
{
$stmt="select * from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
$rslt=mysql_query($stmt, $link);
$pc_recs = mysql_num_rows($rslt);
if ($pc_recs > 0)
{
$row=mysql_fetch_row($rslt);
$gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset);
$dst = $row[5];
$dst_range = $row[6];
$PC_processed++;
}
}
### AUSTRALIA ###
if ($phone_code =='61')
{
$stmt="select * from vicidial_phone_codes where country_code='$phone_code' and state='$state';";
$rslt=mysql_query($stmt, $link);
$pc_recs = mysql_num_rows($rslt);
if ($pc_recs > 0)
{
$row=mysql_fetch_row($rslt);
$gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset);
$dst = $row[5];
$dst_range = $row[6];
$PC_processed++;
}
}
### ALL OTHER COUNTRY CODES ###
if (!$PC_processed)
{
$PC_processed++;
$stmt="select * from vicidial_phone_codes where country_code='$phone_code';";
$rslt=mysql_query($stmt, $link);
$pc_recs = mysql_num_rows($rslt);
if ($pc_recs > 0)
{
$row=mysql_fetch_row($rslt);
$gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset);
$dst = $row[5];
$dst_range = $row[6];
$PC_processed++;
}
}
}
### Find out if DST to raise the gmt offset ###
$AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD);
$AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear);
$hour = date("H",$AC_localtime);
$min = date("i",$AC_localtime);
$sec = date("s",$AC_localtime);
$mon = date("m",$AC_localtime);
$mday = date("d",$AC_localtime);
$wday = date("w",$AC_localtime);
$year = date("Y",$AC_localtime);
$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec );
$AC_processed=0;
if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') )
{
if ($DBX) {print " Second Sunday March to First Sunday November\n";}
#**********************************************************************
# SSM-FSN
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on Second Sunday March to First Sunday November at 2 am.
# INPUTS:
# mm INTEGER Month.
# dd INTEGER Day of the month.
# ns INTEGER Seconds into the day.
# dow INTEGER Day of week (0=Sunday, to 6=Saturday)
# OPTIONAL INPUT:
# timezone INTEGER hour difference UTC - local standard time
# (DEFAULT is blank)
# make calculations based on UTC time,
# which means shift at 10:00 UTC in April
# and 9:00 UTC in October
# OUTPUT:
# INTEGER 1 = DST, 0 = not DST
#
# S M T W T F S
# 1 2 3 4 5 6 7
# 8 9 10 11 12 13 14
#15 16 17 18 19 20 21
#22 23 24 25 26 27 28
#29 30 31
#
# S M T W T F S
# 1 2 3 4 5 6
# 7 8 9 10 11 12 13
#14 15 16 17 18 19 20
#21 22 23 24 25 26 27
#28 29 30 31
#
#**********************************************************************
$USACAN_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 3 || $mm > 11) {
$USACAN_DST=0;
} elseif ($mm >= 4 and $mm <= 10) {
$USACAN_DST=1;
} elseif ($mm == 3) {
if ($dd > 13) {
$USACAN_DST=1;
} elseif ($dd >= ($dow+8)) {
if ($timezone) {
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
$USACAN_DST=0;
} else {
$USACAN_DST=1;
}
} else {
if ($dow == 0 and $ns < 7200) {
$USACAN_DST=0;
} else {
$USACAN_DST=1;
}
}
} else {
$USACAN_DST=0;
}
} elseif ($mm == 11) {
if ($dd > 7) {
$USACAN_DST=0;
} elseif ($dd < ($dow+1)) {
$USACAN_DST=1;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (7200+($timezone-1)*3600)) {
$USACAN_DST=1;
} else {
$USACAN_DST=0;
}
} else { # local time calculations
if ($ns < 7200) {
$USACAN_DST=1;
} else {
$USACAN_DST=0;
}
}
} else {
$USACAN_DST=0;
}
} # end of month checks
if ($DBX) {print " DST: $USACAN_DST\n";}
if ($USACAN_DST) {$gmt_offset++;}
$AC_processed++;
}
if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') )
{
if ($DBX) {print " First Sunday April to Last Sunday October\n";}
#**********************************************************************
# FSA-LSO
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on first Sunday in April and last Sunday in October at 2 am.
#**********************************************************************
$NA_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 || $mm > 10) {
$NA_DST=0;
} elseif ($mm >= 5 and $mm <= 9) {
$NA_DST=1;
} elseif ($mm == 4) {
if ($dd > 7) {
$NA_DST=1;
} elseif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
$NA_DST=0;
} else {
$NA_DST=1;
}
} else {
if ($dow == 0 and $ns < 7200) {
$NA_DST=0;
} else {
$NA_DST=1;
}
}
} else {
$NA_DST=0;
}
} elseif ($mm == 10) {
if ($dd < 25) {
$NA_DST=1;
} elseif ($dd < ($dow+25)) {
$NA_DST=1;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (7200+($timezone-1)*3600)) {
$NA_DST=1;
} else {
$NA_DST=0;
}
} else { # local time calculations
if ($ns < 7200) {
$NA_DST=1;
} else {
$NA_DST=0;
}
}
} else {
$NA_DST=0;
}
} # end of month checks
if ($DBX) {print " DST: $NA_DST\n";}
if ($NA_DST) {$gmt_offset++;}
$AC_processed++;
}
if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') )
{
if ($DBX) {print " Last Sunday March to Last Sunday October\n";}
#**********************************************************************
# This is s 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on last Sunday in March and last Sunday in October at 1 am.
#**********************************************************************
$GBR_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 3 || $mm > 10) {
$GBR_DST=0;
} elseif ($mm >= 4 and $mm <= 9) {
$GBR_DST=1;
} elseif ($mm == 3) {
if ($dd < 25) {
$GBR_DST=0;
} elseif ($dd < ($dow+25)) {
$GBR_DST=0;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$GBR_DST=0;
} else {
$GBR_DST=1;
}
} else { # local time calculations
if ($ns < 3600) {
$GBR_DST=0;
} else {
$GBR_DST=1;
}
}
} else {
$GBR_DST=1;
}
} elseif ($mm == 10) {
if ($dd < 25) {
$GBR_DST=1;
} elseif ($dd < ($dow+25)) {
$GBR_DST=1;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$GBR_DST=1;
} else {
$GBR_DST=0;
}
} else { # local time calculations
if ($ns < 3600) {
$GBR_DST=1;
} else {
$GBR_DST=0;
}
}
} else {
$GBR_DST=0;
}
} # end of month checks
if ($DBX) {print " DST: $GBR_DST\n";}
if ($GBR_DST) {$gmt_offset++;}
$AC_processed++;
}
if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') )
{
if ($DBX) {print " Last Sunday October to Last Sunday March\n";}
#**********************************************************************
# This is s 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on last Sunday in October and last Sunday in March at 1 am.
#**********************************************************************
$AUS_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 3 || $mm > 10) {
$AUS_DST=1;
} elseif ($mm >= 4 and $mm <= 9) {
$AUS_DST=0;
} elseif ($mm == 3) {
if ($dd < 25) {
$AUS_DST=1;
} elseif ($dd < ($dow+25)) {
$AUS_DST=1;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$AUS_DST=1;
} else {
$AUS_DST=0;
}
} else { # local time calculations
if ($ns < 3600) {
$AUS_DST=1;
} else {
$AUS_DST=0;
}
}
} else {
$AUS_DST=0;
}
} elseif ($mm == 10) {
if ($dd < 25) {
$AUS_DST=0;
} elseif ($dd < ($dow+25)) {
$AUS_DST=0;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$AUS_DST=0;
} else {
$AUS_DST=1;
}
} else { # local time calculations
if ($ns < 3600) {
$AUS_DST=0;
} else {
$AUS_DST=1;
}
}
} else {
$AUS_DST=1;
}
} # end of month checks
if ($DBX) {print " DST: $AUS_DST\n";}
if ($AUS_DST) {$gmt_offset++;}
$AC_processed++;
}
if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') )
{
if ($DBX) {print " First Sunday October to Last Sunday March\n";}
#**********************************************************************
# TASMANIA ONLY
# This is s 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on first Sunday in October and last Sunday in March at 1 am.
#**********************************************************************
$AUST_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 3 || $mm > 10) {
$AUST_DST=1;
} elseif ($mm >= 4 and $mm <= 9) {
$AUST_DST=0;
} elseif ($mm == 3) {
if ($dd < 25) {
$AUST_DST=1;
} elseif ($dd < ($dow+25)) {
$AUST_DST=1;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$AUST_DST=1;
} else {
$AUST_DST=0;
}
} else { # local time calculations
if ($ns < 3600) {
$AUST_DST=1;
} else {
$AUST_DST=0;
}
}
} else {
$AUST_DST=0;
}
} elseif ($mm == 10) {
if ($dd > 7) {
$AUST_DST=1;
} elseif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
$AUST_DST=0;
} else {
$AUST_DST=1;
}
} else {
if ($dow == 0 and $ns < 3600) {
$AUST_DST=0;
} else {
$AUST_DST=1;
}
}
} else {
$AUST_DST=0;
}
} # end of month checks
if ($DBX) {print " DST: $AUST_DST\n";}
if ($AUST_DST) {$gmt_offset++;}
$AC_processed++;
}
if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') )
{
if ($DBX) {print " First Sunday October to Third Sunday March\n";}
#**********************************************************************
# This is s 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on first Sunday in October and third Sunday in March at 1 am.
#**********************************************************************
$NZL_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 3 || $mm > 10) {
$NZL_DST=1;
} elseif ($mm >= 4 and $mm <= 9) {
$NZL_DST=0;
} elseif ($mm == 3) {
if ($dd < 14) {
$NZL_DST=1;
} elseif ($dd < ($dow+14)) {
$NZL_DST=1;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$NZL_DST=1;
} else {
$NZL_DST=0;
}
} else { # local time calculations
if ($ns < 3600) {
$NZL_DST=1;
} else {
$NZL_DST=0;
}
}
} else {
$NZL_DST=0;
}
} elseif ($mm == 10) {
if ($dd > 7) {
$NZL_DST=1;
} elseif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
$NZL_DST=0;
} else {
$NZL_DST=1;
}
} else {
if ($dow == 0 and $ns < 3600) {
$NZL_DST=0;
} else {
$NZL_DST=1;
}
}
} else {
$NZL_DST=0;
}
} # end of month checks
if ($DBX) {print " DST: $NZL_DST\n";}
if ($NZL_DST) {$gmt_offset++;}
$AC_processed++;
}
if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') )
{
if ($DBX) {print " Third Sunday October to Last Sunday February\n";}
#**********************************************************************
# TSO-LSF
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. Brazil
# Based on Third Sunday October to Last Sunday February at 1 am.
#**********************************************************************
$BZL_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 2 || $mm > 10) {
$BZL_DST=1;
} elseif ($mm >= 3 and $mm <= 9) {
$BZL_DST=0;
} elseif ($mm == 2) {
if ($dd < 22) {
$BZL_DST=1;
} elseif ($dd < ($dow+22)) {
$BZL_DST=1;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$BZL_DST=1;
} else {
$BZL_DST=0;
}
} else { # local time calculations
if ($ns < 3600) {
$BZL_DST=1;
} else {
$BZL_DST=0;
}
}
} else {
$BZL_DST=0;
}
} elseif ($mm == 10) {
if ($dd < 22) {
$BZL_DST=0;
} elseif ($dd < ($dow+22)) {
$BZL_DST=0;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$BZL_DST=0;
} else {
$BZL_DST=1;
}
} else { # local time calculations
if ($ns < 3600) {
$BZL_DST=0;
} else {
$BZL_DST=1;
}
}
} else {
$BZL_DST=1;
}
} # end of month checks
if ($DBX) {print " DST: $BZL_DST\n";}
if ($BZL_DST) {$gmt_offset++;}
$AC_processed++;
}
if (!$AC_processed)
{
if ($DBX) {print " No DST Method Found\n";}
if ($DBX) {print " DST: 0\n";}
$AC_processed++;
}
if ($multi_insert_counter > 8) {
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);";
$rslt=mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
$multistmt='';
$multi_insert_counter=0;
} else {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),";
$multi_insert_counter++;
}
$good++;
}
else
{
if ($bad < 10) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead</font><b>\n";}
$bad++;
}
$total++;
if ($total%100==0)
{
print "<script language='JavaScript1.2'>ShowProgress($good, $bad, $total, $dup, $post)</script>";
usleep(1000);
flush();
}
}
}
if ($multi_insert_counter!=0) {
$stmtZ = "INSERT INTO vicidial_list values".substr($multistmt, 0, -1).";";
mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
}
print "<BR><BR>Done</B> GOOD: $good &nbsp; &nbsp; &nbsp; BAD: $bad &nbsp; &nbsp; &nbsp; TOTAL: $total<BR>DUPLICATE: $dup &nbsp; &nbsp; &nbsp; POSTAL MATCH: $post</font></center>";
} else {
print "<center><font face='arial, helvetica' size=3 color='#990000'><B>ERROR: The file does not have the required number of fields to process it.</B></font></center>";
}
print "<script language='JavaScript1.2'>document.forms[0].leadfile.disabled=false; document.forms[0].submit_file.disabled=false; document.forms[0].reload_page.disabled=false;</script>";
} else if (filesize($leadfile)>8388608) {
print "<center><font face='arial, helvetica' size=3 color='#990000'><B>ERROR: File exceeds the 8MB limit.</B></font></center>";
}
?>
</body>
</html>
File diff suppressed because it is too large Load Diff
-86
View File
@@ -1,86 +0,0 @@
<?
# listloaderMAIN.php
#
# Copyright (C) 2006 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: GPLv2
#
# this is the main frame page for the lead loading section. This is where you
# would upload a file and have it inserted into vicidial_list
#
# changes:
# 60620-1149 - Added variable filtering to eliminate SQL injection attack threat
# 60822-1105 - fixed for nonwritable directories
#
require("dbconnect.php");
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
$PHP_SELF=$_SERVER['PHP_SELF'];
$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");
$NOW_TIME = date("Y-m-d H:i:s");
$FILE_datetime = $STARTtime;
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if ($WeBRooTWritablE > 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=\"VICIDIAL-LEAD-LOADER\"");
Header("HTTP/1.0 401 Unauthorized");
echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
else
{
header ("Content-type: text/html; charset=utf-8");
if($auth>0)
{
$office_no=strtoupper($PHP_AUTH_USER);
$password=strtoupper($PHP_AUTH_PW);
$stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGload_leads =$row[0];
if ($LOGload_leads < 1)
{
echo "You do not have permissions to load leads\n";
exit;
}
if ($WeBRooTWritablE > 0)
{
fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n");
fclose($fp);
}
}
else
{
if ($WeBRooTWritablE > 0)
{
fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n");
fclose($fp);
}
}
}
?><HTML>
<HEAD>
<TITLE>VICIDIAL: Lead Loader Module</TITLE>
</HEAD>
<FRAMESET ROWS="300,*" border=0>
<FRAME SRC="listloader.php" NAME="main">
<FRAME SRC="count.htm" NAME="lead_count">
</HTML>
@@ -1,153 +0,0 @@
#!/usr/bin/perl
### listloader_rowdisplay.pl version 0.2 *DBI-version*
###
### Copyright (C) 2006 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: GPLv2
###
#
# CHANGES
#
# 60811-1232 - Changed to DBI
# 60811-1329 - changed to use /etc/astguiclient.conf for configs
#
### begin parsing run-time options ###
if (length($ARGV[0])>1)
{
$i=0;
while ($#ARGV >= $i)
{
$args = "$args $ARGV[$i]";
$i++;
}
if ($args =~ /--help|-h/i)
{
print "allowed run time options:\n [-forcelistid=1234] = overrides the listID given in the file with the 1234\n [-h] = this help screen\n\n";
exit;
}
else
{
if ($args =~ /-duplicate-check/i)
{$dupcheck=1;}
if ($args =~ /-postal-code-gmt/i)
{$postalgmt=1;}
if ($args =~ /--lead-file=/i)
{
@data_in = split(/--lead-file=/,$args);
$lead_file = $data_in[1];
$lead_file =~ s/ .*//gi;
# print "\n----- LEAD FILE: $lead_file -----\n\n";
}
else
{$lead_file = './vicidial_temp_file.xls';}
}
}
### end parsing run-time options ###
use Spreadsheet::ParseExcel;
use Time::Local;
use DBI;
# default path to astguiclient configuration file:
$PATHconf = '/etc/astguiclient.conf';
open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n";
@conf = <conf>;
close(conf);
$i=0;
foreach(@conf)
{
$line = $conf[$i];
$line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi;
if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) )
{$PATHhome = $line; $PATHhome =~ s/.*=//gi;}
if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) )
{$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;}
if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) )
{$PATHagi = $line; $PATHagi =~ s/.*=//gi;}
if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) )
{$PATHweb = $line; $PATHweb =~ s/.*=//gi;}
if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) )
{$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;}
if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) )
{$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;}
if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) )
{$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) )
{$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) )
{$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) )
{$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) )
{$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) )
{$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;}
$i++;
}
# Customized Variables
$server_ip = $VARserver_ip; # Asterisk server IP
if (!$VARDB_port) {$VARDB_port='3306';}
$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass")
or die "Couldn't connect to database: " . DBI->errstr;
$oBook = Spreadsheet::ParseExcel::Workbook->Parse("$lead_file");
my($iR, $iC, $oWkS, $oWkC);
$var_str="";
foreach $oWkS (@{$oBook->{Worksheet}}) {
for(my $iC = $oWkS->{MinCol} ; defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ; $iC++) {
$oWkC = $oWkS->{Cells}[0][$iC];
if ($oWkC) {
$var_str.=$oWkC->Value."|";
} else {
$var_str.="|";
}
}
}
@xls_row=split(/\|/, $var_str);
$stmtA = "select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments from vicidial_list limit 1;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
while ($sthArows > $rec_count)
{
my $names = $sthA->{'NAME'};
my $numFields = $sthA->{'NUM_OF_FIELDS'};
for (my $i = 0; $i < $numFields; $i++)
{
# printf("%s%s", $i ? "," : "", $$names[$i]);
# printf("%s%s", $i ? "," : "", $$ref[$i]);
$field_name=uc($$names[$i]);
$field_name=~s/\_/ /g;
print " <tr bgcolor=#D9E6FE>\r\n";
print " <th><font class=standard>".$field_name.": </font></td>\r\n";
print " <th><select name='".$$names[$i]."_field'>\r\n";
print " <option value='9999'>---------------------</option>\r\n";
for ($j=0; $j<scalar(@xls_row); $j++)
{
$xls_row[$j]=~s/\"//g;
print " <option value='$j'>\"$xls_row[$j]\"</option>\r\n";
}
print " </select></td>\r\n";
print " </tr>\r\n";
}
$rec_count++;
}
$sthA->finish();
exit;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-327
View File
@@ -1,327 +0,0 @@
<?
### remote_dispo.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
# this is the remote agent disposition screen for calls sent to remote agents. This allows the remote agent to modify customer information and disposition the call
# CHANGES
#
# 60619-1626 - Added variable filtering to eliminate SQL injection attack threat
#
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["address1"])) {$address1=$_GET["address1"];}
elseif (isset($_POST["address1"])) {$address1=$_POST["address1"];}
if (isset($_GET["address2"])) {$address2=$_GET["address2"];}
elseif (isset($_POST["address2"])) {$address2=$_POST["address2"];}
if (isset($_GET["address3"])) {$address3=$_GET["address3"];}
elseif (isset($_POST["address3"])) {$address3=$_POST["address3"];}
if (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];}
elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];}
if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];}
elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];}
if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];}
elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];}
if (isset($_GET["channel"])) {$channel=$_GET["channel"];}
elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];}
if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];}
elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];}
if (isset($_GET["city"])) {$city=$_GET["city"];}
elseif (isset($_POST["city"])) {$city=$_POST["city"];}
if (isset($_GET["comments"])) {$comments=$_GET["comments"];}
elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];}
if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];}
elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];}
if (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];}
elseif (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];}
elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];}
if (isset($_GET["email"])) {$email=$_GET["email"];}
elseif (isset($_POST["email"])) {$email=$_POST["email"];}
if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];}
elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];}
if (isset($_GET["extension"])) {$extension=$_GET["extension"];}
elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];}
if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];}
elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];}
if (isset($_GET["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];}
elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];}
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];}
elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];}
if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];}
elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];}
elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];}
if (isset($_GET["province"])) {$province=$_GET["province"];}
elseif (isset($_POST["province"])) {$province=$_POST["province"];}
if (isset($_GET["security"])) {$security=$_GET["security"];}
elseif (isset($_POST["security"])) {$security=$_POST["security"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];}
elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];}
if (isset($_GET["state"])) {$state=$_GET["state"];}
elseif (isset($_POST["state"])) {$state=$_POST["state"];}
if (isset($_GET["status"])) {$status=$_GET["status"];}
elseif (isset($_POST["status"])) {$status=$_POST["status"];}
if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];}
elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];}
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
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"];}
$STARTtime = date("U");
$TODAY = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$FILE_datetime = $STARTtime;
$ext_context = 'demo';
if (!isset($begin_date)) {$begin_date = $TODAY;}
if (!isset($end_date)) {$end_date = $TODAY;}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;";
if ($DB) {echo "$stmt\n";}
$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=\"VICIDIAL-CLOSER\"");
Header("HTTP/1.0 401 Unauthorized");
echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
else
{
if($auth>0)
{
$office_no=strtoupper($PHP_AUTH_USER);
$password=strtoupper($PHP_AUTH_PW);
$stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGfullname=$row[0];
$fullname = $row[0];
fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n");
fclose($fp);
}
else
{
fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n");
fclose($fp);
}
}
?>
<html>
<head>
<title>VICIDIAL REMOTE: Call Disposition</title>
<?
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
?>
</head>
<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
<CENTER><FONT FACE="Courier" COLOR=BLACK SIZE=3>
<?
echo "<!-- $call_began $lead_id -->";
if ($end_call > 0)
{
$call_length = ($STARTtime - $call_began);
### insert a NEW record to the vicidial_closer_log table
$stmt="UPDATE vicidial_closer_log set end_epoch='$STARTtime', length_in_sec='" . mysql_real_escape_string($call_length) . "', status='" . mysql_real_escape_string($status) . "', user='$PHP_AUTH_USER' where lead_id='" . mysql_real_escape_string($lead_id) . "' order by start_epoch desc limit 1;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
### update the lead record in the vicidial_list table
$stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',first_name='" . mysql_real_escape_string($first_name) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "',user='$PHP_AUTH_USER' where lead_id='" . mysql_real_escape_string($lead_id) . "'";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
echo "Call has been dispositioned &nbsp; &nbsp; &nbsp; $NOW_TIME\n<BR><BR>\n";
echo "<form><input type=button value=\"Close This Window\" onClick=\"javascript:window.close();\"></form>\n";
}
else
{
$stmt="SELECT count(*) from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$lead_count = $row[0];
if ($lead_count > 0)
{
$stmt="SELECT * from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$lead_id = "$row[0]";
$tsr = "$row[4]";
$vendor_id = "$row[5]";
$list_id = "$row[7]";
$campaign_id = "$row[8]";
$phone_code = "$row[10]";
$phone_number = "$row[11]";
$title = "$row[12]";
$first_name = "$row[13]"; #
$middle_initial = "$row[14]";
$last_name = "$row[15]"; #
$address1 = "$row[16]"; #
$address2 = "$row[17]"; #
$address3 = "$row[18]"; #
$city = "$row[19]"; #
$state = "$row[20]"; #
$province = "$row[21]"; #
$postal_code = "$row[22]"; #
$country_code = "$row[23]"; #
$gender = "$row[24]";
$date_of_birth = "$row[25]";
$alt_phone = "$row[26]"; #
$email = "$row[27]"; #
$security = "$row[28]"; #
$comments = "$row[29]"; #
echo "<br>Call information: $first_name $last_name - $phone_number<br><br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=end_call value=1>\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=list_id value=\"$list_id\">\n";
echo "<input type=hidden name=campaign_id value=\"$campaign_id\">\n";
echo "<input type=hidden name=phone_code value=\"$phone_code\">\n";
echo "<input type=hidden name=phone_number value=\"$phone_number\">\n";
echo "<input type=hidden name=server_ip value=\"$server_ip\">\n";
echo "<input type=hidden name=extension value=\"$extension\">\n";
echo "<input type=hidden name=channel value=\"$channel\">\n";
echo "<input type=hidden name=call_began value=\"$call_began\">\n";
echo "<input type=hidden name=parked_time value=\"$parked_time\">\n";
echo "<table cellpadding=1 cellspacing=0>\n";
echo "<tr><td colspan=2>Vendor ID: $vendor_id &nbsp; &nbsp; Campaign ID: $campaign_id</td></tr>\n";
echo "<tr><td colspan=2>Fronter: $tsr &nbsp; &nbsp; List ID: $list_id</td></tr>\n";
echo "<tr><td align=right>First Name: </td><td align=left><input type=text name=first_name size=15 maxlength=30 value=\"$first_name\"> &nbsp; \n";
echo " Last Name: <input type=text name=last_name size=15 maxlength=30 value=\"$last_name\"> </td></tr>\n";
echo "<tr><td align=right>Address 1 : </td><td align=left><input type=text name=address1 size=30 maxlength=30 value=\"$address1\"></td></tr>\n";
echo "<tr><td align=right>Address 2 : </td><td align=left><input type=text name=address2 size=30 maxlength=30 value=\"$address2\"></td></tr>\n";
echo "<tr><td align=right>Address 3 : </td><td align=left><input type=text name=address3 size=30 maxlength=30 value=\"$address3\"></td></tr>\n";
echo "<tr><td align=right>City : </td><td align=left><input type=text name=city size=30 maxlength=30 value=\"$city\"></td></tr>\n";
echo "<tr><td align=right>State: </td><td align=left><input type=text name=state size=2 maxlength=2 value=\"$state\"> &nbsp; \n";
echo " Postal Code: <input type=text name=postal_code size=10 maxlength=10 value=\"$postal_code\"> </td></tr>\n";
echo "<tr><td align=right>Province : </td><td align=left><input type=text name=province size=30 maxlength=30 value=\"$province\"></td></tr>\n";
echo "<tr><td align=right>Country : </td><td align=left><input type=text name=country_code size=3 maxlength=3 value=\"$country_code\"></td></tr>\n";
echo "<tr><td align=right>Alt Phone : </td><td align=left><input type=text name=alt_phone size=10 maxlength=10 value=\"$alt_phone\"></td></tr>\n";
echo "<tr><td align=right>Email : </td><td align=left><input type=text name=email size=30 maxlength=50 value=\"$email\"></td></tr>\n";
echo "<tr><td align=right>Security : </td><td align=left><input type=text name=security size=30 maxlength=100 value=\"$security\"></td></tr>\n";
echo "<tr><td align=right>Comments : </td><td align=left><input type=text name=comments size=30 maxlength=255 value=\"$comments\"></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Disposition: </td><td align=left><select size=1 name=status>\n";
$stmt="SELECT * from vicidial_statuses where selectable='Y' order by status";
$rslt=mysql_query($stmt, $link);
$statuses_to_print = mysql_num_rows($rslt);
$statuses_list='';
$o=0;
while ($statuses_to_print > $o) {
$rowx=mysql_fetch_row($rslt);
$statuses_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";
$o++;
}
echo "$statuses_list";
echo "</select></td></tr>\n";
echo "<tr><td colspan=2><input type=submit name=submit value=\"DISPO CALL\"></td></tr>\n";
echo "</table></form>\n";
echo "<BR><BR><BR>\n";
}
else
{
echo "lead lookup FAILED for lead_id $lead_id &nbsp; &nbsp; &nbsp; $NOW_TIME\n<BR><BR>\n";
# echo "<a href=\"$PHP_SELF\">Close this window</a>\n<BR><BR>\n";
}
}
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\n\n\n<br><br><br>\n\n";
echo "<font size=0>\n\n\n<br><br><br>\nscript runtime: $RUNtime seconds</font>";
?>
</body>
</html>
<?
exit;
?>
-97
View File
@@ -1,97 +0,0 @@
<?
### server_stats.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
# CHANGES
#
# 60620-1037 - Added Link back to Admin section
# - Added required user/pass to gain access to this page
# 61101-1331 - Added SIP/IAX listen/barge links
#
require("dbconnect.php");
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="select * from servers;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$servers_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $servers_to_print)
{
$row=mysql_fetch_row($rslt);
$server_id[$i] = $row[0];
$server_description[$i] = $row[1];
$server_ip[$i] = $row[2];
$active[$i] = $row[3];
$i++;
}
?>
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<TITLE>VICIDIAL: Server Stats and Reports</TITLE></HEAD><BODY BGCOLOR=WHITE>
<FONT SIZE=4><B>VICIDIAL: Server Stats and Reports</B></font> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<a href="./admin.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=2>BACK TO ADMIN</FONT></a><BR><BR>
<UL>
<LI><a href="AST_timeonVDADall.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=2>TIME ON VDAD (per campaign)</a> &nbsp; <a href="AST_timeonVDADallSUMMARY.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=2>(all campaigns SUMMARY)</a> &nbsp; &nbsp; SIP <a href="AST_timeonVDADall.php?SIPmonitorLINK=1"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=2>Listen</a> - <a href="AST_timeonVDADall.php?SIPmonitorLINK=2"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=2>Barge</a> &nbsp; &nbsp; IAX <a href="AST_timeonVDADall.php?IAXmonitorLINK=1"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=2>Listen</a> - <a href="AST_timeonVDADall.php?IAXmonitorLINK=2"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=2>Barge</a></FONT>
<LI><a href="AST_parkstats.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=2>PARK REPORT</a></FONT>
<LI><a href="AST_VDADstats.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=2>VDAD REPORT</a></FONT>
<LI><a href="AST_CLOSERstats.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=2>CLOSER REPORT</a></FONT>
<LI><a href="AST_agent_performance.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=2>AGENT PERFORMANCE</a></FONT>
<LI><a href="AST_agent_performance_detail.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=2>AGENT PERFORMANCE DETAIL</a></FONT>
<LI><a href="AST_server_performance.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=2>SERVER PERFORMANCE</a></FONT>
</UL>
<PRE><TABLE BORDER=1>
<TR><TD>SERVER</TD><TD>DESCRIPTION</TD><TD>IP ADDRESS</TD><TD>ACTIVE</TD><TD>VDAD time</TD><TD>VDcall time</TD><TD>PARK time</TD><TD>CLOSER/INBOUND time</TD></TR>
<?
$o=0;
while ($servers_to_print > $o)
{
echo "<TR>\n";
echo "<TD>$server_id[$o]</TD>\n";
echo "<TD>$server_description[$o]</TD>\n";
echo "<TD>$server_ip[$o]</TD>\n";
echo "<TD>$active[$o]</TD>\n";
echo "<TD><a href=\"AST_timeonVDAD.php?server_ip=$server_ip[$o]\">LINK</a></TD>\n";
echo "<TD><a href=\"AST_timeoncall.php?server_ip=$server_ip[$o]\">LINK</a></TD>\n";
echo "<TD><a href=\"AST_timeonpark.php?server_ip=$server_ip[$o]\">LINK</a></TD>\n";
echo "<TD><a href=\"AST_timeonVDAD.php?server_ip=$server_ip[$o]&closer_display=1\">LINK</a></TD>\n";
echo "</TR>\n";
$o++;
}
?>
</TABLE>
</BODY></HTML>
-408
View File
@@ -1,408 +0,0 @@
<?
### user_stats.php
###
### Copyright (C) 2007 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
# CHANGES
#
# 60619-1743 - Added variable filtering to eliminate SQL injection attack threat
# 61201-1136 - Added recordings display and changed calls to time range with 10000 limit
# 70118-1605 - Added user group column to login/out and calls lists
# 70702-1231 - Added recording location link and truncation
#
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 and view_reports='1';";
$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 "Invalid Username/Password: |$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];
}
?>
<html>
<head>
<title>VICIDIAL ADMIN: User Stats</title>
<?
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
?>
</head>
<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
<CENTER>
<TABLE WIDTH=620 BGCOLOR=#D9E6FE cellpadding=2 cellspacing=0><TR BGCOLOR=#015B91><TD ALIGN=LEFT><? echo "<a href=\"./admin.php\">" ?><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B> &nbsp; VICIDIAL ADMIN</a>: User Stats for <? echo $user ?></TD><TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B><? echo date("l F j, Y G:i:s A") ?> &nbsp; </TD></TR>
<?
echo "<TR BGCOLOR=\"#F0F5FE\"><TD ALIGN=LEFT COLSPAN=2><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2><B> &nbsp; \n";
echo "<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=user value=\"$user\">\n";
echo "<input type=text name=begin_date value=\"$begin_date\" size=10 maxsize=10> to \n";
echo "<input type=text name=end_date value=\"$end_date\" size=10 maxsize=10> &nbsp;\n";
echo "<input type=submit name=submit value=submit>\n";
echo " &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $user - $full_name\n";
echo " - <a href=\"./AST_agent_time_sheet.php?agent=$user\">VICIDIAL Time Sheet</a>\n";
echo " - <a href=\"./user_status.php?user=$user\">User Status</a>\n";
echo " - <a href=\"./admin.php?ADD=3&user=$user\">Modify User</a>\n";
echo "</B></TD></TR>\n";
echo "<TR><TD ALIGN=LEFT COLSPAN=2>\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 "<br><center>\n";
echo "<B>TALK TIME AND STATUS:</B>\n";
echo "<center><TABLE width=300 cellspacing=0 cellpadding=1>\n";
echo "<tr><td><font size=2>STATUS</td><td align=right><font size=2>COUNT</td><td align=right><font size=2>HOURS:MINUTES</td></tr>\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 "<tr $bgcolor><td><font size=2>$row[1]</td>";
echo "<td align=right><font size=2> $row[0]</td>\n";
echo "<td align=right><font size=2> $call_hours_int:$call_minutes_int</td></tr>\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 "<tr><td><font size=2>TOTAL CALLS </td><td align=right><font size=2> $total_calls</td><td align=right><font size=2> $call_hours_int:$call_minutes_int</td></tr>\n";
echo "</TABLE></center>\n";
echo "<br><br>\n";
echo "<center>\n";
echo "<B>LOGIN/LOGOUT TIME:</B>\n";
echo "<TABLE width=500 cellspacing=0 cellpadding=1>\n";
echo "<tr><td><font size=2>EVENT </td><td align=right><font size=2> DATE</td><td align=right><font size=2> CAMPAIGN</td><td align=right><font size=2> GROUP</td><td align=right><font size=2>HOURS:MINUTES</td></tr>\n";
$stmt="SELECT event,event_epoch,event_date,campaign_id,user_group 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 "<tr $bgcolor><td><font size=2>$row[0]</td>";
echo "<td align=right><font size=2> $row[2]</td>\n";
echo "<td align=right><font size=2> $row[3]</td>\n";
echo "<td align=right><font size=2> $row[4]</td>\n";
echo "<td align=right><font size=2> </td></tr>\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 "<tr $bgcolor><td><font size=2>$row[0]</td>";
echo "<td align=right><font size=2> $row[2]</td>\n";
echo "<td align=right><font size=2> $row[3]</td>\n";
echo "<td align=right><font size=2> $row[4]</td>\n";
echo "<td align=right><font size=2> $event_hours_int:$event_minutes_int</td></tr>\n";
$event_start_seconds='';
$event_stop_seconds='';
}
else
{
echo "<tr $bgcolor><td><font size=2>$row[0]</td>";
echo "<td align=right><font size=2> $row[2]</td>\n";
echo "<td align=right><font size=2> $row[3]</td>\n";
echo "<td align=right><font size=2> </td></tr>\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 "<tr><td><font size=2>TOTAL</td>";
echo "<td align=right><font size=2> </td>\n";
echo "<td align=right><font size=2> </td>\n";
echo "<td align=right><font size=2> $total_login_hours_int:$total_login_minutes_int</td></tr>\n";
echo "</TABLE></center>\n";
echo "<br><br>\n";
echo "<center>\n";
echo "<B>OUTBOUND CALLS FOR THIS TIME PERIOD: (10000 record limit)</B>\n";
echo "<TABLE width=650 cellspacing=0 cellpadding=1>\n";
echo "<tr><td><font size=1># </td><td><font size=2>DATE/TIME </td><td align=left><font size=2>LENGTH</td><td align=left><font size=2> STATUS</td><td align=left><font size=2> PHONE</td><td align=right><font size=2> CAMPAIGN</td><td align=right><font size=2> GROUP</td><td align=right><font size=2> LIST</td><td align=right><font size=2> LEAD</td></tr>\n";
$stmt="select * 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' order by call_date desc limit 10000;";
$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"';}
$u++;
echo "<tr $bgcolor>";
echo "<td><font size=1>$u</td>";
echo "<td><font size=2>$row[4]</td>";
echo "<td align=left><font size=2> $row[7]</td>\n";
echo "<td align=left><font size=2> $row[8]</td>\n";
echo "<td align=left><font size=2> $row[10] </td>\n";
echo "<td align=right><font size=2> $row[3] </td>\n";
echo "<td align=right><font size=2> $row[14] </td>\n";
echo "<td align=right><font size=2> $row[2] </td>\n";
echo "<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[1]\" target=\"_blank\">$row[1]</A> </td></tr>\n";
}
echo "</TABLE></center><BR><BR>\n";
echo "<B>CLOSER CALLS FOR THIS TIME PERIOD: (10000 record limit)</B>\n";
echo "<TABLE width=650 cellspacing=0 cellpadding=1>\n";
echo "<tr><td><font size=1># </td><td><font size=2>DATE/TIME </td><td align=left><font size=2>LENGTH</td><td align=left><font size=2> STATUS</td><td align=left><font size=2> PHONE</td><td align=right><font size=2> CAMPAIGN</td><td align=right><font size=2> WAIT (S)</td><td align=right><font size=2> LIST</td><td align=right><font size=2> LEAD</td></tr>\n";
$stmt="select * from vicidial_closer_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' order by call_date desc limit 10000;";
$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"';}
$u++;
echo "<tr $bgcolor>";
echo "<td><font size=1>$u</td>";
echo "<td><font size=2>$row[4]</td>";
echo "<td align=left><font size=2> $row[7]</td>\n";
echo "<td align=left><font size=2> $row[8]</td>\n";
echo "<td align=left><font size=2> $row[10] </td>\n";
echo "<td align=right><font size=2> $row[3] </td>\n";
echo "<td align=right><font size=2> $row[14] </td>\n";
echo "<td align=right><font size=2> $row[2] </td>\n";
echo "<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[1]\" target=\"_blank\">$row[1]</A> </td></tr>\n";
}
echo "</TABLE></center><BR><BR>\n";
echo "<B>RECORDINGS FOR THIS TIME PERIOD: (10000 record limit)</B>\n";
echo "<TABLE width=750 cellspacing=0 cellpadding=1>\n";
echo "<tr><td><font size=1># </td><td align=left><font size=2> LEAD</td><td><font size=2>DATE/TIME </td><td align=left><font size=2>SECONDS </td><td align=left><font size=2> &nbsp; RECID</td><td align=center><font size=2>FILENAME</td><td align=center><font size=2>LOCATION &nbsp; </td></tr>\n";
$stmt="select * from recording_log where user='" . mysql_real_escape_string($user) . "' and start_time >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and start_time <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by recording_id desc limit 10000;";
$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"';}
$location = $row[11];
if (strlen($location)>30)
{$locat = substr($location,0,27); $locat = "$locat...";}
else
{$locat = $location;}
if (eregi("http",$location))
{$location = "<a href=\"$location\">$locat</a>";}
else
{$location = $locat;}
$u++;
echo "<tr $bgcolor>";
echo "<td><font size=1>$u</td>";
echo "<td align=left><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[12]\" target=\"_blank\">$row[12]</A> </td>";
echo "<td align=left><font size=2> $row[4] </td>\n";
echo "<td align=left><font size=2> $row[8] </td>\n";
echo "<td align=left><font size=2> $row[0] </td>\n";
echo "<td align=center><font size=2> $row[10] </td>\n";
echo "<td align=right><font size=2> $location &nbsp; </td>\n";
echo "</tr>\n";
}
echo "</TABLE></center>\n";
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\n\n\n<br><br><br>\n\n";
echo "<font size=0>\n\n\n<br><br><br>\nscript runtime: $RUNtime seconds</font>";
?>
</TD></TR><TABLE>
</body>
</html>
<?
exit;
?>
-242
View File
@@ -1,242 +0,0 @@
<?
### user_status.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
# CHANGES
#
# 60619-1738 - 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["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["stage"])) {$stage=$_GET["stage"];}
elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];}
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 and view_reports='1';";
$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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
else
{
if($auth>0)
{
$stmt="SELECT full_name,change_agent_campaign 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];
$change_agent_campaign=$row[1];
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,user_group from vicidial_users where user='" . mysql_real_escape_string($user) . "';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$full_name = $row[0];
$user_group = $row[1];
$stmt="SELECT * from vicidial_live_agents where user='" . mysql_real_escape_string($user) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$agents_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $agents_to_print)
{
$row=mysql_fetch_row($rslt);
$Aserver_ip = $row[2];
$Asession_id = $row[3];
$Aextension = $row[4];
$Astatus = $row[5];
$Acampaign = $row[7];
$Alast_call = $row[14];
$Acl_campaigns = $row[15];
$i++;
}
}
$stmt="select * from vicidial_campaigns;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$groups_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $groups_to_print)
{
$row=mysql_fetch_row($rslt);
$groups[$i] =$row[0];
$i++;
}
?>
<html>
<head>
<title>VICIDIAL ADMIN: User Status</title>
<?
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
?>
</head>
<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
<CENTER>
<TABLE WIDTH=620 BGCOLOR=#D9E6FE cellpadding=2 cellspacing=0><TR BGCOLOR=#015B91><TD ALIGN=LEFT><? echo "<a href=\"./admin.php\">" ?><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B> &nbsp; VICIDIAL ADMIN</a>: User Status for <? echo $user ?></TD><TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B><? echo date("l F j, Y G:i:s A") ?> &nbsp; </TD></TR>
<?
echo "<TR BGCOLOR=\"#F0F5FE\"><TD ALIGN=LEFT COLSPAN=2><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=3><B> &nbsp; \n";
if ($stage == "live_campaign_change")
{
$stmt="UPDATE vicidial_live_agents set campaign_id='" . mysql_real_escape_string($group) . "' where user='" . mysql_real_escape_string($user) . "';";
$rslt=mysql_query($stmt, $link);
echo "Agent $user - $full_name changed to $group campaign<BR>\n";
exit;
}
if ($stage == "log_agent_out")
{
$stmt="DELETE from vicidial_live_agents where user='" . mysql_real_escape_string($user) . "';";
$rslt=mysql_query($stmt, $link);
echo "Agent $user - $full_name has been emergency logged out, make sure they close their web browser<BR>\n";
exit;
}
if ($agents_to_print > 0)
{
echo "<PRE>";
echo "Agent Logged in at server: $Aserver_ip\n";
echo " in session: $Asession_id\n";
echo " from phone: $Aextension\n";
echo "Agent is in campaign: $Acampaign\n";
echo " status: $Astatus\n";
echo " hungup last call at: $Alast_call\n";
echo " Closer groups: $Acl_campaigns\n\n";
echo "</PRE>";
if ($change_agent_campaign > 0)
{
echo "<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=user value=\"$user\">\n";
echo "<input type=hidden name=stage value=\"live_campaign_change\">\n";
echo "Current Campaign: <SELECT SIZE=1 NAME=group>\n";
$o=0;
while ($groups_to_print > $o)
{
if ($groups[$o] == "$Acampaign") {echo "<option selected value=\"$groups[$o]\">$groups[$o]</option>\n";}
else {echo "<option value=\"$groups[$o]\">$groups[$o]</option>\n";}
$o++;
}
echo "</SELECT>\n";
echo "<input type=submit name=submit value=CHANGE><BR></form>\n";
echo "<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=user value=\"$user\">\n";
echo "<input type=hidden name=stage value=\"log_agent_out\">\n";
echo "<input type=submit name=submit value=\"EMERGENCY LOG AGENT OUT\"><BR></form>\n";
}
}
else
{
echo "Agent is not logged in\n<BR>";
}
echo " &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $user - $full_name \n";
echo " &nbsp; &nbsp; &nbsp; GROUP: $user_group <BR><BR>\n";
echo "<a href=\"./AST_agent_time_sheet.php?agent=$user\">VICIDIAL Time Sheet</a>\n";
echo " - <a href=\"./user_stats.php?user=$user\">User Stats</a>\n";
echo " - <a href=\"./admin.php?ADD=3&user=$user\">Modify User</a>\n";
echo "</B></TD></TR>\n";
echo "<TR><TD ALIGN=LEFT COLSPAN=2>\n";
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\n\n\n<br><br><br>\n\n";
echo "<font size=0>\n\n\n<br><br><br>\nscript runtime: $RUNtime seconds</font>";
echo "|$stage|$group|";
?>
</TD></TR><TABLE>
</body>
</html>
<?
exit;
?>
-602
View File
@@ -1,602 +0,0 @@
<?
# vdremote.php
#
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
# Changes
# 50307-1721 - First version
# 51123-1502 - removed requirement of PHP Globals=on
# 60421-1229 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60619-1603 - Added variable filtering to eliminate SQL injection attack threat
#
# make sure you have added a user to the vicidial_users MySQL table with at least user_level 4 to access this page the first time
$version = '1.1.12';
$build = '60619-1603';
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["ADD"])) {$ADD=$_GET["ADD"];}
elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["force_logout"])) {$force_logout=$_GET["force_logout"];}
elseif (isset($_POST["force_logout"])) {$force_logout=$_POST["force_logout"];}
if (isset($_GET["groups"])) {$groups=$_GET["groups"];}
elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];}
if (isset($_GET["remote_agent_id"])) {$remote_agent_id=$_GET["remote_agent_id"];}
elseif (isset($_POST["remote_agent_id"])) {$remote_agent_id=$_POST["remote_agent_id"];}
if (isset($_GET["user_start"])) {$user_start=$_GET["user_start"];}
elseif (isset($_POST["user_start"])) {$user_start=$_POST["user_start"];}
if (isset($_GET["number_of_lines"])) {$number_of_lines=$_GET["number_of_lines"];}
elseif (isset($_POST["number_of_lines"])) {$number_of_lines=$_POST["number_of_lines"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];}
elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];}
if (isset($_GET["status"])) {$status=$_GET["status"];}
elseif (isset($_POST["status"])) {$status=$_POST["status"];}
if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];}
elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];}
if (isset($_GET["groups"])) {$groups=$_GET["groups"];}
elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];}
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"];}
if (!isset($force_logout)) {$force_logout = 0;}
if ($force_logout)
{
if( (strlen($PHP_AUTH_USER)>0) or (strlen($PHP_AUTH_PW)>0) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
}
echo "You have now logged out. Thank you\n";
exit;
}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$popup_page = './closer_popup.php';
$STARTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 3;";
if ($DB) {echo "|$stmt|\n";}
$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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
else
{
header ("Content-type: text/html; charset=utf-8");
if($auth>0)
{
$office_no=strtoupper($PHP_AUTH_USER);
$password=strtoupper($PHP_AUTH_PW);
$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];
$stmt="SELECT count(*) from vicidial_remote_agents where user_start='$PHP_AUTH_USER';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$authx=$row[0];
if($authx>0)
{
$stmt="SELECT remote_agent_id,server_ip,number_of_lines from vicidial_remote_agents where user_start='$PHP_AUTH_USER';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$remote_agent_id=$row[0];
$server_ip=$row[1];
if (!$number_of_lines) {$number_of_lines=$row[2];}
fwrite ($fp, "VDremote|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n");
fclose($fp);
}
else
{
fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n");
fclose($fp);
echo "This remote agent does not exist: |$PHP_AUTH_USER|\n";
exit;
}
}
else
{
fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n");
fclose($fp);
}
}
echo "<html>\n";
echo "<head>\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
if ($ADD==61111)
{
echo"<META HTTP-EQUIV=Refresh CONTENT=\"5; URL=$PHP_SELF?ADD=61111&user=$user&DB=$DB\">\n";
}
echo "<!-- VERSION: $version BUILD: $build -->\n";
?>
<STYLE type="text/css">
<!--
.green {color: white; background-color: green}
.red {color: white; background-color: red}
.blue {color: white; background-color: blue}
.purple {color: white; background-color: purple}
.yellow {color: black; background-color: yellow}
.orange {color: black; background-color: orange}
-->
</STYLE>
<?
echo "<title>VICIDIAL REMOTE AGENTS: $LOGfullname - $PHP_AUTH_USER ";
if (!$ADD) {$ADD="31111";}
if ($ADD==31111) {echo "Modify Remote Agents";}
if ($ADD==41111) {echo "Modify Remote Agents";}
if ($ADD==61111) {echo "Remote Agent Status";}
if ($ADD==71111) {echo "Remote Agent Closer Stats";}
if (strlen($ADD)>4)
{
##### get server listing for dynamic pulldown
$stmt="SELECT server_ip,server_description from servers order by server_ip";
$rslt=mysql_query($stmt, $link);
$servers_to_print = mysql_num_rows($rslt);
$servers_list='';
$o=0;
while ($servers_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
$servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";
$o++;
}
##### get campaigns listing for dynamic pulldown
$stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id";
$rslt=mysql_query($stmt, $link);
$campaigns_to_print = mysql_num_rows($rslt);
$campaigns_list='';
$o=0;
while ($campaigns_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
$campaigns_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";
$o++;
}
##### get inbound groups listing for checkboxes
if ( (($ADD==31111) or ($ADD==31111)) and (count($groups)<1) )
{
$stmt="SELECT closer_campaigns from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$closer_campaigns = $row[0];
$closer_campaigns = preg_replace("/ -$/","",$closer_campaigns);
$groups = explode(" ", $closer_campaigns);
}
$stmt="SELECT group_id,group_name from vicidial_inbound_groups order by group_id";
$rslt=mysql_query($stmt, $link);
$groups_to_print = mysql_num_rows($rslt);
$groups_list='';
$groups_value='';
$o=0;
while ($groups_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
$group_id_value = $rowx[0];
$group_name_value = $rowx[1];
$groups_list .= "<input type=\"checkbox\" name=\"groups[]\" value=\"$group_id_value\"";
$p=0;
while ($p<50)
{
if ($group_id_value == $groups[$p])
{
$groups_list .= " CHECKED";
$groups_value .= " $group_id_value";
}
$p++;
}
$groups_list .= "> $group_id_value - $group_name_value<BR>\n";
$o++;
}
if (strlen($groups_value)>2) {$groups_value .= " -";}
}
?>
</title>
</head>
<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
<CENTER>
<TABLE WIDTH=620 BGCOLOR=#D9E6FE cellpadding=2 cellspacing=0><TR BGCOLOR=#015B91><TD ALIGN=LEFT><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B> &nbsp; VICIDIAL REMOTE AGENTS: <? echo "$PHP_AUTH_USER " ?> &nbsp; <a href="<? echo $PHP_SELF ?>?force_logout=1"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=1>Logout</a></TD><TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B><? echo date("l F j, Y G:i:s A") ?> &nbsp; </TD></TR>
<TR BGCOLOR=#F0F5FE><TD ALIGN=LEFT COLSPAN=2><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=1> &nbsp; <a href="./vdremote.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=1>MODIFY</a> | <a href="./vdremote.php?ADD=61111&user=<? echo "$PHP_AUTH_USER" ?>"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=1>STATUS</a> | <a href="./vdremote.php?ADD=71111&user=<? echo "$PHP_AUTH_USER" ?>"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=1>INBOUND STATS</a></TD></TR>
<TR><TD ALIGN=LEFT COLSPAN=2>
<?
######################
# ADD=31111 modify remote agents info in the system
######################
if ($ADD==31111)
{
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
$stmt="SELECT * from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$remote_agent_id = $row[0];
$user_start = $row[1];
$number_of_lines = $row[2];
$server_ip = $row[3];
$conf_exten = $row[4];
$status = $row[5];
$campaign_id = $row[6];
echo "<br>MODIFY A REMOTE AGENTS ENTRY: $row[0]<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=ADD value=41111>\n";
echo "<input type=hidden name=remote_agent_id value=\"$row[0]\">\n";
echo "<center><TABLE width=600 cellspacing=3>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>User ID Start: </td><td align=left>$user_start</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Number of Lines: </td><td align=left><input type=text name=number_of_lines size=3 maxlength=3 value=\"$number_of_lines\"> (numbers only)</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Server IP: </td><td align=left>$row[3]</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>External Extension: </td><td align=left><input type=text name=conf_exten size=20 maxlength=20 value=\"$conf_exten\"> (number dialed to reach agents [i.e. 913125551212])</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Status: </td><td align=left><select size=1 name=status><option SELECTED>ACTIVE</option><option>INACTIVE</option><option SELECTED>$status</option></select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Campaign: </td><td align=left>$campaign_id</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Inbound Groups: </td><td align=left>\n";
echo "$groups_list";
echo "</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2><input type=submit name=submit value=submit></td></tr>\n";
echo "</TABLE></center>\n";
echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n";
}
######################
# ADD=41111 modify remote agents info in the system
######################
if ($ADD==41111)
{
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
if ( (strlen($number_of_lines) < 1) or (strlen($conf_exten) < 2) )
{echo "<br>REMOTE AGENTS NOT MODIFIED - Please go back and look at the data you entered\n";}
else
{
$stmt="UPDATE vicidial_remote_agents set number_of_lines='" . mysql_real_escape_string($number_of_lines) . "', conf_exten='" . mysql_real_escape_string($conf_exten) . "', status='" . mysql_real_escape_string($status) . "', closer_campaigns='" . mysql_real_escape_string($groups_value) . "' where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';";
$rslt=mysql_query($stmt, $link);
# echo "$stmt\n";
echo "<br>REMOTE AGENTS MODIFIED\n";
### LOG CHANGES TO LOG FILE ###
$fp = fopen ("./admin_changes_log.txt", "a");
fwrite ($fp, "$date|MODIFY REMOTE AGENTS ENTRY |$PHP_AUTH_USER|$ip|$stmt|\n");
fclose($fp);
}
$stmt="SELECT * from vicidial_remote_agents where remote_agent_id='" . mysql_real_escape_string($remote_agent_id) . "';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$remote_agent_id = $row[0];
$user_start = $row[1];
$number_of_lines = $row[2];
$server_ip = $row[3];
$conf_exten = $row[4];
$status = $row[5];
$campaign_id = $row[6];
echo "<br>MODIFY A REMOTE AGENTS ENTRY: $row[0]<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=ADD value=41111>\n";
echo "<input type=hidden name=remote_agent_id value=\"$row[0]\">\n";
echo "<center><TABLE width=600 cellspacing=3>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>User ID Start: </td><td align=left>$user_start</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Number of Lines: </td><td align=left><input type=text name=number_of_lines size=3 maxlength=3 value=\"$number_of_lines\"> (numbers only)</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Server IP: </td><td align=left>$row[3]</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>External Extension: </td><td align=left><input type=text name=conf_exten size=20 maxlength=20 value=\"$conf_exten\"> (number dialed to reach agents [i.e. 913125551212])</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Status: </td><td align=left><select size=1 name=status><option SELECTED>ACTIVE</option><option>INACTIVE</option><option SELECTED>$status</option></select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Campaign: </td><td align=left>$campaign_id</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Inbound Groups: </td><td align=left>\n";
echo "$groups_list";
echo "</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2><input type=submit name=submit value=submit></td></tr>\n";
echo "</TABLE></center>\n";
echo "NOTE: It can take up to 30 seconds for changes submitted on this screen to go live\n";
}
######################
# ADD=61111 status of remote agent in the system and active calls and queue
######################
if ($ADD==61111)
{
echo "<FONT FACE=\"Courier\" COLOR=BLACK SIZE=2><PRE>";
if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
{echo "<br>REMOTE AGENTS ERROR - Please go back and look at the data you entered\n";}
else
{
$users_list = '';
$k=0;
while($k < $number_of_lines)
{
$nextuser=($user + $k);
$users_list .= "'" . mysql_real_escape_string($nextuser) . "',";
$k++;
}
$users_list = preg_replace("/.$/","",$users_list);
echo "VICIDIAL: Remote Agent Time On Calls $NOW_TIME\n\n";
echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n";
echo "| STATION | USER | LEADID | CHANNEL | STATUS | START TIME | MINUTES |\n";
echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n";
$stmt="select extension,user,lead_id,channel,status,last_call_time,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish) from vicidial_live_agents where status NOT IN('PAUSED') and server_ip='" . mysql_real_escape_string($server_ip) . "' and user IN($users_list) order by extension;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$talking_to_print = mysql_num_rows($rslt);
if ($talking_to_print > 0)
{
$i=0;
while ($i < $talking_to_print)
{
$leadlink=0;
$row=mysql_fetch_row($rslt);
if (eregi("READY|PAUSED",$row[4]))
{
$row[3]='';
$row[5]=' - WAITING - ';
$row[6]=$row[7];
}
$extension = sprintf("%-10s", $row[0]);
$user = sprintf("%-6s", $row[1]);
$leadid = sprintf("%-12s", $row[2]);
if ($row[2] > 0)
{
$leadidLINK=$row[2];
$leadlink++;
if ( eregi("QUEUE",$row[4]) ) {$row[6]=$STARTtime;}
$leadid = "<a href=\"./remote_dispo.php?lead_id=$row[2]&call_began=$row[6]\" target=\"_blank\">$leadid</a>";
}
$channel = sprintf("%-10s", $row[3]);
$cc=0;
while ( (strlen($channel) > 10) and ($cc < 100) )
{
$channel = eregi_replace(".$","",$channel);
$cc++;
if (strlen($channel) <= 10) {$cc=101;}
}
$status = sprintf("%-6s", $row[4]);
$start_time = sprintf("%-19s", $row[5]);
$call_time_S = ($STARTtime - $row[6]);
$call_time_M = ($call_time_S / 60);
$call_time_M = round($call_time_M, 2);
$call_time_M_int = intval("$call_time_M");
$call_time_SEC = ($call_time_M - $call_time_M_int);
$call_time_SEC = ($call_time_SEC * 60);
$call_time_SEC = round($call_time_SEC, 0);
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
$call_time_MS = "$call_time_M_int:$call_time_SEC";
$call_time_MS = sprintf("%7s", $call_time_MS);
$G = ''; $EG = '';
if ($call_time_M_int >= 5) {$G='<SPAN class="yellow"><B>'; $EG='</B></SPAN>';}
if ($call_time_M_int >= 10) {$G='<SPAN class="orange"><B>'; $EG='</B></SPAN>';}
echo "| $G$extension$EG | $G$user$EG | $G$leadid$EG | $G$channel$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
$i++;
}
echo "+------------|--------+--------------+------------+--------+---------------------+---------+\n";
echo " $i agents logged in on server $server_ip\n\n";
echo " <SPAN class=\"yellow\"><B> </SPAN> - 5 minutes or more on call</B>\n";
echo " <SPAN class=\"orange\"><B> </SPAN> - Over 10 minutes on call</B>\n";
}
else
{
echo "**************************************************************************************\n";
echo "********************************* NO AGENTS ON CALLS *********************************\n";
echo "**************************************************************************************\n";
}
}
echo "</PRE>\n\n";
}
######################
# ADD=71111 stats for remote agents from closer logs(vicidial_closer_log)
######################
if ($ADD==71111)
{
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
echo "<INPUT TYPE=TEXT NAME=query_date SIZE=10 MAXLENGTH=10 VALUE=\"$query_date\">\n";
echo "<INPUT TYPE=HIDDEN NAME=ADD VALUE=\"71111\">\n";
echo "<INPUT TYPE=HIDDEN NAME=user VALUE=\"$user\">\n";
echo "<INPUT TYPE=SUBMIT NAME=SUBMIT VALUE=SUBMIT>\n";
echo "</FORM>\n\n";
echo "<FONT FACE=\"Courier\" COLOR=BLACK SIZE=2><PRE>";
if ( (strlen($server_ip) < 2) or (strlen($user) < 2) )
{echo "<br>REMOTE AGENTS ERROR - Please go back and look at the data you entered\n";}
else
{
$users_list = '';
$k=0;
while($k < $number_of_lines)
{
$nextuser=($user + $k);
$users_list .= "'$nextuser',";
$k++;
}
$users_list = preg_replace("/.$/","",$users_list);
$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list);";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$in_calls = $row[0];
$in_time = $row[1];
$in_time_M = ($in_time / 60);
$in_time_M = round($in_time_M, 2);
$in_time_M_int = intval("$in_time_M");
$in_time_SEC = ($in_time_M - $in_time_M_int);
$in_time_SEC = ($in_time_SEC * 60);
$in_time_SEC = round($in_time_SEC, 0);
if ($in_time_SEC < 10) {$in_time_SEC = "0$in_time_SEC";}
$in_time_MS = "$in_time_M_int:$in_time_SEC";
$in_time_MS = sprintf("%7s", $in_time_MS);
echo "VICIDIAL: Remote Agent inbound stats $NOW_TIME\n\n";
echo "\n";
echo "Total calls taken $query_date: $in_calls\n";
echo "Total talk time on $query_date: $in_time_MS (minutes:seconds)\n";
echo "\n";
echo "\n";
echo "Call list for $query_date:\n";
echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n";
echo "| USER | LEADID | GROUP | PHONE NUM | STATUS | CALL TIME | MINUTES |\n";
echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n";
$stmt="select user,lead_id,campaign_id,phone_number,status,call_date,length_in_sec from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and user IN($users_list) order by call_date;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$talking_to_print = mysql_num_rows($rslt);
if ($talking_to_print > 0)
{
$i=0;
while ($i < $talking_to_print)
{
$row=mysql_fetch_row($rslt);
$user = sprintf("%-8s", $row[0]);
$leadid = sprintf("%-10s", $row[1]);
$group = sprintf("%-14s", $row[2]);
$phone = sprintf("%-10s", $row[3]);
$status = sprintf("%-6s", $row[4]);
$start_time = sprintf("%-19s", $row[5]);
$call_time_S = $row[6];
$call_time_M = ($call_time_S / 60);
$call_time_M = round($call_time_M, 2);
$call_time_M_int = intval("$call_time_M");
$call_time_SEC = ($call_time_M - $call_time_M_int);
$call_time_SEC = ($call_time_SEC * 60);
$call_time_SEC = round($call_time_SEC, 0);
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
$call_time_MS = "$call_time_M_int:$call_time_SEC";
$call_time_MS = sprintf("%7s", $call_time_MS);
$G = ''; $EG = '';
# if ($call_time_M_int >= 5) {$G='<SPAN class="yellow"><B>'; $EG='</B></SPAN>';}
# if ($call_time_M_int >= 10) {$G='<SPAN class="orange"><B>'; $EG='</B></SPAN>';}
echo "| $G$user$EG | $G$leadid$EG | $G$group$EG | $G$phone$EG | $G$status$EG | $G$start_time$EG | $G$call_time_MS$EG |\n";
$i++;
}
echo "+----------+------------+----------------+------------+--------+---------------------+---------+\n";
# echo " $i agents logged in on server $server_ip\n\n";
# echo " <SPAN class=\"yellow\"><B> </SPAN> - 5 minutes or more on call</B>\n";
# echo " <SPAN class=\"orange\"><B> </SPAN> - Over 10 minutes on call</B>\n";
}
else
{
echo "**************************************************************************************\n";
echo "********************************* NO CALLS ON THIS DAY *******************************\n";
echo "**************************************************************************************\n";
}
}
echo "</PRE>\n\n";
}
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\n\n\n<br><br><br>\n\n";
echo "<font size=0>\n\n\n<br><br><br>\nscript runtime: $RUNtime seconds</font>";
?>
</TD></TR><TABLE>
</body>
</html>
<?
exit;
?>
-312
View File
@@ -1,312 +0,0 @@
<?
### voice_lab.php
###
### This script is designed to broadcast a recorded message or allow a person to
### speak to all agents logged into a VICIDIAL campaign.
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
#
# CHANGES
#
# 61220-1050 - First Build
# 70115-1246 - Added ability to define an exten to play
#
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["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["message"])) {$message=$_GET["message"];}
elseif (isset($_POST["message"])) {$message=$_POST["message"];}
if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];}
elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];}
if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];}
elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];}
if (isset($_GET["NEW_VOICE_LAB"])) {$NEW_VOICE_LAB=$_GET["NEW_VOICE_LAB"];}
elseif (isset($_POST["NEW_VOICE_LAB"])) {$NEW_VOICE_LAB=$_POST["NEW_VOICE_LAB"];}
if (isset($_GET["KILL_VOICE_LAB"])) {$KILL_VOICE_LAB=$_GET["KILL_VOICE_LAB"];}
elseif (isset($_POST["KILL_VOICE_LAB"])) {$KILL_VOICE_LAB=$_POST["KILL_VOICE_LAB"];}
if (isset($_GET["PLAY_MESSAGE"])) {$PLAY_MESSAGE=$_GET["PLAY_MESSAGE"];}
elseif (isset($_POST["PLAY_MESSAGE"])) {$PLAY_MESSAGE=$_POST["PLAY_MESSAGE"];}
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");
$MYSQL_datetime = date("Y-m-d H:i:s");
$FILE_datetime = date("Ymd-His_");
$secX = $STARTtime;
$local_DEF = 'Local/';
$local_AMP = '@';
$ext_context = 'demo';
$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 "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
else
{
if($auth>0)
{
$office_no=strtoupper($PHP_AUTH_USER);
$password=strtoupper($PHP_AUTH_PW);
$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];
}
##### get server listing for dynamic pulldown
$stmt="SELECT server_ip,server_description from servers order by server_ip";
$rslt=mysql_query($stmt, $link);
$servers_to_print = mysql_num_rows($rslt);
$servers_list='';
$o=0;
while ($servers_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
$servers_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";
$o++;
}
##### get campaigns listing for dynamic pulldown
$stmt="SELECT campaign_id,campaign_name from vicidial_campaigns order by campaign_id";
$rslt=mysql_query($stmt, $link);
$campaigns_to_print = mysql_num_rows($rslt);
$campaigns_list='';
$o=0;
while ($campaigns_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
$campaigns_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";
$o++;
}
?>
<html>
<head>
<title>VICIDIAL VOICE LAB: Admin</title>
<?
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
?>
</head>
<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
<CENTER>
<?
if ($NEW_VOICE_LAB > 0)
{
if ( (strlen($server_ip) > 6) && (strlen($session_id) > 6) && (strlen($campaign_id) > 2) )
{
echo "<br><br><br>TO START YOUR VOICE LAB, DIAL 9$session_id ON YOUR PHONE NOW<br>\n";
echo "<br>or, you can enter an extension that you want played below<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=PLAY_MESSAGE value=2>\n";
echo "<input type=hidden name=session_id value=8600900>\n";
echo "<input type=hidden name=server_ip value=$server_ip>\n";
echo "<input type=hidden name=campaign_id value=$campaign_id>\n";
echo "Message Extension<input type=text name=message>\n";
echo "<input type=submit name=submit value='PLAY THIS MESSAGE'>\n";
echo "</form><BR><BR><BR>\n";
$S='*';
$D_s_ip = explode('.', $server_ip);
if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";}
if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";}
if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";}
if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";}
if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";}
if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";}
if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";}
if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";}
$remote_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$session_id";
$thirty_minutes_old = mktime(date("H"), date("i"), date("s")-30, date("m"), date("d"), date("Y"));
$past_thirty = date("Y-m-d H:i:s",$thirty_minutes_old);
$stmt="SELECT conf_exten,server_ip,user from vicidial_live_agents where last_update_time > '$past_thirty' and campaign_id='$campaign_id';";
$rslt=mysql_query($stmt, $link);
$agents_to_loop = mysql_num_rows($rslt);
$agents_sessions[0]='';
$agents_servers[0]='';
$agents_users[0]='';
$o=0;
while ($agents_to_loop > $o)
{
$rowx=mysql_fetch_row($rslt);
$agents_sessions[$o] = "$rowx[0]";
$agents_servers[$o] = "$rowx[1]";
$agents_users[$o] = "$rowx[2]";
$o++;
}
$o=0;
while ($agents_to_loop > $o)
{
if ($agents_servers[$o] == "$server_ip")
{$dial_string = $session_id;}
else
{$dial_string = $remote_dialstring;}
$stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$agents_servers[$o]','','Originate','VL$FILE_datetime$o','Channel: $local_DEF$dial_string$local_AMP$ext_context','Context: $ext_context','Exten: $agents_sessions[$o]','Priority: 1','Callerid: VL$FILE_datetime$o','','','','','')";
echo "|$stmt|\n<BR><BR>\n";
$rslt=mysql_query($stmt, $link);
echo "LOGGED IN USER $agents_users[$o] at session $agents_sessions[$o] on server $agents_servers[$o]\n";
$o++;
}
echo "<br>Kill a Voice Lab Session: 8600900<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=KILL_VOICE_LAB value=2>\n";
echo "<input type=hidden name=session_id value=8600900>\n";
echo "<input type=hidden name=server_ip value=$server_ip>\n";
echo "<input type=hidden name=campaign_id value=$campaign_id>\n";
echo "<input type=submit name=submit value='KILL THIS VOICE LAB'>\n";
echo "</form><BR><BR><BR>\n";
}
else
{
echo "ERROR!!!! Not all info entered properly\n<BR><BR>\n";
echo "|$server_ip| |$session_id| |$campaign_id|\n<BR><BR>\n";
echo "<a href=\"$PHP_SELF\">Back to main voicelab screen</a>\n<BR><BR>\n";
}
}
else
{
if ($PLAY_MESSAGE > 0)
{
if ( (strlen($server_ip) > 6) && (strlen($session_id) > 6) && (strlen($campaign_id) > 2) && (strlen($message) > 0) )
{
echo "<br><br><br>TO START YOUR VOICE LAB, DIAL 9$session_id ON YOUR PHONE NOW<br>\n";
echo "<br>or, you can enter an extension that you want played below<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=PLAY_MESSAGE value=2>\n";
echo "<input type=hidden name=session_id value=8600900>\n";
echo "<input type=hidden name=server_ip value=$server_ip>\n";
echo "<input type=hidden name=campaign_id value=$campaign_id>\n";
echo "Message Extension<input type=text name=message>\n";
echo "<input type=submit name=submit value='PLAY THIS MESSAGE'>\n";
echo "</form><BR><BR><BR>\n";
$nn='99';
$n='9';
$stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$server_ip','','Originate','VL$FILE_datetime$nn','Channel: $local_DEF$n$session_id$local_AMP$ext_context','Context: $ext_context','Exten: $message','Priority: 1','Callerid: VL$FILE_datetime$nn','','','','','')";
echo "|$stmt|\n<BR><BR>\n";
$rslt=mysql_query($stmt, $link);
echo "MESSAGE $message played at session $session_id on server $server_ip\n";
echo "<br>Kill a Voice Lab Session: 8600900<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=KILL_VOICE_LAB value=2>\n";
echo "<input type=hidden name=session_id value=8600900>\n";
echo "<input type=hidden name=server_ip value=$server_ip>\n";
echo "<input type=hidden name=campaign_id value=$campaign_id>\n";
echo "<input type=submit name=submit value='KILL THIS VOICE LAB'>\n";
echo "</form><BR><BR><BR>\n";
}
else
{
echo "ERROR!!!! Not all info entered properly\n<BR><BR>\n";
echo "|$server_ip| |$session_id| |$campaign_id|\n<BR><BR>\n";
echo "<a href=\"$PHP_SELF\">Back to main voicelab screen</a>\n<BR><BR>\n";
}
}
else
{
echo "<br>Start a Voice Lab Session: 8600900<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=NEW_VOICE_LAB value=2>\n";
echo "<input type=hidden name=session_id value=8600900>\n";
echo "Your Server: <select size=1 name=server_ip>$servers_list</select>\n";
echo "<BR>\n";
echo "Campaign: <select size=1 name=campaign_id>$campaigns_list</select>";
echo "<BR>\n";
echo "<input type=submit name=submit value=submit>\n";
echo "</form><BR><BR><BR>\n";
echo "<br>Kill a Voice Lab Session: 8600900<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=KILL_VOICE_LAB value=2>\n";
echo "<input type=hidden name=session_id value=8600900>\n";
echo "Your Server: <select size=1 name=server_ip>$servers_list</select>\n";
echo "<BR>\n";
echo "Campaign: <select size=1 name=campaign_id>$campaigns_list</select>";
echo "<BR>\n";
echo "<input type=submit name=submit value=submit>\n";
echo "</form><BR><BR><BR>\n";
}
}
if ($KILL_VOICE_LAB > 1)
{
if ( (strlen($server_ip) > 6) && (strlen($session_id) > 6) && (strlen($campaign_id) > 2) )
{
$kill_dial_string = "5555$session_id";
$hangup_exten='8300';
$stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$server_ip','','Originate','VLK$FILE_datetime','Channel: $local_DEF$kill_dial_string$local_AMP$ext_context','Context: $ext_context','Exten: $hangup_exten','Priority: 1','Callerid: VLK$FILE_datetime','','','','','')";
echo "|$stmt|\n<BR><BR>\n";
$rslt=mysql_query($stmt, $link);
echo "VOICELAB SESSION KILLED: $session_id at $server_ip | $KILL_VOICE_LAB\n";
}
else
{
echo "ERROR!!!! Not all info entered properly\n<BR><BR>\n";
echo "|$server_ip| |$session_id| |$campaign_id|\n<BR><BR>\n";
echo "<a href=\"$PHP_SELF\">Back to main voicelab screen</a>\n<BR><BR>\n";
}
}
?>
</BODY></HTML>
-313
View File
@@ -1,313 +0,0 @@
<?
### vtiger_search.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
# This page does a search against a standard vtiger CRM system. If the record
# is not present, it will create a new one and send the agent's screen to that new page.
#
# This code is tested against vtiger 4.2
#
# CHANGES
# 60719-1615 - First version
# 60801-2304 - added mysql debug and auto-forward
# 60802-1111 - added insertion of not-found record into vtiger system
#
#Asterisk/VICIDIAL Server (ASTERISK)
#Internal : 10.10.10.15
#External : 55.55.55.55
#vtiger Server(TEST1)
#Internal : 10.10.10.16
#External : 55.55.55.56
### alter to connect to your vtiger database
$link=mysql_connect("10.10.10.16", "cron",'1234');
if (!$link) {die('Could not connect: ' . mysql_error());}
echo 'Connected successfully';
mysql_select_db("vtigercrm4_2");
$PHP_SELF=$_SERVER['PHP_SELF'];
if (isset($_GET["address1"])) {$address1=$_GET["address1"];}
elseif (isset($_POST["address1"])) {$address1=$_POST["address1"];}
if (isset($_GET["address2"])) {$address2=$_GET["address2"];}
elseif (isset($_POST["address2"])) {$address2=$_POST["address2"];}
if (isset($_GET["address3"])) {$address3=$_GET["address3"];}
elseif (isset($_POST["address3"])) {$address3=$_POST["address3"];}
if (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];}
elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];}
if (isset($_GET["call_began"])) {$call_began=$_GET["call_began"];}
elseif (isset($_POST["call_began"])) {$call_began=$_POST["call_began"];}
if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];}
elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];}
if (isset($_GET["channel"])) {$channel=$_GET["channel"];}
elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];}
if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];}
elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];}
if (isset($_GET["city"])) {$city=$_GET["city"];}
elseif (isset($_POST["city"])) {$city=$_POST["city"];}
if (isset($_GET["comments"])) {$comments=$_GET["comments"];}
elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];}
if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];}
elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];}
if (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];}
elseif (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];}
elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];}
if (isset($_GET["email"])) {$email=$_GET["email"];}
elseif (isset($_POST["email"])) {$email=$_POST["email"];}
if (isset($_GET["end_call"])) {$end_call=$_GET["end_call"];}
elseif (isset($_POST["end_call"])) {$end_call=$_POST["end_call"];}
if (isset($_GET["extension"])) {$extension=$_GET["extension"];}
elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];}
if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];}
elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];}
if (isset($_GET["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];}
elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];}
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];}
elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];}
if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];}
elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];}
elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];}
if (isset($_GET["province"])) {$province=$_GET["province"];}
elseif (isset($_POST["province"])) {$province=$_POST["province"];}
if (isset($_GET["security"])) {$security=$_GET["security"];}
elseif (isset($_POST["security"])) {$security=$_POST["security"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];}
elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];}
if (isset($_GET["state"])) {$state=$_GET["state"];}
elseif (isset($_POST["state"])) {$state=$_POST["state"];}
if (isset($_GET["status"])) {$status=$_GET["status"];}
elseif (isset($_POST["status"])) {$status=$_POST["status"];}
if (isset($_GET["tsr"])) {$tsr=$_GET["tsr"];}
elseif (isset($_POST["tsr"])) {$tsr=$_POST["tsr"];}
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
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);
#$DB = '1'; # DEBUG override
$US = '_';
$STARTtime = date("U");
$TODAY = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$REC_TIME = date("Ymd-His");
$FILE_datetime = $STARTtime;
$parked_time = $STARTtime;
# $ext_context = 'default'; defined in dbconnect file
# $stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
# if ($DB) {echo "$stmt\n";}
# $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($user)<2) or (strlen($pass)<2) or (!$auth))
# {
# Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\"");
# Header("HTTP/1.0 401 Unauthorized");
# echo "Invalid Username/Password: |$user|$pass|\n";
# exit;
# }
# else
# {
#
# if($auth>0)
# {
# $office_no=strtoupper($user);
# $password=strtoupper($pass);
# $stmt="SELECT full_name from vicidial_users where user='$user' and pass='$pass'";
# if ($DB) {echo "$stmt\n";}
# $rslt=mysql_query($stmt, $link);
# $row=mysql_fetch_row($rslt);
# $LOGfullname=$row[0];
# $fullname = $row[0];
# fwrite ($fp, "VD_CLOSER|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n");
# fclose($fp);
#
# if ( (strlen($customer_zap_channel)>2) and (eregi('zap',$customer_zap_channel)) )
# {
# echo "\n<!-- zap channel: $customer_zap_channel -->\n";
# echo "\n<!-- session_id: $session_id -->\n";
#
# }
# else
# {
# echo "Bad channel: $customer_zap_channel\n";
# echo "Make sure the Zap channel is live and try again\n";
# exit;
# }
#
# }
# else
# {
# fwrite ($fp, "VD_CLOSER|FAIL|$date|$user|$pass|$ip|$browser|\n");
# fclose($fp);
# }
# }
echo "<html>\n";
echo "<head>\n";
echo "<title>VICIDIAL Vtiger Lookup</title>\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
$stmt="SELECT count(*) from account where phone='$phone' or otherphone='$phone' or fax='$phone';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
if (!$rslt) {
die('Could not execute: ' . mysql_error());
}
$row=mysql_fetch_row($rslt);
$found_count = $row[0];
#echo "<BR>\n|$phone|$found_count|\n";
if ($found_count < 1)
{
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 onLoad=\"document.forms[0].search_phone.focus(); setTimeout('document.forms[0].phone.focus()', 1000); self.focus()\">\n";
echo "<CENTER><FONT FACE=\"Courier\" COLOR=BLACK SIZE=3>\n";
echo "$phone not found, creating account...\n";
if ($DB) {echo "<PRE>";}
$stmt="SELECT id from users where user_name='$user';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$user_id = $row[0];
if (!$rslt) {die('Could not execute: ' . mysql_error());}
$stmt = "INSERT INTO crmentity (smcreatorid, smownerid, modifiedby, setype, description, createdtime, modifiedtime, viewedtime, status, version, presence, deleted) VALUES ('$user_id', '$user_id', 0, 'Accounts', NULL, '$NOW_TIME', '$NOW_TIME', '$NOW_TIME', NULL, 0, 1, 1);";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$recordID = mysql_insert_id($link);
if ($DB) {echo "|$recordID|\n";}
if (!$rslt) {die('Could not execute: ' . mysql_error());}
# $stmt = "INSERT INTO accountscf (accountid, cf_393, cf_397, cf_403, cf_405, cf_407, cf_409, cf_411) VALUES ('$recordID', NULL, NULL, NULL, NULL, NULL, NULL, NULL);";
# if ($DB) {echo "|$stmt|\n";}
# $rslt=mysql_query($stmt, $link);
# if (!$rslt) {die('Could not execute: ' . mysql_error());}
$stmt = "INSERT INTO account (accountid,accountname,contactname,phone,otherphone,email1) values('$recordID','$last_name, $first_name','$first_name $last_name','$phone','$alt_phone','$email');";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if (!$rslt) {die('Could not execute: ' . mysql_error());}
$stmt = "INSERT INTO accountbillads (accountaddressid,city,code,country,state,street) values('$recordID','$city','$postal_code','US','$state','$address1');";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if (!$rslt) {die('Could not execute: ' . mysql_error());}
$stmt = "INSERT INTO accountshipads (accountaddressid,city,code,country,state,street) values('$recordID','$city','$postal_code','US','$state','$address1');";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if (!$rslt) {die('Could not execute: ' . mysql_error());}
if ($DB) {echo "DONE\n";}
$account_URL = "http://55.55.55.56/index.php?module=Accounts&action=DetailView&record=$recordID";
echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=$account_URL\">\n";
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 onLoad=\"document.forms[0].search_phone.focus(); setTimeout('document.forms[0].phone.focus()', 1000); self.focus()\">\n";
echo "<CENTER><FONT FACE=\"Courier\" COLOR=BLACK SIZE=3>\n";
echo "<PRE>";
echo "account created!\n";
echo "accountid: <a href=\"$account_URL\">$recordID</a>\n";
echo "phone: $phone\n";
echo "</PRE><BR>";
}
else
{
$stmt="SELECT accountid,accountname,contactname from account where phone='$phone' or otherphone='$phone' or fax='$phone';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$accountid = $row[0];
$accountname = $row[1];
$contactname = $row[2];
$account_URL = "http://55.55.55.56/index.php?module=Accounts&action=DetailView&record=$accountid";
echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=$account_URL\">\n";
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 onLoad=\"document.forms[0].search_phone.focus(); setTimeout('document.forms[0].phone.focus()', 1000); self.focus()\">\n";
echo "<CENTER><FONT FACE=\"Courier\" COLOR=BLACK SIZE=3>\n";
echo "<PRE>";
echo "account found!\n";
echo "accountid: <a href=\"$account_URL\">$accountid</a>\n";
echo "phone: $phone\n";
echo "accountname: $accountname\n";
echo "contactname: $contactname\n";
echo "</PRE><BR>";
}
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\n\n\n<br><br><br>\n\n";
echo "<font size=0>\n\n\n<br><br><br>\nscript runtime: $RUNtime seconds</font>";
?>
</body>
</html>
<?
exit;
?>
-25
View File
@@ -1,25 +0,0 @@
<?
# welcome.php - VICIDIAL welcome page
#
#
# Copyright (C) 2007 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
echo "<title>VICIDIAL Welcome</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
echo "<BR><BR><BR><BR><BR><CENTER><TABLE WIDTH=300 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#E0C2D6\"><TR BGCOLOR=WHITE>";
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vdc_tab_vicidial.gif\" BORDER=0></TD>";
echo "<TD ALIGN=CENTER VALIGN=MIDDLE> Welcome </TD>";
echo "</TR>\n";
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=1> &nbsp; </TD></TR>\n";
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><b> <a href=\"../agc/vicidial.php\">Agent Login</a> </TD></TR>\n";
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=1> &nbsp; </TD></TR>\n";
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><b> <a href=\"../vicidial/admin.php\">Administration</a> </TD></TR>\n";
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=1> &nbsp; </TD></TR>\n";
echo "</TABLE>\n";
echo "</FORM>\n\n";
echo "</body>\n\n";
echo "</html>\n\n";
?>
+2 -2
View File
@@ -36,7 +36,7 @@ agc|htglobalize.php|1
"NOV"|"NOV"|
"DEC"|"DEZ"|
\./images/|../agc/images/|
BORDER|RAND|
BORDER|BORDER|
VALUE=SUBMIT|VALUE=SUBMIT|
TYPE=SUBMIT|TYPE=Submit|
MAXLENGTH|maxlength|
@@ -46,7 +46,7 @@ Spanish|Spanisch|
French|Französisch|
German|Deutsch|
Italian|Italienisch|
agc_live_call_OFF.gif|agc_live_call_OFF_de.gif|
agc_live_call_OFF.gif|agc_live_call_OFF_de.jpg|
agc_live_call_ON.gif|agc_live_call_ON_de.gif|
vdc_XB_hotkeysactive.gif|vdc_XB_hotkeysactive_de.gif|
vdc_XB_hotkeysactive_OFF.gif|vdc_XB_hotkeysactive_OFF_de.gif|
+2 -2
View File
@@ -336,8 +336,8 @@ PARK|ZAPARKOVAŤ|
IN-NUMBER|V-ČÍSLE|
NUMBER|ČÍSLO|
LENGTH|DĹŽKA|
CALLERID|ID VOLAJÚCEHO|
CallerID|ID volajúceho|
CALLERID|IDVOLAJÚCEHO|
CallerID|IDvolajúceho|
CALL| HOVOR|
PICKUP|PREVZIAŤ|
CONFERENCE|KONFERENCIA|
+76
View File
@@ -0,0 +1,76 @@
<?
# welcome_demo.php - VICIDIAL welcome Demo page
#
#
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
header ("Content-type: text/html; charset=utf-8");
echo "<title>VICIDIAL Welcome</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
echo "<BR><BR><BR><BR><CENTER><TABLE WIDTH=600 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#E0C2D6\"><TR BGCOLOR=WHITE>";
echo "<TD ALIGN=LEFT VALIGN=BOTTOM WIDTH=120><IMG SRC=\"../agc/images/vdc_tab_vicidial.gif\" BORDER=0></TD>";
echo "<TD ALIGN=RIGHT VALIGN=MIDDLE WIDTH=180> Welcome! Bienvenue! &nbsp; </TD>";
echo "<TD ALIGN=LEFT VALIGN=MIDDLE WIDTH=300> Willkommen! Benvenuto! Υποδοχή!</TD>";
echo "</TR>\n";
echo "<TR><TD ALIGN=LEFT COLSPAN=3><font size=1> &nbsp; </TD></TR>\n";
echo "<TR><TD ALIGN=CENTER COLSPAN=2 VALIGN=TOP>\n";
echo "<TABLE WIDTH=300 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\"#E0C2D6\">";
echo "<TR><TD ALIGN=LEFT>";
echo "<font size=3><b> &nbsp; <a href=\"../agc/vicidial.php\"><IMG SRC=\"../agc/images/en.gif\" border=0> English Agent Login</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_es/vicidial.php\"><IMG SRC=\"../agc/images/es.gif\" border=0> Spanish Agent Login</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_de/vicidial.php\"><IMG SRC=\"../agc/images/de.gif\" border=0> German Agent Login</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_it/vicidial.php\"><IMG SRC=\"../agc/images/it.gif\" border=0> Italian Agent Login</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_el/vicidial.php\"><IMG SRC=\"../agc/images/el.gif\" border=0> Greek Agent Login</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_fr/vicidial.php\"><IMG SRC=\"../agc/images/fr.gif\" border=0> French Agent Login</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_br/vicidial.php\"><IMG SRC=\"../agc/images/br.gif\" border=0> Brazillian Portuguese Agent Login</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_pt/vicidial.php\"><IMG SRC=\"../agc/images/pt.gif\" border=0> Portuguese Agent Login</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_pl/vicidial.php\"><IMG SRC=\"../agc/images/pl.gif\" border=0> Polish Agent Login</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_sk/vicidial.php\"><IMG SRC=\"../agc/images/sk.gif\" border=0> Slovak Agent Login</a>";
echo "</TD></TR></TABLE>\n";
echo "</TD><TD VALIGN=TOP>\n";
echo "<TABLE WIDTH=300 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\"#E0C2D6\">";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../vicidial/admin.php\"><IMG SRC=\"../agc/images/en.gif\" border=0> English Administration</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../vicidial_es/admin.php\"><IMG SRC=\"../agc/images/es.gif\" border=0> Spanish Administration</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../vicidial_de/admin.php\"><IMG SRC=\"../agc/images/de.gif\" border=0> German Administration</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../vicidial_it/admin.php\"><IMG SRC=\"../agc/images/it.gif\" border=0> Italian Administration</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../vicidial_el/admin.php\"><IMG SRC=\"../agc/images/el.gif\" border=0> Greek Administration</a>";
echo "</TD></TR></TABLE>\n";
echo "<TR><TD ALIGN=LEFT ><font size=1> &nbsp; </TD></TR>\n";
echo "</TABLE>\n";
echo "</FORM>\n\n";
echo "</body>\n\n";
echo "</html>\n\n";
?>