<?PHP 

include("config.php");

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

// Query to fetch non-validated races:
$results = mysql_query("SELECT * FROM ".$prefix.$main_table." WHERE ".$field_lead."valid=0 ORDER BY ".$field_lead."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: ".$local_name." 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">
              <h1>Unvalidated <? echo ($local_name); ?></h1>
              <form method="post" action="validate_X.php"  enctype="multipart/form-data">
                <?
                if($none == TRUE){
                  echo "<p>There are no ".$local_name_lc." waiting to be validated.</p>";
                }
                ?>
                <div class="dtable form">
                <? while($row = mysql_fetch_array($results)) { ?>
                  <div class="drow">
                    <div class="dcell name">Name</div>
                    <div class="dcell divider"></div>
                    <div class="dcell value">
                      <a href="<? echo ("individual.php?".$field_lead."id=".$row[''.$field_lead.'id'].""); ?>"><? echo $row[''.$field_lead.'name']; ?></a>
                    </div>
                  </div>
                  <div class="drow">
                    <div class="dcell name">Address</div>
                    <div class="dcell divider"></div>
                    <div class="dcell value">
  <? 
		echo ($row[''.$field_lead.'address']); 
		if($row[''.$field_lead.'address_two']) { 
			echo ("<br />".$row[''.$field_lead.'address_two']); 
		} 
		echo("<br />".$row[''.$field_lead.'city'].", ".$row[''.$field_lead.'state']." ".$row[''.$field_lead.'zip']); 
	?>
                    </div>
                  </div>
                  <div class="drow">
                    <div class="dcell name">Phone</div>
                    <div class="dcell divider"></div>
                    <div class="dcell value">
  <? 
		echo ($row[''.$field_lead.'phone']."<br />Fax/Alt Phone: ". $row[''.$field_lead.'fax']."");
	?>
                    </div>
                  </div>
                  <div class="drow">
                    <div class="dcell name">E-mail</div>
                    <div class="dcell divider"></div>
                    <div class="dcell value">
		                  <? echo "<a href='mailto:".$row[''.$field_lead.'email']."'>".$row[''.$field_lead.'email']."</a>"; ?>
                    </div>
                  </div>
                  <div class="drow">
                    <div class="dcell name">Website</div>
                    <div class="dcell divider"></div>
                    <div class="dcell value">
			                <? echo "<a href='".$row[''.$field_lead.'website']."' target='_blank'>".$row[''.$field_lead.'website']."</a>"; ?>
                    </div>
                  </div>
                  <div class="drow">
                    <div class="dcell name"></div>
                    <div class="dcell divider"></div>
                    <div class="dcell value">
			                <input type="checkbox" value="<? echo($row[''.$field_lead.'id']); ?>" name="validate[]"> Validate this <? echo $local_singular_lc; ?>. <input type="checkbox" value="<? echo($row[''.$field_lead.'id']); ?>" name="delete[]"> Delete this <? echo $local_singular_lc; ?>.
                    </div>
                  </div>
                  <? } ?>
                </div>
                
                <div class="btn-wrapper"><input type="submit" value="Validate Selected <? echo ($local_name); ?>" class="btn"></div>
              </form>
            </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>
