<?php

	require_once("../include/config.php");	
	require_once("../include/startup.php");
	
	$obj  = new Product();

if($G_memberid > 0)
{	
	$memberid = $G_memberid;
	$membercompanyid= $G_membercompanyid;
	 $memberuserscompanyid = $G_memberuserscompanyid;
	if($memberuserscompanyid > 0)
	{

		$sqltext = "Select * from mstproducts  where isdeleted = 0 and memberid = $memberid  and membercompanyid=$membercompanyid order by Product_ID asc";
	}
	else
	{
		$sqltext = "Select * from mstproducts  where isdeleted = 0 and memberid = $memberid order by Product_ID asc";	
	}
	//echo $sqltext;
	
	$productlist = $obj-> getProduct('',$sqltext);
	
	$rowcount =count($productlist);
	
	//echo "<pre>";
	//print_r($productlist);
	require_once("header1.html");
	require_once("leftnav.html");
	require_once("view_products1.html");
	require_once("footer1.html");
}
else if (!headers_sent($filename, $linenum)) 
{
				$redirect_url = DOC_ROOT."login.php";
				header("Location: $redirect_url");
    				exit;
					// You would most likely trigger an error here.
}
else 
{
				echo "Headers already sent in $filename on line $linenum\n" .
          			"Cannot redirect, for now please click this <a ";
    				exit;
}   
?>
