<?php $GLOBALS['SEP_DISABLED'] = 1; ?>
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
  // This version uses media checkbox and is a temporaary fix
    if (!defined('START_SESSION')) { define('START_SESSION', true); }
  // load viewer library
  $libraryPath = 'cmsAdmin/lib/viewer_functions.php';
  $dirsToCheck = array('/hsphere/local/home/a887307/elleschorrphotography.com/','','../','../../','../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }
  
//Get the current CMS users details
  $CMS_USER = getCurrentUserFromCMS(); 
  
  //redirect the browser if no user is currently logged into the back end
  if (!@$CMS_USER['num']){ 
    session_unset();
    redirectBrowserToUrl("http://elleschorrphotography.com/cmsAdmin/admin.php?redirectUrl=" . $_SERVER['REQUEST_URI']);
    exit;
  }
  
?>
<?php   if(@$_REQUEST['salon']  && @!$_REQUEST['month'] && @!$_REQUEST['year']){
    @$_REQUEST['salon_name_keyword'] = $_REQUEST['salon'];
  } ?>

<?php   if(@$_REQUEST['salon'] && $_REQUEST['salon'] == 'AWC' && @$_REQUEST['month'] && @$_REQUEST['year']){
    @$_REQUEST['awc_attended_keyword'] = $_REQUEST['month'].'-'.$_REQUEST['year'];
  } ?>
  
<?php   if(@$_REQUEST['salon'] && $_REQUEST['salon'] == 'MMM' && @$_REQUEST['month'] && @$_REQUEST['year']){
    @$_REQUEST['mmm_attended_keyword'] = $_REQUEST['month'].'-'.$_REQUEST['year'];
  } ?>
 
<?php
  // load records
  list($salon_listingsRecords, $salon_listingsMetaData) = getRecords(array(
    'tableName'   => 'salon_listings',
	
  ));
  
  list($common_informationRecords, $common_informationMetaData) = getRecords(array(
    'tableName'   => 'common_information',

    'limit'       => '1',
  ));
  
  $common_informationRecord = @$common_informationRecords[0]; // get first record
  
 // load records
  list($google_font_namesRecords, $google_font_namesMetaData) = getRecords(array(
    'tableName'   => 'google_font_names',
  ));
  
  ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>E L L E &nbsp; S C H O R R &nbsp; P H O T O G R A P H Y</title>
<link rel="shortcut icon" type="image/ico" href="/favicon.ico" />
<meta name="robots" content="noindex,nofollow" />
<link rel="stylesheet" type="text/css" media="screen" href="css/style.css.php" />
<link rel="stylesheet" type="text/css" href="css/fonts.css.php" />
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=<?php 
    $output = ''; 
    foreach ($google_font_namesRecords as $record) { $record['name'] = preg_replace("/[, ]/", "+", $record['name']);
      $output .= $record['name'] . "|"; 
    } 
    $output = rtrim($output,"|"); // remove trailing pipe 
    print $output; 
?>">
<style type="text/css">
table.email {
	border-width: 1px;
	border-spacing: 1px;
	border-style: solid;
 border-color: #<?php echo $common_informationRecord['horizontal_line_color'] ?>;
	border-collapse: collapse;
}
table.email tr {
	border-width: 1px;
	padding: 1px;
	border-style: solid;
 border-color: #<?php echo $common_informationRecord['horizontal_line_color'] ?>;
}
table.email td {
	border-width: 1px;
	padding: 1px;
	border-style: solid;
 border-color: #<?php echo $common_informationRecord['horizontal_line_color'] ?>;
}
</style>
</head>

<body style="font-family:Verdana, Geneva, sans-serif" >

      <table align="center" width="100%" border="0">
        <tr>
          <td><a class="special" href="http://elleschorrphotography.com/cmsAdmin/admin.php?action=logoff">Click Here to Log Out</a><br />
            <br /></td>
        </tr>
        <tr>
          <td align="right" valign="top"><form method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>">
       
		 <?php 
//Create an array to store the values that have been selected
$selectArray = array(); 
//foreach section item
foreach($salon_listingsRecords as $record){ 
  //If the record has something selected for the "salon_name" category
  if(@$record['salon_name']){    //If the selected value isn't already in the array
    if(!in_array(@$record['salon_name'],$selectArray)){ 
      //Add it to the $selectArray
      $selectArray[$record['salon_name']] = $record['salon_name']; 
    }
  } 
}
?>      
              <?php
  $lowestYear = 2000;
  $highestYear = date("Y");
  ?>
             <select name="salon">
             <option value="">Choose The Salon To Display</option>
                <<?php foreach ($selectArray as $value => $name): ?>
    <option value="<?php echo $value; ?>"><?php echo $name; ?></option>
  <?php endforeach; ?>
              </select> 
              <select name="month">
                <option value="">Choose a Month to Display</option>
                <?php foreach(range(1,12) as $month): ?>
                <?php $timeValue = strtotime("2012-$month"); ?>
                <option value="<?php echo date("m",$timeValue);?>"><?php echo date("F",$timeValue);?></option>
                <?php endforeach ?>
              </select>
          
              <select name="year">
                <option value="">Choose a Year to Display</option>
                <?php foreach (range($highestYear,$lowestYear) as $year):?>
                <option value="<?php echo substr($year, -2);?>" ><?php echo $year;?></option>
                <?php endforeach?>
              </select>
              <input type="submit" name="submit" value="Search">
            </form><br />
            <FORM ACTION="">
              <INPUT TYPE="submit" VALUE="Cancel Search Filters">
            </FORM><br />
            </td>
        </tr>
      </table>
      <p></p>
      <div align="center" class="copyright"><br/>
        <b>
        <?php if(@$_REQUEST):?>
       YOUR FILTERED 
        <?php elseif(@$_REQUEST =="") :?>
       THE FULL
        <?php else : ?>
        THE FULL
        <?PHP endif; ?>
        EMAIL ADDRESS LIST<br /><?php if(@$_REQUEST):?>This list is filtered to only show attendees to <?php echo(@$_REQUEST['salon']) ;?><?php if(@$_REQUEST['month']):?> on <?php echo(@$_REQUEST['month']) ;?>-<?php echo(@$_REQUEST['year']) ;?><?PHP endif; ?><br /><?PHP endif; ?>(Not Including Contacts Who Have Requested Removal)</b><br />
        Note: Attendees may have attended other salons in addition to the filtered choice.<br />
        <br />
      </div>
      <hr  color="#<?php echo $common_informationRecord['horizontal_line_color'] ?>" />
      <br />
           </td>
  </tr>
</table>

</body>
</html>