//goods_num : 상품 번호
$good_num = $_GET['pcode'];
$i=0;
$today=$_COOKIE["goods_num"];
$tod2=explode(",", $_COOKIE["goods_num"]); //저장된 쿠키값을 ','로 나누어 배열로 저장
$tod=array_reverse($tod2); //최근 목록 5개를 뽑기 위해 배열을 최신 것부터로 반대로 정렬해준다.
##중복을 막기 위해 최근 5개의 쿠키값 중에 상품 번호가 있는 지 검사하여 있으면 save 값을 no로 설정
while($i<5)
{ //출력할 상품 목록의 수 설정
if($pcode==$tod[$i])
{
$save=no;
}
$i++;
}
##쿠키값이 없을 경우 즉 처음 저장하는 경우
if($_COOKIE["goods_num"]=="")
{
setcookie("goods_num", $_GET["pcode"], time() + 86400,"/");
}
##저장된 쿠키값이 존재하고, 중복된 값이 아닌 경우
if($_COOKIE["goods_num"] != "" & $save != no){
setcookie("goods_num" , $today. "," . $_GET["pcode"] , time() + 86400, "/");
// 기존에 있던 쿠키값에 ','를 붙이고 값을 계속 덧붙여서 저장해준다.
// 11,27,35,47,5 과 같은 형식으로 상품번호가 저장된다.
}
include $_SERVER['DOCUMENT_ROOT']."/form_begin.php";
if($state >= 0) {
if(!$orname && !$orsun) $order = " order by updatetime desc";
else $order = " order by $orname $orsun";
if($menu=="index") {
$result = $dalib->selectSQLAll("select * from $Table[Product] where $kind = '1' $order");
$rnumPN = $result[rnum];
}elseif($menu=="search") {
$result = $dalib->selectSQLAll("select * from $Table[Product] where pname like '%$search%' or pcompany like '%$search%' $order");
$rnumPN = $result[rnum];
}else {
$result = $dalib->selectSQLAll("select * from $Table[Product] where bigcate ='$bigcate' and smcate = '$smcate' $order");
$rnumPN = $result[rnum];
}
if($mode=="prev") {
@mysql_data_seek($result[result],$state);
$r_prev = mysql_fetch_array($result[result]);
$pcode = $r_prev[pcode];
}elseif($mode=="next") {
@mysql_data_seek($result[result],$state);
$r_next = @mysql_fetch_array($result[result]);
$pcode = $r_next[pcode];
}
$prev_state = $state - 1;
$next_state = $state + 1;
}
if($mode=="part"){
if($_GET[company] == "daiwa"){
$_TableP = "fishingas2008.DaiwaProductCode2";
$_TableC = "fishingas2008.DaiwaThirdCategory";
$imgUrl = "daiwapartsinfo/daiwaimages2";
$partMapUrl = "daiwapartsinfo/daiwapartimages2";
}elseif($_GET[company] == "shimano"){
$_TableP = "fishingas2008.ShimanoProductCode";
$_TableC = "fishingas2008.ShimanoThirdCategory";
$imgUrl = "shimanopartsinfo/shimanoimages";
$partMapUrl = "shimanopartsinfo/shimanopartimages2";
}
$r = $dalib->selectSQLField("select * from $_TableC where bigcate ='$bigcate' and smcate='$smcate' and thirdcate='$thirdcate'");
$r2 = $dalib->selectSQLField("select * from $_TableP where pcode='$pcode'");
}else{
$r = $dalib->selectSQLField("select bigcatename from $Table[Bigcategory] where bigcate ='$bigcate'");
$r2 = $dalib->selectSQLField("select smcatename from $Table[Smcategory] where smcate ='$smcate'");
}
$bigcatename = $r[bigcatename];
$smcatename = $r2[smcatename];
if($smcatename=="") $smcatenameTitle = $r2[smcatename];
else $smcatenameTitle = $smcatename;
if($mode=="part"){
$r = $dalib->selectSQLField("select * from $_TableP where pcode = '$_GET[pcode]'");
}else{
$r = $dalib->selectSQLField("select * from $Table[Product] where pcode = '$_GET[pcode]'");
}
$pname = stripslashes($r[pname]);
$pcompany = stripslashes($r[pcompany]);
$pinfo = $r[pinfo];
$pbuylimit = stripslashes($r[pbuylimit]);
$selfStock = $r[selfStock];
$self_sale = $r[sale];
switch ($pcompany){
case "SHIMANO" : $affiPerSale = $RMANAGE[shimanoaffiPerSale];
break;
case "DAIWA" : $affiPerSale = $RMANAGE[daiwaaffiPerSale];
break;
case "가마가츠" : $affiPerSale = $RMANAGE[sinsinaffiPerSale];
break;
default : $affiPerSale = $RMANAGE[etcaffiPerSale];
}
/*
if($r[persale]>0){
$psellprice = round($r[pprice]*$affiSale*(1-($r[persale]/100)),-3);
}else{
$psellprice = round($r[pprice]*$affiSale*(1-($r[persale]/100)),-3);
}
*/
$pcode = preg_replace("/[^0-9]/","",$r[pcode]); //숫자 이외의 문자열은 널값으로 만들면 숫자값들만 표시
$_Table = "fishingas2008.Barcode";
$pummokName = $dalib->selectSQLField("select pummok from fishingas2008.Barcode where barcode='$pcode'");
if($pummokName[pummok]=="다이와 부품" || $pummokName[pummok]=="시마노 부품"){
$_field = "barcode";
}else{
$_field = "pcode";
}
$result = $dalib->selectSQLAll("select * from $Table[ProductStockSetting] where pcode = '$pcode'");
if($result[rnum]>0) {
$row = @mysql_fetch_array($result[result]);
for($loop=1;$loop<=48;$loop++) {
if($row["k_".$loop]=="" || $row["k_".$loop]=="0") continue;
$cWhere .= $_field."='".$row["k_".$loop]."' or ";
}
$cWhere = substr($cWhere, 0, -3);
if($cWhere=="0") {
$cWhere = "";
}else{
$cWhere = "where (".$cWhere.") and";
}
$rPs = $dalib->selectSQLField("select MIN(mallSellprice*1) as MinPsellprice, mallSellpriceStatic, pummok from fishingas2008.Barcode $cWhere mallSellprice > '0' and company='$pcompany'");
//echo ("select MIN(mallSellprice*1) as MinPsellprice, mallSellpriceStatic, pummok from fishingas2008.Barcode $cWhere mallSellprice > '0' and company='$pcompany'");
$psellprice = $rPs[MinPsellprice];
$cWhere = substr($cWhere, 0, -4);
$resultStock = $dalib->selectSQLAll("select * from $_Table $cWhere");
while($rs = mysql_fetch_array($resultStock[result])){
$totalStock += $rs[amount];
}
/*
if($self_sale>0){
$rowSale = $dalib->selectSQLField("select sale from $Table[Product] where jancode='$r[jancode]'");
}else{
$rowSale = $dalib->selectSQLField("select sale from $_Table where jancode='$r[jancode]'");
}
*/
}else{
if($mode=="part"){
$rPs = $dalib->selectSQLField("select * from $_TableP where pcode='$pcode'");
$psellprice = $rPs[yen];
$totalStock = $rPs[amount];
}else{
if($r[pcompany] == "GAMAKATSU"){
$rPs = $dalib->selectSQLField("select mallSellprice, mallSellpriceStatic from $_Table where $_field='$pcode' || jancode='$pcode'");
}else{
$rPs = $dalib->selectSQLField("select mallSellprice, mallSellpriceStatic from $_Table where $_field='$pcode'");
}
$psellprice = $rPs[mallSellprice];
$totalStock = $rPs[amount];
/*
if($self_sale>0){
$rowSale = $dalib->selectSQLField("select sale from $Table[Product] where pcode='$r[pcode]'");
}else{
$rowSale = $dalib->selectSQLField("select sale from $_Table where pcode='$r[pcode]'");
}
*/
}
}
$pprice = $psellprice*1.1;
# 상품코드가 잘못되었거나 상품이 디비내용에 없을경우
//if($r[srlno]=="") $fulib->alertTour("잘못된 상품코드이거나 현재 서비스하지 않는 상품입니다.", "/index.php");
if($r[0]=="" || $r[display]=="0") $fulib->alertTour("잘못된 상품코드이거나 현재 서비스하지 않는 상품입니다.", "/index.php");
if($totalStock < 1) $STOCK_IMG = "";
if($r[html] == "0") {
$pcontents = str_replace(" "," ",$r[pcontents]) ;
$pcontents = nl2br(stripslashes($pcontents)) ;
}elseif($r[html] =="1") {
$pcontents = stripslashes($r[pcontents]);
}
$rstock = $dalib->selectSQLField("select * from $Table[ProductStockItemDetail] where pcode = '$_GET[pcode]' and kind = '1'");
$rstock2 = $dalib->selectSQLField("select * from $Table[ProductStockItemDetail] where pcode = '$_GET[pcode]' and kind = '2'");
$rstock3 = $dalib->selectSQLField("select * from $Table[ProductStockSetting] where pcode = '$_GET[pcode]'");
# 배송정보
$r_send = $dalib->selectSQLField("select sendkind, sendcontent from $Table[ManageInfo]");
if($r_send[sendkind] == "0") {
$sendcontent = str_replace(" "," ",$r_send[sendcontent]) ;
$sendcontent = nl2br(stripslashes($sendcontent)) ;
}elseif($r_send[sendkind] =="1") {
$sendcontent = stripslashes($r_send[sendcontent]);
}
# 상품별 통계
if($r[srlno] != "" and $now != "ad") {
$basedate = date("Ym");
$r_stat_total = $dalib->selectSQLField("select srlno from $Table[ProductStat] where pcode = '$pcode' and basedate = 'total'");
if($r_stat_total[0]=="") {
$insertsql = "insert into $Table[ProductStat] set pcode = '$pcode',
pname = '$pname',
basedate = 'total',
view = '1'";
$dalib->directQuery($insertsql);
}else {
$dalib->directQuery("update $Table[ProductStat] set view = view + 1 where pcode = '$pcode' and basedate = 'total'");
}
$r_stat_view = $dalib->selectSQLField("select srlno from $Table[ProductStat] where pcode = '$pcode' and basedate = '$basedate'");
if($r_stat_view[0]=="") {
$insertsql = "insert into $Table[ProductStat] set pcode = '$pcode',
pname = '$pname',
basedate = '$basedate',
view = '1'";
$dalib->directQuery($insertsql);
}else {
$dalib->directQuery("update $Table[ProductStat] set view = view + 1 where pcode = '$pcode' and basedate = '$basedate'");
}
}
if($mode=="recom") {
if($find=="precom") $PreTitle .= "추천상품 > ";
if($find=="pnew") $PreTitle .= "신상품 > ";
if($find=="pbest") $PreTitle .= "베스트 상품 > ";
if($find=="ppopu") $PreTitle .= "인기상품 > ";
}elseif($menu=="search") {
$PreTitle .= "'$search' 검색 > ";
}elseif($menu=="symp") {
$PreTitle = "$SYMP_TITLE > ";
}else {
if($bigcatename != "") $PreTitle .= "$bigcatename > ";
if($smcatenameTitle !="") $PreTitle .= "$smcatenameTitle > ";
}
$p_sale = "pcode_sale_".$pcode;
if($rPs[mallSellpriceStatic]=="Y"){
$psellprice = $psellprice;
}else{
$psellprice = $fulib->priceBelow_100($psellprice);
}
if($mode=="part"){
?>
}else{
?>
}?>