get product id // and if present and non-zero then // forward to product page $product_id=intval($_GET[productid]); if($product_id) { $q_prod="select ItemID from dd_catalog WHERE (ItemID='$product_id') LIMIT 1"; $r_prod=mysql_query($q_prod); if(($r_prod) && mysql_num_rows($r_prod)) { //--> product exists, forward to seo product url $seo_prod_url=seo_product_url($product_id); //--> redirect header("Location: $seo_prod_url"); } // end if } // end if, check product redirect $q1 = "select * from dd_catalog, dd_categories where dd_catalog.ItemCategory = dd_categories.CategoryID order by rand() limit 0,1"; $r1 = mysql_query($q1) or die(mysql_error()); include_once('templates/HeaderTemplate.php'); include_once('templates/IndexTemplate.php'); include_once('templates/FooterTemplate.php'); ?>