<?PHP 

include("config.php");

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

// Query to fetch non-validated races:
$results = mysql_query("SELECT runshop_id, runshop_name, runshop_address, runshop_address_two, runshop_city, runshop_state, runshop_zip, runshop_phone, runshop_fax, runshop_email, runshop_website, runshop_cart FROM ".$prefix."Runshops WHERE runshop_valid=0 ORDER BY runshop_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: Running Store 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>Unvalidated Running Stores</h1>
                <hr />

                <form method="post" action="validate_X.php"  enctype="multipart/form-data">
                  <p>
                    <?
                    if($none == TRUE){
                      echo "There are no running stores waiting to be validated.";
                    }
                    ?>
                  </p>

                  <div class="dtable">
                  <? while($row = mysql_fetch_array($results)) { ?>
                    <div class="drow"><div class="dcell"><a ref="<? echo "individual.php?runshop_id=$row[runshop_id]"; ?>"><? echo $row[runshop_name]; ?></a></div></div>
                    <div class="drow"><div class="dcell">Address: <? echo ("$row[runshop_address]"); if($row[runshop_address_two]) { echo ("<br /><span class='indent'>$row[runshop_address_two]</span>"); } echo("<br /><span class='indent'>$row[runshop_city], $row[runshop_state] $row[runshop_zip]</span>"); ?></div></div>
                    <div class="drow">
                      <div class="dcell">
                        <? 
                        echo "Phone: </strong>$row[runshop_phone]<br /><strong class='indent'>Fax: </strong> $row[runshop_fax]";
                        ?>
                      </div>
                    </div>
                    <div class="drow">
                      <div class="dcell">
                        <strong>Email:</strong> <? echo "<a href='mailto:$row[runshop_email]'>$row[runshop_email]</a>"; ?><br />
                        <strong>Website:</strong> <? echo "<a href='$row[runshop_website]' target='_blank'>$row[runshop_website]</a>"; ?> <? if ($row[runshop_cart] == 1) { echo ("**eCommerce Shopping Cart**"); } ?><br />
                        <a class="nav" href="<? echo "individual.php?runshop_id=$row[runshop_id]"; ?>">More information</a><br />
                        <input type="checkbox" value="<? echo($row[runshop_id]); ?>" name="validate[]"> Validate this running store.
                        <input type="checkbox" value="<? echo($row[runshop_id]); ?>" name="delete[]"> Delete this running store.
                      </div>
                    </div>
                  <? } ?>
                  </div>
                  <br />
                  <input type="submit" value="Validate Selected Running Stores" 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>

