<?PHP 

include("config.php");

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

// Query to fetch non-validated races:
$results = mysql_query("SELECT triclub_id, triclub_name, triclub_address, triclub_address_two, triclub_city, triclub_state, triclub_zip, triclub_email, triclub_website FROM ".$prefix."Triclubs WHERE triclub_valid=0 ORDER BY triclub_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: Triclub 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 Triclubs</strong></h1>
                <form method="post" action="validate_X.php"  enctype="multipart/form-data">
                    <?
                    if($none == TRUE){
                    echo "There are no triclubs 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?triclub_id=$row[triclub_id]"; ?>"><? echo $row[triclub_name]; ?></a></div></div>
                    <div class="drow"><div class="dcell"><strong class="indent">Address:</strong> <? echo ("$row[triclub_address]"); if($row[triclub_address_two]) { echo ("<br /><span class='indent'>$row[triclub_address_two]</span>"); } echo("<br /><span class='indent'>$row[triclub_city], $row[triclub_state] $row[triclub_zip]</span>"); ?></div></div>
                    <div class="drow"><div class="dcell">
                        <strong>Email:</strong> <? echo "<a href='mailto:$row[triclub_email]'>$row[triclub_email]</a>"; ?><br />
                        <strong>Website:</strong> <? echo "<a href='$row[triclub_website]' target='_blank'>$row[triclub_website]</a>"; ?>
                        <br>
                        <a class="nav" href="<? echo "individual.php?triclub_id=$row[triclub_id]"; ?>">More information</a>
                        <br /><input type="checkbox" value="<? echo($row[triclub_id]); ?>" name="validate[]"> Validate this triclub. <input type="checkbox" value="<? echo($row[triclub_id]); ?>" name="delete[]"> Delete this triclub.
                    </div></div>
                    <? } ?>
                    </div>
                    <input type="submit" value="Validate Selected Triclubs" 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>
