PROVIDER SEARCH RESULTS

[insert_php]
function getUSPhone($var)
{
$US_PHONE_PREG =”/^(?:\+?1[\-\s]?)?(\(\d{3}\)|\d{3})[\-\s\.]?”; //area code
$US_PHONE_PREG.=”(\d{3})[\-\.]?(\d{4})”; // seven digits
$US_PHONE_PREG.=”(?:\s?x|\s|\s?ext(?:\.|\s)?)?(\d*)?$/”; // any extension
if (!preg_match($US_PHONE_PREG,$var,$match)) {
return false;
} else {
$tmp = “”;
if (substr($match[1],0,1) == “(“) {
$tmp.=$match[1];
} else {
$tmp.=”(“.$match[1].”)”;
}
$tmp.=” “.$match[2].”-“.$match[3];
if ($match[4] <> ”) $tmp.=” x”.$match[4];
return $tmp;
}
}

function checkEmail($email)
{
if (!eregi(“^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$”, $email))
{
$result=false;
return $result;
}
else
{
$result=true;
return $result;
}
}

function chkLen($str, $num)
{
/***************************************
Used for form validation.
Check that $str is not longer the $num
***************************************/
$valid = 0;

if($num >= strlen($str))
$valid = 1;
return $valid;
}

if((isset($_POST[‘hp’])&& $_POST[‘hp’]==”NONE”)or trim($_POST[‘hp’]==”))
$errMsg = “You must select a health plan from the dropdown box.

Go back and try your search again.”;
else
{
$db = mysqli_connect (“localhost”, “hdnfmc_webDude”, “deiparous~023”)
or die (‘I cannot connect to the database because: ‘ . mysql_error());
mysqli_select_db ($db, “hdnfmc_prov”) or die( “Unable to select database”);

if(isset($_POST[‘hp’]))
$hp = htmlspecialchars(trim($_POST[‘hp’]));
if(isset($_POST[‘specialty’]))
$spec = trim($_POST[‘specialty’]);
if(isset($_POST[‘city’]))
$city = htmlspecialchars(trim($_POST[‘city’]));
if(isset($_POST[‘lname’]))
$lname = htmlspecialchars(trim($_POST[‘lname’]));
if(isset($_POST[‘accepting’]))
$accept = htmlspecialchars(trim($_POST[‘accepting’]));
else
$accept = ‘off’;
if(isset($_POST[‘pcpOnly’]))
$pcp = htmlspecialchars(trim($_POST[‘pcpOnly’]));
else
$pcp = ‘off’;
if(isset($_POST[‘telemedicine’]))
$telemed = htmlspecialchars(trim($_POST[‘telemedicine’]));
else
$telemed = ‘off’;
if(isset($_POST[‘language’]))
$language = htmlspecialchars(trim($_POST[‘language’]));
else
$language = ‘English’;

if (!chkLen($hp,30))
$errMsg = “
You entered too many characters in the Health Plan field. Your ip is “.$_SERVER[‘REMOTE_ADDR’].”“;
elseif (!chkLen($lname,150))
$errMsg = “
You entered too many characters in the Last Name field. Your ip is “.$_SERVER[‘REMOTE_ADDR’].”“;
elseif (!chkLen($spec,150))
$errMsg = “
You entered too many characters in the Specialty field. Your ip is “.$_SERVER[‘REMOTE_ADDR’].”“;
elseif (!chkLen($city,150))
$errMsg .= “
You entered too many characters in the City field. Your ip is “.$_SERVER[‘REMOTE_ADDR’].”“;
elseif (!chkLen($accept,150))
$errMsg = “
You entered too many characters in the Accepting New Patients field. Your ip is “.$_SERVER[‘REMOTE_ADDR’].”“;
elseif (!chkLen($pcp,150))
$errMsg = “
You entered too many characters in the Primary Care Physician field. Your ip is “.$_SERVER[‘REMOTE_ADDR’].”“;
else
{
$sql = “select lname, fname,suffix, practice, street, city, state, zip, phone,
fax, accepting_new_patient,prov_type,specialty, BoardCert, SJHSDateFrom, SJHSDateTo, id, telemedicine, langs
from tblProv
where “;
$where =””;
$bShowDates = “0”;
switch ($hp)
{
case “CALC”:
$where .= “calc = ‘X'”;
$searchCriteria = “Health Plan: Blue Cross of California”;
break;
case “HBS”:
$where .= “hbs = ‘X'”;
$searchCriteria = “Health Plan: Blue Shield HMO”;
break;
case “BLAKE”:
$where .= “blake = ‘X'”;
$searchCriteria = “Health Plan: Blue Lake Rancheria”;
break;
case “EAP”:
$where .= “eap = ‘X'”;
$searchCriteria = “Health Plan: Employee Assistance Program”;
break;
case “HN”:
$where .= “hn = ‘X'”;
$searchCriteria = “Health Plan: Health Net”;
break;
case “ODC”:
$where .= “odc = ‘X'”;
$searchCriteria = “Health Plan: Open Door Community Health Centers”;
break;
case “PALCO”:
$where .= “palco = ‘X'”;
$searchCriteria = “Health Plan: Palco / Britt”;
break;
case “SJHS”:
$where .= “sjh = ‘X'”;
$searchCriteria = “Health Plan: St. Joseph Health System”;
$bShowDates = “1”;
break;
case “TRIN”:
$where .= “trin = ‘X'”;
$searchCriteria = “Health Plan: Cher Ae Heights Casino”;
break;
case “COOP”;
$where .= “COOP = ‘X'”;
$searchCriteria = “Health Plan: North Coast CO-OP”;
break;
default:
$where .= “1=1”;
$searchCriteria = “Health Plan: Any”;
}

if ($spec != “ANY”)
$where .= ” and specialty LIKE ‘%$spec%'”;
if ($spec ==’Urology’)
$where .= ” and specialty NOT LIKE ‘%Neurology%'”;
if ($city != “ANY”)
$where .= ” and (city=’$city’ or telemedicine = ‘X’)”;
if ($lname)
$where .= ” and upper(lname) like ‘”.strtoupper($lname).”%'”;
if ($accept==’on’)
$where .= ” and accepting_new_patient=’Yes'”;
if ($pcp==’on’)
$where .= ” and (prov_type =’Primary Care Provider’ or prov_type = ‘PCP+SPEC’)”;
if ($telemed==’on’)
$where .= ” and (telemedicine = ‘X’)”;
$where .= ” and (langs like ‘%$language%’)”;

if (isset($_POST[‘sort’]))
{
$sort = $_POST[‘sort’];
$sort = “order by $sort, lname”;
}
else
$sort = “order by lname”;

$sql .= “$where $sort”;
//echo get_magic_quotes_gpc();
$sqlCount = “select count(‘a’) from tblProv where $where”;
$searchCriteria = “

  • $searchCriteria
  • Specialty: $spec
  • Language: $language
  • City: $city
  • Provider´s Last Name: “. stripslashes($lname).”
  • Search only providers that are accepting new patients: $accept
  • Search only for Primary Care Physicians: $pcp
  • Search only for Telemedicine Providers: $telemed
  • “;

    }
    }

    if (isset($errMsg))
    echo $errMsg;
    else
    {
    $rsCount = mysqli_query($db, $sqlCount);
    $data = mysqli_fetch_row($rsCount);
    echo “

    Provider Search Results

    “;
    echo “Start a new search

    “;
    echo “