session_start();
if($_SESSION['filedata'] != "get")
{
header('HTTP/1.1 403 Forbidden');
exit();
}
// -----------------------------------------------------------------------------
if(
$Table_Name == "Company_Site" ||
$Table_Name == "Web_Connection" ||
$Table_Name == "Company_Site_Function" ||
$Table_Name == "Site_Banner" ||
$Table_Name == "Product_Site_Classify" ||
$Table_Name == "Product" ||
$Table_Name == "Product_Other_Image" ||
$Table_Name == "Product_Site_Classify_Images") {
//not to do
} else {
exit;
}
$Product_SN = intval($Product_SN);
// -----------------------------------------------------------------------------
include ("../../configure.php");
$link=mysql_connect($hostname,$username,$password);
mysql_query("SET NAMES 'UTF8'", $link);
mysql_select_db($dbname,$link) ;
class Recordset
{
var $Result ;
var $RecordCount ;
var $Position ;
var $EOF ;
var $PageSize ;
function Recordset( $SQL )
{
$this->Result = mysql_query( $SQL ) ;
$this->RecordCount = mysql_num_rows( $this->Result ) ;
$this->Position = 0 ;
$this->PageSize = -1 ;
$this->EOF = ( $this->RecordCount == 0 ) ? true : false ;
}
function AbsolutePage( $Page )
{
if( $Page < 1 ) $Page = 1 ;
if( $Page > $this->PageCount() ) $Page = $this->PageCount() ;
$this->Position = $this->PageSize * ( $Page - 1 ) ;
}
function PageCount()
{
$ReturnValue = 0 ;
$ReturnValue = $this->RecordCount / $this->PageSize ;
if( $this->RecordCount % $this->PageSize > 0 ) $ReturnValue ++ ;
return $ReturnValue ;
}
function Move( $Position )
{
$this->Position = $Position ;
if( $this->Position >= $this->RecordCount ) $this->EOF = true ;
}
function MoveNext()
{
$this->Position ++ ;
if( $this->Position >= $this->RecordCount ) $this->EOF = true ;
}
function MoveFirst()
{
$this->Position = 0 ;
if( $this->RecordCount == 0 ) $this->EOF = true ;
else $this->EOF = false ;
}
function Field( $FieldName )
{
if( $this->EOF )
{
return "" ;
}
else
{
return mysql_result( $this->Result , $this->Position , $FieldName ) ;
}
}
function f( $FieldName )
{
return $this->Field( $FieldName ) ;
}
}
$Product_SN = intval($Product_SN);
if($Table_Name == "Product_Other_Image")
{
$fileshow = new Recordset("SELECT $Field_Name,Company_SN FROM $Table_Name left join Product on Product.Product_SN = Product_Other_Image.Product_SN WHERE $Table_SN = $Product_SN") ;
$rs = new Recordset("select Company_NO from Company where Company_SN=" . $fileshow->f("Company_SN"));
$Company_NO = $rs->f("Company_NO");
$company_filea = dirname(dirname(__FILE__)) . "/customer/" . $Company_NO;
}
else
{
$fileshow = new Recordset("SELECT * FROM $Table_Name WHERE $Table_SN = $Product_SN") ;
$rs = new Recordset("select Company_NO from Company where Company_SN=" . $fileshow->f("Company_SN"));
$Company_NO = $rs->f("Company_NO");
$company_filea = dirname(dirname(__FILE__)) . "/customer/" . $Company_NO;
}
if($Table_Name == "Company_Site" || $Table_Name == "Company_Site_Function" || $Table_Name == "Site_Banner")
{
$company_file = $company_filea . "/Company_Site";
//$Field = urlencode($fileshow->Field("$Field_Name"));
$Field = $fileshow->Field("$Field_Name");
//echo("");
//header("Location:../customer/$Company_NO/Company_Site/$Field");
header("Location: http://php2.twinner.com.tw/customer/$Company_NO/Company_Site/$Field");
//echo file_read("$company_file/$Field");
}
else if($Table_Name == "Product_Site_Classify" || $Table_Name == "Product" || $Table_Name == "Product_Other_Image" || $Table_Name == "Product_Site_Classify_Images")
{
$company_file = $company_filea . "/Product";
$Field = $fileshow->Field("$Field_Name");
//$Field = urlencode($fileshow->Field("$Field_Name"));
//header("Location:../customer/$Company_NO/Product/$Field");
header("Location: http://php2.twinner.com.tw/customer/$Company_NO/Product/$Field");
//echo("");
//echo "Location:../customer/$Company_NO/Company_Site/$Field";
//echo file_read("$company_file/$Field");
}
else
{
echo $fileshow->Field("$Field_Name") ;
}
?>