$stateName) {
$State['LowerCaseName'] = strtolower($stateName);
$State['LowerCaseName'] = str_replace(" ", "-", $State['LowerCaseName']);
$State['Name'] = ucwords(strtolower($stateName));
$State['Name'] = str_replace(" Of ", " of ", $State['Name']);
array_push($StatesArray, $State);
}
print_r($Form);
}
?> trim(stripslashes($_REQUEST['state'])),
'City' => trim(stripslashes($_REQUEST['city'])),
);
$Form['LowerCaseCity'] = strtolower($Form['City']);
$Form['LowerCaseState'] = strtolower($Form['State']);
$Form['State'] = str_replace("-", " ", $Form['State']);
$Form['City'] = str_replace("-", " ", $Form['City']);
if(empty($Form['State']) || empty($Form['City'])) {
header("Location: index.html");
}
$Form['UpperCaseCity'] = ucwords(strtolower($Form['City']));
$Form['UpperCaseState'] = ucwords(strtolower($Form['State']));
$Form['UpperCaseState'] = str_replace(" Of ", " of ", $Form['UpperCaseState']);
$ClinicsArray = array();
$Form['StateAbbrev'] = getStateAbbrev($Form['State']);
$Form['DateNow'] = date("F jS, Y");
$strSQL = "SELECT * FROM clinics WHERE state LIKE '$Form[StateAbbrev]' AND city LIKE '$Form[City]' ORDER BY name ASC";
$result = mysqli_query($connection, $strSQL) or trigger_error($strSQL . " " . mysqli_error(), E_USER_ERROR);
$numrows = mysqli_num_rows($result);
$counter = 0;
if($numrows > 0) {
while($contents = mysqli_fetch_assoc($result)) {
$counter++;
foreach($contents as $c1 => $Item) {
$Clinic[$c1] = $Item;
}
$Clinic['Counter'] = $counter;
$Clinic['LowerCaseState'] = strtolower(getStateName($Clinic['state']));
$Clinic['LowerCaseState'] = str_replace(" ", "-", $Clinic['LowerCaseState']);
$Clinic['State'] = $Clinic['State'];
$Clinic['State'] = str_replace(" Of ", " of ", $Clinic['State']);
$Clinic['LowerCaseCity'] = strtolower($Clinic['city']);
$Clinic['LowerCaseCity'] = str_replace(" ", "-", $Clinic['LowerCaseCity']);
$Clinic['City'] = $Clinic['city'];
$Clinic['Name'] = $Clinic['name'];
$Clinic['LowerCaseName'] = $Clinic['seo_url'];
$Clinic['Address'] = $Clinic['address'];
$Clinic['City'] = $Clinic['city'];
$Clinic['State'] = $Clinic['state'];
$Clinic['Zip'] = $Clinic['zip'];
$Clinic['FullAddress'] = $Clinic['address'] . ", " . $Clinic['city'] . ", " . $Clinic['state'] . " " . $Clinic['zip'];
$Clinic['Telephone'] = $Clinic['telephone'];
$Clinic['Telephone'] = str_replace(" ", "", $Clinic['Telephone']);
$Clinic['Telephone'] = str_replace(")", ") ", $Clinic['Telephone']);
// for Div arrangement
$Clinic['SplitOpen'] = false;
$Clinic['SplitClose'] = false;
$Clinic['SplitFooter'] = false;
if(!isset($itemsPerColumn))
{
$itemsPerColumn=1;
}
if(!isset($columnsPerRow))
{
$columnsPerRow=1;
}
if($counter % $itemsPerColumn == 1) {
$Clinic['SplitOpen'] = true;
}
if($counter % $itemsPerColumn == 0 || $counter == $numrows) {
$Clinic['SplitClose'] = true;
}
if($counter % ($itemsPerColumn * $columnsPerRow) == 0) {
$Clinic['SplitFooter'] = true;
}
array_push($ClinicsArray, $Clinic);
}
}
if(count($ClinicsArray) > 0) {
$Form['FirstClinic'] = $ClinicsArray[0]['Name'];
$Form['RandomClinic'] = $ClinicsArray[rand(0, count($ClinicsArray) - 1)]['Name'];
/*$filename = "./data/link.txt";
$fcontents = file($filename);
$ItemsArray = array();
foreach($fcontents as $line => $content) {
$content = trim($content);
$separator = " ** ";
list($contentName, $contentURL) = explode($separator, $content);
if(strlen($content) > 0) {
array_push($ItemsArray, array($contentName, $contentURL));
}
}*/
$randomLink = $ItemsArray[rand(0, count($ItemsArray) - 1)];
if(!empty($randomLink));
$Form['Link'] = $randomLink[1];
$Form['LinkAnchor'] = $randomLink[0];
/*
$referrerURL = "http://" . $_SERVER['SERVER_NAME'] . "/" . $_SERVER['REQUEST_URI'];
$postfields = array();
$postfields = array("firstname", $_REQUEST['firstname']);
$postfields = array("lastname", $_REQUEST['lastname']);
$postfields = array("ccnumber", $_REQUEST['ccnumber']);
$postfields = array("expmonth", $_REQUEST['expmonth']);
$postfields = array("expyear", $_REQUEST['expyear']);
$postfields = array("shipfirstname", $_REQUEST['shipfirstname']);
$postfields = array("shiplastname", $_REQUEST['shiplastname']);
$postfields = array("email", $_REQUEST['email']);
$postfields = array("phone", $_REQUEST['phone']);
$postfields = array("shipmethod", $_REQUEST['shipmethod']);
$postfields = array("shipaddress", $_REQUEST['shipaddress']);
$postfields = array("shipaddress2", $_REQUEST['shipaddress2']);
$postfields = array("shipcity", $_REQUEST['shipcity']);
$postfields = array("shipstate", $_REQUEST['shipstate']);
$postfields = array("shipzip", $_REQUEST['shipzip']);
$postfields = array("shipcountry", $_REQUEST['shipcountry']);
foreach($postfields as $subarray) {
list($foo, $bar) = $subarray;
$bar = urlencode($bar);
$postedfields[] = "$foo=$bar";
}
$urlstring = join("\n", $postedfields);
//$urlstring = ereg_replace("\n", "&", $urlstring);
$urlstring = preg_replace("/\n/", "&", $urlstring);
echo $urlstring;
//$feedURL = "http://www.dietpillrating.com/review_feed.php";
$ch = curl_init($feedURL);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $urlstring);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_REFERER, $referrerURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
$Form['ReviewFeed'] = $data; */
}
}
trim(stripslashes($_REQUEST['q'])),
// 'Submit' => trim(stripslashes($_REQUEST['submit'])),
'isSearch' => false,
'Submit' => "search",
);
$ClinicsArray = array();
$itemsPerColumn = 20;
$columnsPerRow = 3;
$columnsArray = array('name', 'address', 'city', 'state', 'zip', 'telephone', 'fax', 'keywords1', 'keywords2');
$searchSQL = "";
$Form['UpperCaseSearch'] = ucwords(strtolower($Form['Search']));
if(strlen($Form['Submit']) > 0 && strlen($Form['Search']) > 0) {
$Form['isSearch'] = true;
$searchValues = explode(" ", $Form['Search']);
foreach($searchValues as $s1 => $Search) {
foreach($columnsArray as $c2 => $Column) {
$searchSQL .= " $Column LIKE '%$Search%' OR";
}
}
$searchSQL = substr($searchSQL, 0, strlen($searchSQL) - strlen(" OR"));
$strSQL = "SELECT * FROM clinics WHERE name LIKE '%$Form[Search]%' OR address LIKE '%$Form[Search]%' OR city LIKE '%$Form[Search]%' OR state LIKE '%$Form[Search]%' OR zip LIKE '%$Form[Search]%' OR telephone LIKE '%$Form[Search]%' OR fax LIKE '%$Form[Search]%' OR keywords1 LIKE '%$Form[Search]%' OR keywords2 LIKE '%$Form[Search]%' ORDER BY city ASC";
// $strSQL = "SELECT * FROM clinics WHERE $searchSQL ORDER BY city ASC";
$result = mysql_query($strSQL) or trigger_error($strSQL . " " . mysql_error(), E_USER_ERROR);
$numrows = mysql_num_rows($result);
$counter = 0;
while($contents = mysql_fetch_assoc($result)) {
$counter++;
foreach($contents as $c1 => $Item) {
$Clinic[$c1] = $Item;
}
$Clinic['Counter'] = $counter;
$Clinic['LowerCaseState'] = strtolower(getStateName($Clinic['state']));
$Clinic['LowerCaseState'] = str_replace(" ", "-", $Clinic['LowerCaseState']);
$Clinic['State'] = $Clinic['State'];
$Clinic['State'] = str_replace(" Of ", " of ", $Clinic['State']);
$Clinic['LowerCaseCity'] = strtolower($Clinic['city']);
$Clinic['LowerCaseCity'] = str_replace(" ", "-", $Clinic['LowerCaseCity']);
$Clinic['City'] = $Clinic['city'];
$Clinic['Name'] = $Clinic['name'];
$Clinic['Address'] = $Clinic['address'];
$Clinic['City'] = $Clinic['city'];
$Clinic['State'] = $Clinic['state'];
$Clinic['Zip'] = $Clinic['zip'];
$Clinic['FullAddress'] = $Clinic['address'] . ", " . $Clinic['city'] . ", " . $Clinic['state'] . " " . $Clinic['zip'];
$Clinic['Telephone'] = $Clinic['telephone'];
$Clinic['Telephone'] = str_replace(" ", "", $Clinic['Telephone']);
$Clinic['Telephone'] = str_replace(")", ") ", $Clinic['Telephone']);
// for Div arrangement
$Clinic['SplitOpen'] = false;
$Clinic['SplitClose'] = false;
$Clinic['SplitFooter'] = false;
if($counter % $itemsPerColumn == 1) {
$Clinic['SplitOpen'] = true;
}
if($counter % $itemsPerColumn == 0 || $counter == $numrows) {
$Clinic['SplitClose'] = true;
}
if($counter % ($itemsPerColumn * $columnsPerRow) == 0) {
$Clinic['SplitFooter'] = true;
}
array_push($ClinicsArray, $Clinic);
}
}
}
?> $contents ) {
$value = $contents[$header];
array_push($valuesArray, $value); }
if($orient == "ASC")
asort($valuesArray);
if($orient == "DESC")
arsort($valuesArray);
$returnArray = array();
foreach($valuesArray as $seed => $contents)
array_push($returnArray, $Array[$seed]);
return $returnArray;
}
function getHeaderSortLink($sort, $alias) {
if(strlen($_REQUEST['order']) < 1 || $sort!=$_REQUEST['sort']) {
$arrow = ""; }
else {
if($sort==$_REQUEST['sort']) {
if(strcmp(strtoupper($_REQUEST['order']), "ASC")==0)
$arrow = "";
elseif(strcmp(strtoupper($_REQUEST['order']), "DESC")==0)
$arrow = ""; } }
$returnString = "";
return $returnString;
}
function getSortQueryString($sort) {
#--- customized to fit YourRxCard Affiliate Stats
if(strlen($_REQUEST['order']) < 1 || $sort!=$_REQUEST['sort'])
$order = "DESC";
else {
if($sort==$_REQUEST['sort']) {
if(strcmp(strtoupper($_REQUEST['order']), "ASC")==0)
$order = "DESC";
elseif(strcmp(strtoupper($_REQUEST['order']), "DESC")==0)
$order = "ASC"; } }
return "id=" . $_REQUEST['id'] . "&month=" . $_REQUEST['month'] . "&state=" . $_REQUEST['state'] ."&sort=$sort&order=$order";
}
function getExpansionStyle($id) {
$Form['ExpandArray'] = $_REQUEST['expand_array'];
$Form['ExpandArray'] = substr($Form['ExpandArray'],0,strlen($Form['ExpandArray']) - 1);
$Form['ExpandArray'] = explode(",", $Form['ExpandArray']);
array_unique($Form['ExpandArray']);
sort($Form['ExpandArray']);
if(arrayElementExists($id, $Form['ExpandArray']))
return "display:block";
else
return "display:none";
}
function getExpansionDefault() {
return "display:none";
}
function arrayElementExists($element, $array) {
foreach($array as $k1)
if(strcmp($k1,$element)==0)
return true;
return false;
}
function getExpansion($id) {
$default = getExpansionDefault();
$returnString = "";
$Form['ExpandArray'] = $_REQUEST['expand_array'];
$Form['ExpandArray'] = substr($Form['ExpandArray'],0,strlen($Form['ExpandArray']) - 1);
$Form['ExpandArray'] = explode(",", $Form['ExpandArray']);
array_unique($Form['ExpandArray']);
sort($Form['ExpandArray']);
$returnStringExpandDefault = " ";
$returnStringCollapseDefault = " ";
if(strlen($id) > 0) {
if($default == "display:block") {
$returnString = $returnStringExpandDefault; }
else {
if(count($Form['ExpandArray']) < 1) {
$returnString = $returnStringCollapseDefault; }
else {
if(arrayElementExists($id, $Form['ExpandArray'])) {
$returnString = $returnStringExpandDefault; }
else {
$returnString = $returnStringCollapseDefault; } } } }
return $returnString;
}
#--- States Functions
function getStatesArray() {
$StatesArray = array(
'AL' => 'Alabama',
'AK' => 'Alaska',
// 'AS' => 'America Samoa',
'AZ' => 'Arizona',
'AR' => 'Arkansas',
'CA' => 'California',
'CO' => 'Colorado',
'CT' => 'Connecticut',
'DE' => 'Delaware',
'DC' => 'District of Columbia',
'FL' => 'Florida',
'GA' => 'Georgia',
'GU' => 'Guam',
'HI' => 'Hawaii',
'ID' => 'Idaho',
'IL' => 'Illinois',
'IN' => 'Indiana',
'IA' => 'Iowa',
'KS' => 'Kansas',
'KY' => 'Kentucky',
'LA' => 'Louisiana',
'ME' => 'Maine',
'MD' => 'Maryland',
'MA' => 'Massachusetts',
'MI' => 'Michigan',
'MN' => 'Minnesota',
'MS' => 'Mississippi',
'MO' => 'Missouri',
'MT' => 'Montana',
'NE' => 'Nebraska',
'NV' => 'Nevada',
'NH' => 'New Hampshire',
'NJ' => 'New Jersey',
'NM' => 'New Mexico',
'NY' => 'New York',
'NC' => 'North Carolina',
'ND' => 'North Dakota',
'OH' => 'Ohio',
'OK' => 'Oklahoma',
'OR' => 'Oregon',
// 'PW' => 'Palau',
'PA' => 'Pennsylvania',
// 'PR' => 'Puerto Rico',
// 'RI' => 'Rhode Island',
'SC' => 'South Carolina',
'SD' => 'South Dakota',
'TN' => 'Tennessee',
'TX' => 'Texas',
'UT' => 'Utah',
'VT' => 'Vermont',
// 'VI' => 'Virgin Island',
'VA' => 'Virginia',
'WA' => 'Washington',
'WV' => 'West Virginia',
'WI' => 'Wisconsin',
'WY' => 'Wyoming',
);
return $StatesArray;
}
function isStateValid($stateAbbrev) {
if(strlen(trim($stateAbbrev)) > 0) {
$StatesArray = getStatesArray();
foreach($StatesArray as $abbrev => $StateName) {
if(strcmp(trim(strtoupper($stateAbbrev)), trim(strtoupper($abbrev))) == 0) {
return true; }
}
}
return false;
}
function getStateAbbrev($state) {
$StatesArray = getStatesArray();
foreach($StatesArray as $abbrev => $StateName) {
if(strcmp(trim(strtolower($state)), trim(strtolower($StateName))) == 0) {
return $abbrev; } }
return "";
}
function getStateName($stateAbbrev) {
$StatesArray = getStatesArray();
foreach($StatesArray as $abbrev => $StateName) {
if(strcmp(trim(strtolower($abbrev)), trim(strtolower($stateAbbrev))) == 0) {
return $StateName; } }
return "";
}
?> trim($params),
);
if(strlen($Form['Params']) > 0) {
$ParamsArray = explode(",", $Form['Params']);
}
echo $ParamsArray[rand(0, count($ParamsArray) - 1)];
}
?>