session_start();
include('connection.php');
//clean up tag
if (isset($_GET["tag"]) && $_GET["tag"]!='' && !ctype_alnum($_GET["tag"])) {
$tag = mysql_real_escape_string($_GET["tag"]);
$tag = ereg_replace("[^A-Za-z0-9]", "", $tag);
header( 'Location: http://www.saberz.com/reviews.php?tag='.$tag ) ;
exit;
}
if (isset($_GET["tag"]) && $_GET["tag"]!='') {
$tag = mysql_real_escape_string($_GET["tag"]);
$tag = ereg_replace("[^A-Za-z0-9]", "", $tag);
if ($_REQUEST["cr"]) {
$cr = '';
}
else {
$cr = 'desc';
}
$query="SELECT * FROM saberz_pages WHERE live AND MATCH (title, tags) AGAINST ('$tag' IN BOOLEAN MODE) ORDER BY date ".$cr;
$result=mysql_query($query);
$num=mysql_num_rows($result);
if ($num == 1) {
//only one hit, redirect to it
$id1 = mysql_result($result,0,'id');
header( 'Location: http://www.saberz.com/articles.php?id='.$id1 ) ;
exit;
}
unset($query);
unset($result);
unset($num);
}
include('header_1.php'); ?>
?>
if (isset($_GET["tag"]) && $_GET["tag"]!='') {
//tag set
$tag = mysql_real_escape_string($_GET["tag"]);
$tag = ereg_replace("[^A-Za-z0-9]", "", $tag);
$query="SELECT * FROM saberz_pages WHERE live AND MATCH (title, tags) AGAINST ('+$tag*' IN BOOLEAN MODE) ORDER BY date ".$cr;
$section_title = "Searching by Tag: "".strtolower($tag).'"';
$num = mysql_num_rows(mysql_query($query));
if ($num > 0) {
$section_desc = '
Cancel tag search to view all reviews and features. ';
}
else {
$section_desc = 'No articles found.
Cancel tag search to view all reviews and features. ';
}
}
else {
//no tags set
$query="SELECT * FROM saberz_pages WHERE live AND feature ORDER BY date DESC";
$section_title = "Articles & Reviews";
$section_desc = "In-depth reviews of triathlon equipment, first looks, special features, and industry news. ";
}
$id='';
$tags='';
$inc=12;
$showHeader = true;
$showTagIndex = true;
$limit = -1;
$offset = 0;
index($id, $tags, $inc, $query, $showHeader, $showTagIndex, $section_title, $section_desc, $limit, $offset);
?>