LICENSE: AGPLv2 # # the purpose of this script and webpage is to allow for remote or local users of the system to log in and grab phone calls that are coming inbound into the Asterisk server and being put in the parked_channels table while they hear a soundfile for a limited amount of time before being forwarded on to either a set extension or a voicemail box. This gives remote or local agents a way to grab calls without tying up their phone lines all day. The agent sees the refreshing screen of calls on park and when they want to take one they just click on it, and a small window opens that will allow them to grab the call and/or look up more information on the caller through the callerID that is given(if available) # CHANGES # # 60620-1032 - Added variable filtering to eliminate SQL injection attack threat # - Added required user/pass to gain access to this page # 90508-0644 - Changed to PHP long tags # 120223-2249 - Removed logging of good login passwords if webroot writable is enabled # 130610-1116 - Finalized changing of all ereg instances to preg # 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["group_selected"])) {$group_selected=$_GET["group_selected"];} elseif (isset($_POST["group_selected"])) {$group_selected=$_POST["group_selected"];} if (isset($_GET["dialplan_number"])) {$dialplan_number=$_GET["dialplan_number"];} elseif (isset($_POST["dialplan_number"])) {$dialplan_number=$_POST["dialplan_number"];} if (isset($_GET["extension"])) {$extension=$_GET["extension"];} elseif (isset($_POST["extension"])) {$extension=$_POST["extension"];} if (isset($_GET["groupselect"])) {$groupselect=$_GET["groupselect"];} elseif (isset($_POST["groupselect"])) {$groupselect=$_POST["groupselect"];} if (isset($_GET["PHONE_LOGIN"])) {$PHONE_LOGIN=$_GET["PHONE_LOGIN"];} elseif (isset($_POST["PHONE_LOGIN"])) {$PHONE_LOGIN=$_POST["PHONE_LOGIN"];} if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} 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["channel"])) {$channel=$_GET["channel"];} elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];} if (isset($_GET["parked_time"])) {$parked_time=$_GET["parked_time"];} elseif (isset($_POST["parked_time"])) {$parked_time=$_POST["parked_time"];} if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];} elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];} if (isset($_GET["debugvars"])) {$debugvars=$_GET["debugvars"];} elseif (isset($_POST["debugvars"])) {$debugvars=$_POST["debugvars"];} if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];} elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];} 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"];} ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### $stmt = "SELECT use_non_latin,webroot_writable,outbound_autodial_active,user_territories_active FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); $i=0; while ($i < $qm_conf_ct) { $row=mysql_fetch_row($rslt); $non_latin = $row[0]; $webroot_writable = $row[1]; $SSoutbound_autodial_active = $row[2]; $user_territories_active = $row[3]; $i++; } ##### END SETTINGS LOOKUP ##### ########################################### $PHP_AUTH_USER = preg_replace('/[^0-9a-zA-Z]/', '', $PHP_AUTH_USER); $PHP_AUTH_PW = preg_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"); $popup_page = './closer_popup.php'; $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; $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]; if ($webroot_writable > 0) { fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } else { if ($webroot_writable > 0) { fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); fclose($fp); } } } $color_class[0] = 'green'; $color_class[1] = 'red'; $color_class[2] = 'blue'; $color_class[3] = 'purple'; $color_class[4] = 'orange'; $color_class[5] = 'green'; $color_class[6] = 'red'; $color_class[7] = 'blue'; $color_class[8] = 'purple'; $color_class[9] = 'orange'; ?>