}
     if ($DB) {
         echo "{$stmt}\n";
     }
     $wu_ct = mysqli_num_rows($rslt);
     if ($wu_ct > 0) {
         $row = mysqli_fetch_row($rslt);
         $webphone_url = $row[0];
     }
 }
 if (strlen($system_key) < 1) {
     ##### find system_key in system_settings if populated #####
     $stmt = "SELECT webphone_systemkey FROM system_settings LIMIT 1;";
     $rslt = mysql_to_mysqli($stmt, $link);
     if ($mel > 0) {
         mysqli_error_logging($NOW_TIME, $link, $mel, $stmt, '01068', $VD_login, $server_ip, $session_name, $one_mysql_log);
     }
     if ($DB) {
         echo "{$stmt}\n";
     }
     $wsk_ct = mysqli_num_rows($rslt);
     if ($wsk_ct > 0) {
         $row = mysqli_fetch_row($rslt);
         $system_key = $row[0];
     }
 }
 #	echo "<!-- debug: $webphone_dialpad|$webphone_dialpad_override|$monitor_phone|$extension -->";
 if ($webphone_dialpad_override != 'DISABLED' and strlen($webphone_dialpad_override) > 0) {
     $webphone_dialpad = $webphone_dialpad_override;
 }
 $webphone_options = 'INITIAL_LOAD';
     mysqli_close($link);
     $use_slave_server = 0;
     $db_source = 'M';
     require "dbconnect_mysqli.php";
 }
 ### LOG INSERTION Search Log Table ###
 $SQL_log = "{$stmt}|";
 $SQL_log = preg_replace('/;/', '', $SQL_log);
 $SQL_log = addslashes($SQL_log);
 $stmtL = "INSERT INTO vicidial_lead_search_log set event_date='{$NOW_TIME}', user='******', source='admin', results='0', search_query=\"{$SQL_log}\";";
 if ($DB) {
     echo "|{$stmtL}|\n";
 }
 $rslt = mysql_to_mysqli($stmtL, $link);
 if ($mel > 0) {
     mysqli_error_logging($NOW_TIME, $link, $mel, $stmt, '00XXX', $user, $server_ip, $session_name, $one_mysql_log);
 }
 $search_log_id = mysqli_insert_id($link);
 $rslt = mysql_to_mysqli("{$stmt}", $link);
 $results_to_print = mysqli_num_rows($rslt);
 if ($results_to_print < 1 and $results_to_printX < 1) {
     echo date("l F j, Y G:i:s A");
     echo "\n<br><br><center>\n";
     echo "<b>" . _QXZ("The search variables you entered are not active in the system") . "</b><br><br>\n";
     echo "<b>" . _QXZ("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>" . _QXZ("RESULTS") . ": {$results_to_print}</b><BR><BR>\n";
     echo "<TABLE BGCOLOR=WHITE CELLPADDING=1 CELLSPACING=0 WIDTH=770>\n";