$isValidUser = false; $arr_company_ids = array(); if ($str_company_ids != "") { if ($str_company_ids == "A") { if ($i_gateway_id == -1) { if (func_is_gateway_company($cnn_cs, $strUserId) == -1) { $isValidUser = true; } } else { if (func_is_gateway_company($cnn_cs, $strUserId) == $i_gateway_id) { $isValidUser = true; } } } else { if ($str_company_ids == "G") { if (func_is_gateway_company($cnn_cs, $strUserId)) { $isValidUser = true; } } else { $arr_company_ids = split(",", $str_company_ids); if (sizeof($arr_company_ids) != 0) { if (in_array($strUserId, $arr_company_ids)) { $isValidUser = true; } } } } } if (!$isValidUser) { $msgtodisplay = "You are not Authorized to attend calls from this Company"; $outhtml = "y";
>All Companies</option> <?php $qrt_select_company = "select userid,companyname from cs_companydetails order by companyname"; if (!($rstSelectCompany = mysql_query($qrt_select_company, $cnn_cs))) { dieLog(mysql_errno() . ": " . mysql_error() . "<BR>"); } for ($iLoop = 0; $iLoop < mysql_num_rows($rstSelectCompany); $iLoop++) { $i_company_id = mysql_result($rstSelectCompany, $iLoop, 0); $str_company_name = mysql_result($rstSelectCompany, $iLoop, 1); if (sizeof($arr_company_ids) > 0 && $arr_company_ids[0] == "G") { ?> <option value='<?php echo $i_company_id; ?> ' <?php echo func_is_gateway_company($cnn_cs, $i_company_id) ? "selected" : ""; ?> > <?php echo $str_company_name; ?> </option> <?php } else { ?> <option value='<?php echo $i_company_id; ?> ' <?php echo in_array($i_company_id, $arr_company_ids) ? "selected" : ""; ?>
function func_gateway_company_exists($cnn_cs, $company_ids) { $exists = false; if ($company_ids != "") { $arr_company_ids = split(",", $company_ids); if ($arr_company_ids[0] == "A" || $arr_company_ids[0] == "G") { $exists = true; } else { for ($i = 0; $i < count($arr_company_ids); $i++) { if (func_is_gateway_company($cnn_cs, $arr_company_ids[$i])) { $exists = true; break; } } } } return $exists; }