<?PHP 

include("config.php");

if(!is_admin($user)){
  header('Location:'.$site_url.'/');
}

// Query to fetch non-validated races:
$results = mysql_query("SELECT fitter_id, fitter_name, fitter_address, fitter_address_two, fitter_city, fitter_state, fitter_phone, fitter_fax, fitter_zip, fitter_email, fitter_website FROM ".$prefix."Fitters WHERE fitter_valid=0 ORDER BY fitter_name ASC");

// check to see if set is empty
$none = FALSE;
if (mysql_num_rows($results) == 0) { $none = TRUE; }

// set the page title
$pagetitle = "Admin: Fitter Validation";

// set meta tags
$meta_keywords = "";
$meta_description = "";
?>

<? include("include_common_head.php"); ?>

<body class="listings">
  <? include($common_path . "/ads/ad_wallpaper.html"); ?>

  <div class="container">
    <? include($common_path . "/templates/include_header.php"); ?>
    <div class="main">
      <div class="contentwrapper clearfix">
        <? include("include_breadcrumb.php"); ?>

        <section class="section listings section-has-widgets">
          <div class="sidebar-b">
            <? include("include_sidebar.php"); ?>
          </div>

          <div class="content content-has-widgets">
            <div class="grid">

              <div class="clearfix">
                <h1 class="content-title"><strong>Unvalidated Fitters</strong></h1>
                <form method="post" action="validate_X.php"  enctype="multipart/form-data">
                    <?
                    if($none == TRUE){
                    echo "There are no fitters waiting to be validated.";
                    }
                    ?>
                    <div class="dtable">
                    <? 
                    while($row = mysql_fetch_array($results)){
                    ?>
                    <div class="drow"><div class="dcell"><a class="sub-hdr" style="margin-left: 5px;" href="<? echo "individual.php?fitter_id=$row[fitter_id]"; ?>"><? echo $row[fitter_name]; ?></a></div></div>
                    <div class="drow"><div class="dcell">Address: <? echo ("$row[fitter_address]"); if($row[fitter_address_two]) { echo ("<br /><span class='indent'>$row[fitter_address_two]</span>"); } echo("<br /><span class='indent'>$row[fitter_city], $row[fitter_state] $row[fitter_zip]</span>"); ?></div></div>
                    <div class="drow"><div class="dcell">
                    <? 

                    echo "Phone: $row[fitter_phone]<br /><strong class='indent'>Fax/Alt Phone: </strong> $row[fitter_fax]";

                    ?>
                    </div></div>
                    <div class="drow"><div class="dcell">
                        <strong>Email:</strong> <? echo "<a href='mailto:$row[fitter_email]'>$row[fitter_email]</a>"; ?><br />
                        <strong>Website:</strong> <? echo "<a href='$row[fitter_website]' target='_blank'>$row[fitter_website]</a>"; ?>
                        <br>
                        <a class="nav" href="<? echo "individual.php?fitter_id=$row[fitter_id]"; ?>">More information</a>
                        <br /><input type="checkbox" value="<? echo($row[fitter_id]); ?>" name="validate[]"> Validate this fitter. <input type="checkbox" value="<? echo($row[fitter_id]); ?>" name="delete[]"> Delete this fitter.<br />
                    </div></div>
                    <? } ?>
                    </div>
                    <input type="submit" value="Validate Selected Fitters" class="btn">
                </form>
                
              </div><!-- end col-2/3 -->

            </div><!-- end grid -->
          </div><!-- end content -->
        </section>


      </div><!-- end contentwrapper -->
    </div> <!-- end main -->

  <? include($common_path . "/templates/include_footer.php") ?>
  </div> <!-- container  -->
</body>
<? include($common_path . "/templates/include_global_js.php") ?>
</html>