> Á¦Ç°ÆíÁý";
$location=$location." > ".$mc_selected1." > ".$sc_selected1;
break;
case("add"):
$location="Á¦Ç°°ü¸® > Á¦Ç°ÆíÁý > ".$mc_selected1." > ".$sc_selected1." >Ãß°¡";
$include_hf="./pd_add.html";
break;
}
break;
case("pd_box"):
$location="Á¦Ç°°ü¸® > Á¦Ç°º¸°üÇÔ";
switch($modeb){
case("pd_update"):
if(count($pd_id_no)>0){
while(list($key,$id_no)=each($pd_id_no)){
#print $pd_mc[$key]."=".$pd_sc[$key];
if($pd_mc[$key]!="empty" and $pd_sc[$key]!="empty"){
$query="update products set mc='$pd_mc[$key]', sc='$pd_sc[$key]' where mc='pd_box' and id_no='$id_no'";
#print"mc[$key]=$pd_mc[$key] and sc[$key]=$pd_sc[$key] and cost[$key]=$cost[$key]";
#print"$query
";
$pd_update=mysql_query($query);
query_chk($pd_update,"pd_update error");
}
}
}
header("location:./pd.html?modea=pd_box");
break;
case("all_update"):
#print $all_mc."-".$all_sc;
if($all_mc!="empty" and $all_sc!="empty"){
#print "mc=$all_mc,sc=$all_sc";
$query="update products set mc='$all_mc',sc='$all_sc' where mc='pd_box'";
$pd_update_all=mysql_query($query);
query_chk($pd_update_all,"pd_update_all error");
}
header("location:./pd.html?modea=pd_box");
exit;
break;
case("sel_del"):
if(count($pd_chk)>0){
while(list($key,$id_no)=each($pd_chk)){
$query="delete from products where mc='pd_box' and id_no='$id_no'";
$pd_del=mysql_query($query);
query_chk($pd_del,"pd_del error");
}
}
header("location:./pd.html?modea=pd_box");
exit;
break;
case("all_del"):
$query="delete from products where mc='pd_box'";
$pd_del=mysql_query($query);
query_chk($pd_del,"pd_del error");
header("location:./pd.html?modea=pd_box");
exit;
break;
case("ser_normal"):
$where_txt="and ".$ser_type." like '%".$ser_txt."%'";
break;
}
$include_hf="./pd_box.html";
break;
case("pd_add"):
#print"
Writing.........
";
#------- ÃÊ±â °Ë»ç ¹× º¯¼ö¼³Á¤
$query="select sn from products where sn='$sn'";
$sn_chk_db=mysql_query($query);
query_chk($sn_chk_db,"sn_chk error");
$sn_chk=mysql_fetch_array($sn_chk_db);
if($sn_chk[sn]){
echo"
";
exit;
}
$to_day=date("Y-m-d");
#------- ¾÷·ÎµåÇÑ FileÀÌ ½ÇÁ¦ Á¸Àç ÇÏ´ÂÁö °Ë»ç ÇÑ´Ù.
if (!file_exists($pic_l) and $pic_l_name!=""){
print "";
}
if (!file_exists($pic_m) and $pic_m_name!=""){
print "";
}
if (!file_exists($pic_s) and $pic_s_name!=""){
print "";
}
#------- ¾÷·ÎµåÇÑ ÆÄÀÏ¿¡ À̸§À» ºÎ¿© Çϰí /Products_pic µð·ºÅ丮·Î º¹»ç ÇÑ´Ù.
$pic_tail="_l.img";
if ($pic_l_name!=""){
$file_name="../products_pic/$sn$pic_tail";
copy ($pic_l,$file_name);
unlink($pic_l);
}
$pic_tail="_m.img";
if ($pic_m_name!=""){
$file_name="../products_pic/$sn$pic_tail";
copy ($pic_m,$file_name);
unlink($pic_m);
}
$pic_tail="_s.img";
$pic_tail1="_ss.img";
if ($pic_s_name!=""){
$file_name="../products_pic/$sn$pic_tail";
copy ($pic_s,$file_name);
unlink($pic_s);
exec("convert -scale 50x50! ../products_pic/$sn$pic_tail ../products_pic/$sn$pic_tail1");
}
#-------»çÁø Á¤Ã¥ ½ÃÀÛ
include "./include/pic_rule.inc";
#-------»çÁøÁ¤Ã¥ ³¡
#-------Á¦Ç° »ó¼¼Á¤º¸¿Í °ü·Ã±ÛÀÇ ÆÄÀÏÀÔ·Â ¿©ºÎÈ®ÀÎ
if(file_exists($remark_file)){
$rfd=file($remark_file);
$fr=0;
$remark_detail="";
$rf_ext=explode(".",$remark_file_name);
$extension=$rf_ext[sizeof($rf_ext)-1];
if($extension=="html" || $extension=="htm" || $extension=="txt"){
while($rfd[$fr]){
$remark_detail=$remark_detail.$rfd[$fr];
$fr=$fr+1;
}
}
else{
echo"";
}
}
if(file_exists($note_file)){
$nfd=file($note_file);
$fr=0;
$note_dp="";
$nf_ext=explode(".",$note_file_name);
$extension=$nf_ext[sizeof($nf_ext)-1];
if($extension=="html" || $extension=="htm" || $extension=="txt"){
while($nfd[$fr]){
$note_dp=$note_dp.$nfd[$fr];
$fr=$fr+1;
}
}
else{
echo"";
}
}
$query="insert into products (name,sn,mc,sc,cost,dc,summary,remark_detail,views,sales,date,pd_type,note_dp,remark_detail_type,note_dp_type,mod_date,reserve,maker,mc_dp,sc_dp,gr_dp,recomm_lev,groub,recomm_app,stock_app,pic_rule,stock,state) values ('$name','$sn','$mc_selected','$sc_selected','$cost','$dc','$summary','$remark_detail',0,0,'$to_day','$pd_type','$note_dp','$remark_detail_type','$note_dp_type','$to_day','$reserve','$maker','$mc_dp','$sc_dp','$gr_dp','$recomm_lev','$groub','$recomm_app','$stock_app','$pic_rule','$stock','$state')";
$pd_insert=mysql_query($query);
query_chk($pd_insert,"pd_insert query_error");
$query="select * from products order by id_no DESC limit 0,1";
$pd_db=mysql_query($query);
query_chk($pd_db,"pd_db error");
$pd=mysql_fetch_array($pd_db);
$url="./pd.html?modea=pd_view&mc_selected=".urlencode($mc_selected)."&sc_selected=".urlencode($sc_selected)."&id_no=".$pd[id_no];
print"";
exit;
break;
case("pd_edit"):
$include_hf="./pd_edit.html";
$location="Á¦Ç°°ü¸® > Á¦Ç°ÆíÁý > $mc_selected > $sc_selected >ÆíÁý";
break;
case("pd_edit_save"):
#print"
Writing.........";
$to_day=date("Y-m-d");
#------- ¾÷·ÎµåÇÑ FileÀÌ ½ÇÁ¦ Á¸Àç ÇÏ´ÂÁö °Ë»ç ÇÑ´Ù.
if (!file_exists($pic_l) and $pic_l_name!=""){
print "";
}
if (!file_exists($pic_m) and $pic_m_name!=""){
print "";
}
if (!file_exists($pic_s) and $pic_s_name!=""){
print "";
}
#------- ¾÷·ÎµåÇÑ ÆÄÀÏ¿¡ À̸§À» ºÎ¿© Çϰí /Products_pic µð·ºÅ丮·Î º¹»ç ÇÑ´Ù.
$pic_tail="_l.img";
if ($pic_l_name!=""){
$file_name="../products_pic/$sn$pic_tail";
copy ($pic_l,$file_name);
unlink($pic_l);
}
$pic_tail="_m.img";
if ($pic_m_name!=""){
$file_name="../products_pic/$sn$pic_tail";
copy ($pic_m,$file_name);
unlink($pic_m);
}
$pic_tail="_s.img";
if ($pic_s_name!=""){
$file_name="../products_pic/$sn$pic_tail";
copy ($pic_s,$file_name);
unlink($pic_s);
exec("convert -scale 50x50! ../products_pic/$sn$pic_tail ../products_pic/$sn$pic_tail1");
}
#-------»çÁø Á¤Ã¥ ½ÃÀÛ
include "./include/pic_rule.inc";
#-------»çÁøÁ¤Ã¥ ³¡
#-------Á¦Ç° »ó¼¼Á¤º¸¿Í °ü·Ã±ÛÀÇ ÆÄÀÏÀÔ·Â ¿©ºÎÈ®ÀÎ
if(file_exists($remark_file)){
$rfd=file($remark_file);
$fr=0;
$remark_detail="";
$rf_ext=explode(".",$remark_file_name);
$extension=$rf_ext[sizeof($rf_ext)-1];
if($extension=="html" || $extension=="htm" || $extension=="txt"){
while($rfd[$fr]){
$remark_detail=$remark_detail.$rfd[$fr];
$fr=$fr+1;
}
}
else{
echo"";
}
}
if(file_exists($note_file)){
$nfd=file($note_file);
$fr=0;
$note_dp="";
$nf_ext=explode(".",$note_file_name);
$extension=$nf_ext[sizeof($nf_ext)-1];
if($extension=="html" || $extension=="htm" || $extension=="txt"){
while($nfd[$fr]){
$note_dp=$note_dp.$nfd[$fr];
$fr=$fr+1;
}
}
else{
echo"";
}
}
#------- ³Ñ¾î¿Â°ªÁß Á¤Ã¥°ü·Ã ¼³Á¤
if(!$stock_app){
$stock_app="no";
}
if(!$recomm_app){
$recomm_app="no";
}
#------- ³Ñ¾î¿Â°ªÁß Á¤Ã¥°ü·Ã ¼³Á¤ ³¡
#------- º¯°æµÈ °ª¿¡´ëÇÑ °üŽÂÁ¤º¸ ¼öÁ¤ ½ÃÀÛ
$query="select sn from products where id_no='$id_no'";
$sn_db=mysql_query($query);
query_chk($sn_db,"sn_db error");
$sn_chk=mysql_fetch_array($sn_db);
if($sn_chk[sn]!=$sn){
#»çÁø
$old_pic_name="../products_pic/".$sn_chk[sn];
$new_pic_name="../products_pic/".$sn;
if(!$pic_l_name){
rename($old_pic_name."_l.img",$new_pic_name."_l.img");
}
if(!$pic_m_name){
rename($old_pic_name."_m.img",$new_pic_name."_m.img");
}
if(!$pic_s_name){
rename($old_pic_name."_s.img",$new_pic_name."_s.img");
rename($old_pic_name."_ss.img",$new_pic_name."_ss.img");
}
$query="update option_base set sn='$sn' where sn='$sn_chk[sn]'";
$option_update=mysql_query($query);
query_chk($option_update,"option_update error");
$query="update pd_sub set base_sn='$sn' where base_sn='$sn_chk[sn]'";
$pd_sub_update=mysql_query($query);
query_chk($pd_sub_update,"pd_sub_update");
}#sn_if
#------- º¯°æµÈ °ª¿¡´ëÇÑ °üŽÂÁ¤º¸ ¼öÁ¤ ³¡
$query="update products set mc='$mc_selected', sc='$sc_selected',name='$name',sn='$sn',cost='$cost',dc='$dc',summary='$summary',remark_detail='$remark_detail',pd_type='$pd_type',note_dp='$note_dp',remark_detail_type='$remark_detail_type',note_dp_type='$note_dp_type',mod_date='$to_day',reserve='$reserve',maker='$maker',mc_dp='$mc_dp',sc_dp='$sc_dp',gr_dp='$gr_dp',recomm_lev='$recomm_lev',groub='$groub',recomm_app='$recomm_app',stock_app='$stock_app',pic_rule='$pic_rule',stock='$stock',state='$state' where id_no='$id_no'";
$pd_update=mysql_query($query);
query_chk($pd_update,"pd_update error");
$url="./pd.html?modea=pd_view&id_no=$id_no&mc_selected=".$mc_selected_enc."&sc_selected=".$sc_selected_enc;
print"";
exit;
break;
case("list_save"):
#print"
Writing.........";
if($search_org){
$pd_where="and $ser_type like '%$search_org%'";
}
while(list($key,$val)=each($pd_type)){
$query="select * from products where id_no='$key'";
$pd_db=mysql_query($query);
query_chk($pd_db,"pd_db error");
$pd=mysql_fetch_array($pd_db);
$mc_dp1=$mc_dp[$pd[id_no]];
$sc_dp1=$sc_dp[$pd[id_no]];
$gr_dp1=$gr_dp[$pd[id_no]];
$pd_type1=$pd_type[$pd[id_no]];
$mod_date=date("Ymd");
$query="update products set mc_dp='$mc_dp1',sc_dp='$sc_dp1',gr_dp='$gr_dp1',pd_type='$pd_type1',mod_date='$mod_date' where id_no='$pd[id_no]'";
$pd_update=mysql_query($query);
query_chk($pd_update,"pd_update error");
}
print"";
exit;
break;
case("pd_del"):
#print"
Remove Products Data";
#------- »èÁ¦ÇÒ Á¦Ç° Á¤º¸°ª¿¡´ëÇÑ °üŽÂÁ¤º¸ »èÁ¦ ½ÃÀÛ
$query="select sn from products where id_no='$id_no'";
$sn_db=mysql_query($query);
query_chk($sn_db,"sn_db error");
$sn_chk=mysql_fetch_array($sn_db);
if($sn_chk[sn]!=$sn){
/*
#»çÁø
$old_pic_name="../products_pic/".$sn_chk[sn];
if(!$pic_l_name){
unlink($old_pic_name."_l.img");
}
if(!$pic_m_name){
unlink($old_pic_name."_m.img");
}
if(!$pic_s_name){
unlink($old_pic_name."_s.img");
unlink($old_pic_name."_ss.img");
}
*/
$query="delete from option_base where sn='$sn_chk[sn]'";
$option_delete=mysql_query($query);
query_chk($option_delete,"option_delete error");
$query="delete from pd_sub where base_sn='$sn_chk[sn]'";
$pd_sub_delete=mysql_query($query);
query_chk($pd_sub_delete,"pd_sub_delete error");
}#sn_if
#------- »èÁ¦ÇÒ Á¦Ç° Á¤º¸°ª¿¡´ëÇÑ °üŽÂÁ¤º¸ »èÁ¦ ³¡
$query="delete from products where id_no='$id_no'";
$pd_del_db=mysql_query($query);
query_chk($pd_del_db,"pd_del_db error");
print"";
exit;
break;
case("list_move"):
if(count($pd_del)>0){
while(list($key,$id_no)=each($pd_del)){
$query="update products set mc='pd_box',sc='' where id_no='$key'";
#print $query."
";
$pd_move=mysql_query($query);
query_chk($pd_move,"pd_move error");
}
}
print"";
exit;
break;
case("list_del"):
#print"
Remove Products Data";
if($search_org){
$pd_where="and $ser_type like '%$search_org%'";
}
$query="select * from products where mc='$mc_selected' and sc='$sc_selected' $pd_where order by id_no";
$pd_db=mysql_query($query);
query_chk($pd_db,"pd_db error");
while($pd=mysql_fetch_array($pd_db)){
$delchk=$pd_del[$pd[id_no]];
if($delchk=="del"){
#------- »èÁ¦ÇÒ Á¦Ç° Á¤º¸°ª¿¡´ëÇÑ °üŽÂÁ¤º¸ »èÁ¦ ½ÃÀÛ
$query="select sn from products where id_no='$pd[id_no]'";
$sn_db=mysql_query($query);
query_chk($sn_db,"sn_db error");
$sn_chk=mysql_fetch_array($sn_db);
if($sn_chk[sn]!=$sn){
/*
#»çÁø
$old_pic_name="../products_pic/".$sn_chk[sn];
if(!$pic_l_name){
unlink($old_pic_name."_l.img");
}
if(!$pic_m_name){
unlink($old_pic_name."_m.img");
}
if(!$pic_s_name){
unlink($old_pic_name."_s.img");
unlink($old_pic_name."_ss.img");
}
*/
$query="delete from option_base where sn='$sn_chk[sn]'";
$option_delete=mysql_query($query);
query_chk($option_delete,"option_delete error");
$query="delete from pd_sub where base_sn='$sn_chk[sn]'";
$pd_sub_delete=mysql_query($query);
query_chk($pd_sub_delete,"pd_sub_delete error");
}#sn_if
#------- »èÁ¦ÇÒ Á¦Ç° Á¤º¸°ª¿¡´ëÇÑ °üŽÂÁ¤º¸ »èÁ¦ ³¡
$query="delete from products where id_no='$pd[id_no]'";
$pd_del_from_db=mysql_query($query);
query_chk($pd_del_from_db,"pd_del_from_db error");
#print" .";
}
}
print"";
exit;
break;
case("search"):
$pd_where="and $ser_type like '%$search%'";
$location="Á¦Ç°°ü¸® > Á¦Ç°ÆíÁý > $mc_selected > $sc_selected >°Ë»ö";
$include_hf="./pd_list.html";
break;
case("mc_up"):
$query="select id from mc where id_no='$mc_move'";
$id_no_db=mysql_query($query);
query_chk($id_no_db,"id_no_db error");
$id=mysql_fetch_array($id_no_db);
$sl_id_no=$id[id];
$query="select * from mc where id<'$sl_id_no' order by id_no DESC limit 0,1";
$mc_move_db=mysql_query($query);
query_chk($mc_move_db,"mc_move_db error");
if(mysql_num_rows($mc_move_db)>0){
$mc_move_id=mysql_fetch_array($mc_move_db);
$ch_id_no=$mc_move_id[id_no];
$query="update mc set id='$mc_move_id[id]' where id_no='$mc_move'";
$id_update=mysql_query($query);
query_chk($id_update,"id_update error");
$query="update mc set id='$sl_id_no' where id_no='$mc_move_id[id_no]'";
$id_update=mysql_query($query);
query_chk($id_update,"id_update error");
}
print"";
break;
case("mc_down"):
$query="select id from mc where id_no='$mc_move'";
$id_no_db=mysql_query($query);
query_chk($id_no_db,"id_no_db error");
$id=mysql_fetch_array($id_no_db);
$sl_id_no=$id[id];
$query="select * from mc where id>'$sl_id_no' order by id_no limit 0,1";
$mc_move_db=mysql_query($query);
query_chk($mc_move_db,"mc_move_db error");
if(mysql_num_rows($mc_move_db)>0){
$mc_move_id=mysql_fetch_array($mc_move_db);
$ch_id_no=$mc_move_id[id_no];
$query="update mc set id='$mc_move_id[id]' where id_no='$mc_move'";
$id_update=mysql_query($query);
query_chk($id_update,"id_update error");
$query="update mc set id='$sl_id_no' where id_no='$mc_move_id[id_no]'";
$id_update=mysql_query($query);
query_chk($id_update,"id_update error");
}
print"";
break;
case("sc_up"):
$query="select id from sc where id_no='$sc_move'";
$id_no_db=mysql_query($query);
query_chk($id_no_db,"id_no_db error");
$id=mysql_fetch_array($id_no_db);
$sl_id_no=$id[id];
$query="select * from sc where id<'$sl_id_no' and mc='$mc_selected' order by id_no DESC limit 0,1";
$sc_move_db=mysql_query($query);
query_chk($sc_move_db,"sc_move_db error");
if(mysql_num_rows($sc_move_db)>0){
$sc_move_id=mysql_fetch_array($sc_move_db);
$ch_id_no=$sc_move_id[id_no];
$query="update sc set id='$sc_move_id[id]' where id_no='$sc_move'";
$id_update=mysql_query($query);
query_chk($id_update,"id_update error");
$query="update sc set id='$sl_id_no' where id_no='$sc_move_id[id_no]'";
$id_update=mysql_query($query);
query_chk($id_update,"id_update error");
}
print"";
break;
case("sc_down"):
$query="select id from sc where id_no='$sc_move'";
$id_no_db=mysql_query($query);
query_chk($id_no_db,"id_no_db error");
$id=mysql_fetch_array($id_no_db);
$sl_id_no=$id[id];
$query="select * from sc where id>'$sl_id_no' and mc='$mc_selected' order by id_no limit 0,1";
$sc_move_db=mysql_query($query);
query_chk($sc_move_db,"sc_move_db error");
if(mysql_num_rows($sc_move_db)>0){
$sc_move_id=mysql_fetch_array($sc_move_db);
$ch_id_no=$sc_move_id[id_no];
$query="update sc set id='$sc_move_id[id]' where id_no='$sc_move'";
$id_update=mysql_query($query);
query_chk($id_update,"id_update error");
$query="update sc set id='$sl_id_no' where id_no='$sc_move_id[id_no]'";
$id_update=mysql_query($query);
query_chk($id_update,"id_update error");
}
print"";
break;
case("ct_save"):
while(list($key,$id)=each($mc_sort)){
$query="update mc set id='$id' where id_no='$key'";
#print "$query
";
$mc_db=mysql_query($query);
query_chk($mc_db,"mc_db error");
}
if(count($sc_sort)>0){
while(list($key,$id)=each($sc_sort)){
$query="update sc set id='$id' where id_no='$key'";
$sc_db=mysql_query($query);
query_chk($sc_db,"sc_db error");
}
}
#exit;
print"";
break;
case("pd_view"):
$include_hf="./pd_view.html";
$location="Á¦Ç°°ü¸® > Á¦Ç°ÆíÁý > $mc_selected > $sc_selected >º¸±â";
break;
case("pd2"):
$include_hf="./pd_price.html";
$location="Á¦Ç°°ü¸® > °¡°Ý&¸¶Àϸ®Áö°ü¸® >".$mc_selected1." >".$sc_selected1;
break;
case("pd2_save"):
#print"
Writing.........";
$query="select * from products where mc='$mc_selected' and sc='$sc_selected' order by id_no";
$pd_db=mysql_query($query);
query_chk($pd_db,"pd_db error");
while($pd=mysql_fetch_array($pd_db)){
$cost1=$cost[$pd[id_no]];
$cost_state1=$cost_state[$pd[id_no]];
$state1=$state[$pd[id_no]];
$reserve1=$reserve[$pd[id_no]];
$name1=$name[$pd[id_no]];
$query="update products set name='$name1',cost='$cost1', cost_state='$cost_state1', reserve='$reserve1', state='$state1' where id_no='$pd[id_no]'";
$pd_update=mysql_query($query);
query_chk($pd_update,"pd_update error");
}
print"";
exit;
break;
case("pd3"):
$location="Á¦Ç°°ü¸® > Á¦Ç°¸ñ·Ï Ãâ·Â";
$include_hf="./mb_2_edit.html";
break;
case("pd_type"):
$include_hf="./pd_type.html";
$location="Á¦Ç°°ü¸® > Á¦Ç°Å׸¶°ü¸®";
break;
}
?>
Untitled Document