LICENSE: GPLv2 # # CHANGES # # 90714-1355 - First Build # 120831-1527 - Added vicidial_dial_log logging # 130414-0039 - Added admin logging # 130610-0943 - Finalized changing of all ereg instances to preg # 130616-2144 - Added filtering of input to prevent SQL injection attacks and new user auth # 130901-0853 - Changed to mysqli PHP functions # 141007-2151 - Finalized adding QXZ translation to all admin files # 141229-2008 - Added code for on-the-fly language translations display # 170409-1533 - Added IP List validation code # 220223-0820 - Added allow_web_debug system setting # 220312-0942 - Added vicidial_dial_cid_log logging # 230418-1511 - Added vicidial_user_dial_log logging, and rate limiting # $sendCID_limit=6; require("dbconnect_mysqli.php"); require("functions.php"); $PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; $PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; $PHP_SELF=$_SERVER['PHP_SELF']; $PHP_SELF = preg_replace('/\.php.*/i','.php',$PHP_SELF); $ip = getenv("REMOTE_ADDR"); if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["sender"])) {$sender=$_GET["sender"];} elseif (isset($_POST["sender"])) {$sender=$_POST["sender"];} if (isset($_GET["receiver"])) {$receiver=$_GET["receiver"];} elseif (isset($_POST["receiver"])) {$receiver=$_POST["receiver"];} if (isset($_GET["cid_number"])) {$cid_number=$_GET["cid_number"];} elseif (isset($_POST["cid_number"])) {$cid_number=$_POST["cid_number"];} 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"];} $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### $stmt = "SELECT use_non_latin,enable_languages,language_method,allow_web_debug FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); #if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysqli_num_rows($rslt); if ($qm_conf_ct > 0) { $row=mysqli_fetch_row($rslt); $non_latin = $row[0]; $SSenable_languages = $row[1]; $SSlanguage_method = $row[2]; $SSallow_web_debug = $row[3]; } if ($SSallow_web_debug < 1) {$DB=0;} ##### END SETTINGS LOOKUP ##### ########################################### $sender = preg_replace('/[^0-9]/','',$sender); $receiver = preg_replace('/[^0-9]/','',$receiver); $cid_number = preg_replace('/[^0-9]/','',$cid_number); $server_ip = preg_replace('/[^-\:\.\_0-9a-zA-Z]/','',$server_ip); $SUBMIT = preg_replace('/[^-_0-9a-zA-Z]/', '', $SUBMIT); if ($non_latin < 1) { $PHP_AUTH_USER = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_USER); $PHP_AUTH_PW = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_PW); } else { $PHP_AUTH_USER = preg_replace('/[^-_0-9\p{L}]/u', '', $PHP_AUTH_USER); $PHP_AUTH_PW = preg_replace('/[^-_0-9\p{L}]/u', '', $PHP_AUTH_PW); } $NOW_DATE = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $HIS_TIME = date("His"); $STARTtime = date("U"); $ip = getenv("REMOTE_ADDR"); $stmt="SELECT selected_language from vicidial_users where user='$PHP_AUTH_USER';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); $sl_ct = mysqli_num_rows($rslt); if ($sl_ct > 0) { $row=mysqli_fetch_row($rslt); $VUselected_language = $row[0]; } $auth=0; $auth_message = user_authorization($PHP_AUTH_USER,$PHP_AUTH_PW,'',1,0); if ($auth_message == 'GOOD') {$auth=1;} if ($auth < 1) { $VDdisplayMESSAGE = _QXZ("Login incorrect, please try again"); if ($auth_message == 'LOCK') { $VDdisplayMESSAGE = _QXZ("Too many login attempts, try again in 15 minutes"); Header ("Content-type: text/html; charset=utf-8"); echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; exit; } if ($auth_message == 'IPBLOCK') { $VDdisplayMESSAGE = _QXZ("Your IP Address is not allowed") . ": $ip"; Header ("Content-type: text/html; charset=utf-8"); echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; exit; } Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\""); Header("HTTP/1.0 401 Unauthorized"); echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$PHP_AUTH_PW|$auth_message|\n"; exit; } ?>
\n"; echo "