<?PHP 

include("config.php");

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

// Query to fetch non-validated races:
$results = mysql_query("SELECT retailer_id, retailer_name, retailer_address, retailer_address_two, retailer_city, retailer_state, retailer_zip, retailer_phone, retailer_fax, retailer_email, retailer_website, retailer_cart FROM gforum_Retailers WHERE retailer_valid=0 ORDER BY retailer_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: Retailer 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 section-static remove-sidebar">
          <div class="sidebar-b">
            <? include("include_sidebar.php"); ?>
          </div>

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

              <div class="clearfix">

                <h1><strong>Unvalidated Retailers</strong></h1>
                <form method="post" action="validate_X.php"  enctype="multipart/form-data">
                    <?
                    if($none == TRUE){
                    echo "There are no retailers waiting to be validated.";
                    }
                    ?>
                    <div class="dtable">
                    <? while($row = mysql_fetch_array($results)){ ?>
                        <div class="drow">
                            <div class="dcell">Shop Name:
                                <a href="<? echo "individual.php?retailer_id=$row[retailer_id]"; ?>"><? echo $row[retailer_name]; ?></a>
                            </div>
                        </div>
                        <div class="drow">
                            <div class="dcell">Address: 
                                <? echo ("$row[retailer_address]"); if($row[retailer_address_two]) { echo ("<br /><span class='indent'>$row[retailer_address_two]</span>"); } echo("<br /><span class='indent'>$row[retailer_city], $row[retailer_state] $row[retailer_zip]</span>"); ?>
                            </div>
                        </div>
                        <div class="drow">
                            <div class="dcell">Phone:
                                <? echo $row[retailer_phone] ?>
                            </div>
                        </div>
                        <div class="drow">
                            <div class="dcell">Fax:
                                <? echo $row[retailer_fax] ?>
                            </div>
                        </div>
                        <div class="drow">
                            <div class="dcell">E-mail:
                                <? echo "<a href='mailto:$row[retailer_email]'>$row[retailer_email]</a>"; ?>
                            </div>
                        </div>
                        <div class="drow">
                            <div class="dcell">Website: 
                                <? echo "<a href='$row[retailer_website]' target='_blank'>$row[retailer_website]</a>"; ?> <? if ($row[retailer_cart] == 1) { echo ("**eCommerce Shopping Cart**"); } ?>
                            </div>
                        </div>
                        <div class="drow">
                            <div class="dcell">
                                <a class="nav" href="<? echo "individual.php?retailer_id=$row[retailer_id]"; ?>">More information</a>
                                <br /><input type="checkbox" value="<? echo($row[retailer_id]); ?>" name="validate[]"> Validate this retailer. <input type="checkbox" value="<? echo($row[retailer_id]); ?>" name="delete[]"> Delete this retailer.
                            </div>
                        </div>
                        <? } ?>
                        </div>
                        <input type="submit" value="Validate Selected Retailers" class="btn">
                    </div>
                </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>