查看文件: body_webshop.php
大小: 23.59 KB
类型: application/octet-stream
<?php require_once('../Connections/BE2.php'); ?> <?php if (!isset($_SESSION)){ session_start(); } if(isset($_POST["MM_update"]) && ($_POST["MM_update"] == "fp1")){ $check_title=0; if($_POST['company_title']==''){ $check_title=0;} else if($_POST['old_title']<>$_POST['company_title']){ mysql_select_db($database_BE2, $BE2); $query_Rtc = sprintf("SELECT * FROM company WHERE company_title = %s", GetSQLValueString($_POST['company_title'], "text")); $Rtc = mysql_query($query_Rtc, $BE2) or die(mysql_error()); $row_Rtc = mysql_fetch_assoc($Rtc); $totalRows_Rtc = mysql_num_rows($Rtc); if($totalRows_Rtc==0){ // make logo $_GET['shopname']=trim($_POST['company_title']) ; $_GET['shopid']=$_SESSION['login_memid'] ; //include('mk_webshop_logo.php'); }else{ $check_title=1; } mysql_free_result($Rtc); } if($check_title==0){ $idpath= $_SESSION['login_memid'] ; $wwwpath='/www2/skybni'; $picpath= "/shopmap/images/logo_".$idpath; $tfile="fileToUpload1"; $wimgext=$_POST['company_pic']; if($_FILES[$tfile]["name"]<>''){ $ext= explode('.',$_FILES[$tfile]['name']) ; $imgext=strtolower($ext[count($ext)-1]); //取最後一筆 $pic=$wwwpath.$picpath.".".$imgext; $wimgext=$imgext; move_uploaded_file($_FILES[$tfile]["tmp_name"],$pic); } //com_express com_express_ company_kind=%s $updateSQL = sprintf("UPDATE company SET company_title=%s,company_pic=%s,com_express=%s,com_express_max=%s ,com_express_shop=%s ,com_express_local=%s,ext_shop=%s,co_tb1=%s,co_tb2=%s,co_tb3=%s WHERE coid=%s", GetSQLValueString($_POST['company_title'], "text"), GetSQLValueString($wimgext, "text"), GetSQLValueString($_POST['com_express'], "int"), GetSQLValueString($_POST['com_express_max'], "int"), GetSQLValueString($_POST['com_express_shop'], "int"), GetSQLValueString($_POST['com_express_local'], "text"), GetSQLValueString($_POST['ext_shop'], "text"), GetSQLValueString($_POST['co_tb1'], "int"), GetSQLValueString($_POST['co_tb2'], "text"), GetSQLValueString($_POST['co_tb3'], "text"), GetSQLValueString($_POST['coid'], "int")); //$_SESSION['login_memid'] mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($updateSQL, $BE2) or die(mysql_error()); $msg='更新完成....' ; }else{ $msg='公司名稱重複....' ; } $updateGoTo = "webshop.html"; echo '<script>alert("'.$msg.'");</script>'; } mysql_select_db($database_BE2, $BE2); $query_Rt2 = sprintf("SELECT * FROM company WHERE mid = %s", GetSQLValueString($_SESSION['login_memid'], "int")); $Rt2 = mysql_query($query_Rt2, $BE2) or die(mysql_error()); $row_Rt2 = mysql_fetch_assoc($Rt2); $totalRows_Rt2 = mysql_num_rows($Rt2); $company_coid=$row_Rt2['coid']; mysql_select_db($database_BE2, $BE2); $q_up1 = sprintf("UPDATE member set coid='%s' WHERE coid = 0 AND mem_auto='%s' ", $company_coid, $_SESSION['login_memid']); mysql_query($q_up1, $BE2) or die(mysql_error()); mysql_select_db($database_BE2, $BE2); $query_Rt3 = sprintf("SELECT * FROM webshop WHERE coid= 1 OR coid='%s' order by coid,windex",$_SESSION['login_coid']) ; $Rt3 = mysql_query($query_Rt3, $BE2) or die(mysql_error()); $row_Rt3 = mysql_fetch_assoc($Rt3); $totalRows_Rt3 = mysql_num_rows($Rt3); $arr1=array(); $arr2=array(); $arr2[0][0]=0; $arr2[0][0]=0; $arr2[0][1]=0; $arr2[0][2]='主圖'; $arr2[0][3]='/products/000830284715.jpg'; $arr2[0][4]=''; $arr2[0][5]='Y'; // can edit upload $arr2[0][6]='Y'; // can edit upload $i=0; do { if($row_Rt3['windex']==0){ $arr2[0][0]=0; $arr2[0][0]=$row_Rt3['wid']; $arr2[0][1]=$row_Rt3['coid']; $arr2[0][2]=$row_Rt3['wtitle']; $arr2[0][3]='/shop/img/'.$row_Rt3['wimg'].'.'.$row_Rt3['wimgext']; $arr2[0][4]=$row_Rt3['wlink']; $arr2[0][5]=$row_Rt3['wuse']; // can edit upload $arr2[0][6]=$row_Rt3['wflag']; // can edit upload } else{ if($row_Rt3['coid']>1){ $i=$row_Rt3['windex']-1;} $arr1[$i][0]=$row_Rt3['wid']; $arr1[$i][1]=$row_Rt3['coid']; $arr1[$i][2]=$row_Rt3['wtitle']; $arr1[$i][3]=$row_Rt3['wimg'].'.'.$row_Rt3['wimgext']; $arr1[$i][4]=$row_Rt3['wlink']; $arr1[$i][5]=$row_Rt3['wuse']; // can edit upload $arr1[$i][6]=$row_Rt3['wflag']; // can edit upload $i++; } } while ($row_Rt3 = mysql_fetch_assoc($Rt3)); // co_tb1 1.購物網 2.旅遊網 mysql_select_db($database_BE2, $BE2); if($row_Rt2['co_tb1']==2){ $query_Rtra = "SELECT * FROM travel where tbc='旅遊網' AND tb3='Y' order by tbindex" ; }else{ $query_Rtra = "Select kid as tb0,kdoc as tb2 FROM company_kinds where kflag='Y' order by kindex" ; // $query_Rot2 = "SELECT * FROM company_kinds order by kid"; } $Rtra = mysql_query($query_Rtra, $BE2) or die(mysql_error()); $row_Rtra = mysql_fetch_assoc($Rtra); $totalRows_Rtra = mysql_num_rows($Rtra); mysql_select_db($database_BE2, $BE2); $query_Rct1 = "SELECT * FROM city_img where 1 order by ctid" ; $Rct1 = mysql_query($query_Rct1, $BE2) or die(mysql_error()); $row_Rct1 = mysql_fetch_assoc($Rct1); ?> <style> .box2{ border-width:3px; border-style:dashed; border-color:#FFAC55; padding:5px; } img{ max-width: 100%; max-height: 100%; display: block; /* remove extra space below image */ } .box{ width: 250px; border: 5px solid black; } .box.large{ height: 300px; } .box.small{ height: 100px; } </style> <div class="main "> <div class="row"> <div class="col-lg-12"> <h3 class="page-header"><i class="fa fa-indent"></i>網店管理</h3> <ol class="breadcrumb"> <li><i class="fa fa-home"></i><a href="index.html">首頁</a></li> <li><i class="fa fa-list-alt"></i><a href="#">企業資料</a></li> <li><i class="fa fa-indent"></i>網店管理</li> </ol> </div> </div> <div class="row"> <div class="col-sm-6"> <div class="panel panel-default"> <div class="panel-heading"> <h2><i class="fa fa-indent red"></i><strong>網店資料管理</strong></h2> </div> <div class="panel-body"> <? /* <h3 align="center"><a href="/shopmap/" target="_blank" title="<?= $row_Rt2['company_title']?>">異業互聯</a> <a href="/travel/" target="_blank" title="<?= $row_Rt2['company_title']?>">旅遊網</a></h3> */ ?> <h3 align="center"><a href="/shopid/<?= $row_Rt2['coid']?>" target="_blank" title="我的網店">我的網店 https://www.skybni.com.tw/shopid/<?= $row_Rt2['coid']?></a></h3><br> <form action="" method="post" name="fop1" id="fop1" enctype="multipart/form-data"> <div class="form-group"> <div class="col-md-12">網頁類別</div> <br/> <div class="col-md-3"> </div> <div class="col-md-3"> <select name="co_tb1" id="co_tb1" class="form-control" onchange="Select_cotb1()"> <option value="1" <?= ($row_Rt2['co_tb1']=='1')?'selected="selected"':""; ?>>購物網</option> <option value="2" <?= ($row_Rt2['co_tb1']=='2')?'selected="selected"':""; ?>>旅遊網</option> </select> </div> <div class="col-md-3"> <select name="co_tb2" id="co_tb2" class="form-control"> <? do { if($row_Rtra['tb2']<>''){ ?> <option value="<?= $row_Rtra['tb0']; ?>" <?= ($row_Rtra['tb0']==$row_Rt2['co_tb2'])?'selected="selected"':""; ?>><?= $row_Rtra['tb2']; ?></option> <?php } } while ($row_Rtra = mysql_fetch_assoc($Rtra)); ?> </select> <input name="company_k1a" type="hidden" id="company_k1" value="" size="32" /> <? //<?= $row_Rt2['company_title'] ; ?> <input name="company_k2a" type="hidden" id="company_k2" value="" size="32" /> </div> <div class="col-md-3"> <select name="co_tb3" id="co_tb3" class="form-control"> <? do{ ?> <option value="<?= $row_Rct1['ctlink'] ?>" <?= ($row_Rt2['co_tb3']==$row_Rct1['ctlink'])?'selected="selected"':""; ?>><?= $row_Rct1['ctlink'] ?></option> <?php } while ($row_Rct1 = mysql_fetch_assoc($Rct1)); ?> </select> <input type="hidden" name="MM_update" value="fp1" /> </div> </div> <? /* <div class="form-group"> <label class="col-md-4 control-label" for="company_kind"> 商家類別</label> <div class="col-md-8"> <select name="company_kind" id="company_kind" class="form-control placeholder col-xs-4 col-sm-4 mb-4"> <? do { if($row_Rot2['kdoc']<>''){ ?> <option value="<?= $row_Rot2['kid']; ?>" <?= ($row_Rot2['kid']==$row_Rt2['company_kind'])?'selected="selected"':""; ?>><?= $row_Rot2['kdoc']; ?></option> <?php } } while ($row_Rot2 = mysql_fetch_assoc($Rot2)); ?> </select> <span class="help-block"> </span> </div> </div> */ ?> <br><br> <div class="form-group"> <label class="col-md-4 control-label" for="company_title">商店名稱(商家抬頭):</label> <div class="col-md-8"> <input name="company_title" type="text" id="company_title" value="<?= $row_Rt2['company_title'] ; ?>" size="32" /> <input name="old_title" type="hidden" id="old_title" value="<?= $row_Rt2['company_title'] ; ?>" size="32" /> <span class="help-block"> </span> </div> </div> <div class="form-group"> <label class="col-md-4 control-label" for="company_titleu">商店名稱Logo圖檔(上):</label> <div class="col-md-6"> <input name="company_titleu" type="text" id="company_titleu" value="<?= $row_Rt2['company_titleu'] ; ?>" size="32" /> <img id='img1' src="/shop/img/logo_<?= sprintf("%07d",$company_coid) ?>.png" /> </div> <div class="col-md-2"> <button type="button" class="btn btn-primary" onclick="mklogo_ud(1);">建立圖檔</button> </div> </div> <div class="form-group"> <label class="col-md-4 control-label" for="company_titled">商店名稱Logo圖檔(下):</label> <div class="col-md-6"> <input name="company_titled" type="text" id="company_titled" value="<?= $row_Rt2['company_titled'] ; ?>" size="32" /> <img id='img2' src="/shop/ext/elogo_<?= sprintf("%07d",$company_coid) ?>.png" /> </div> <div class="col-md-2"> <button type="button" class="btn btn-primary" onclick="mklogo_ud(2);">建立圖檔</button> </div> </div> <div class="form-group"> <label class="col-md-4 control-label" for="fileToUpload1">商城圖檔:</label> <div class="col-md-6"> <input name="fileToUpload1" type="file" id="fileToUpload1" /> <input name="company_pic" type="hidden" id="company_pic" value="<?= $row_Rt2['company_pic'] ; ?>"/> <span class="help-block">圖檔(jpg,png) : Size 130 x 108 dpi<br> 圖片將依據您的選擇,上傳至購物網或旅遊網 </span> </div> <div class="col-md-2"> <? if($row_Rt2['company_pic']<>''){?> <img name="" src="/shopmap/images/logo_<?= $_SESSION['login_memid'].'.'.$row_Rt2['company_pic']?>" width="100" alt="" /> <? }?> </div> </div> <div class="form-group"> <label class="col-md-4 control-label" for="fileToUpload1">本商城基本運費:</label> <div class="col-md-8"> <input id="com_express" name="com_express" type="text" value="<?= $row_Rt2['com_express'] ?>" /> <span class="help-block"></span> </div> </div> <div class="form-group"> <label class="col-md-4 control-label" for="fileToUpload1">購物免運設定:</label> <div class="col-md-8"> <input type="text" id="com_express_max" name="com_express_max" value="<?= $row_Rt2['com_express_max'] ?>" /> <span class="help-block">購物超過此金額免運 (0值 -> 表不設定)</span> </div> </div> <? /* <div class="form-group"> <label class="col-md-4 control-label" for="fileToUpload1">超商取貨:</label> <div class="col-md-8"> <input type="text" id="com_express_shop" name="com_express_shop" value="<?= $row_Rt2['com_express_shop'] ?>" /> <span class="help-block">超商取貨金額 (0值 -> 表不設定)</span> </div> </div> */ ?> <input type="hidden" id="com_express_shop" name="com_express_shop" value="0" /> <? /* <div class="form-group"> <div class="col-md-8"> <select class="custom-select col-xs-4 col-sm-4 mb-4" name="com_express_local" id="com_express_local" > <option value="Y" <?= ($row_Rt2['com_express_local']=='Y')?'checked':""; ?> > Y 提供到店自取 </option> <option value="N" <?= ($row_Rt2['com_express_local']=='N')?'checked':""; ?> > N 不提供到店自取</option> </select><br> <span class="help-block">(N值 -> 表示不提供到店自取)</span> </div> </div> */ ?> <input type="hidden" id="com_express_local" name="com_express_local" value="<?= $row_Rt2['com_express_local'] ?>" /> <div class="form-group"> <label class="col-md-4 control-label" for="ext_shop"></label> <div class="col-md-8"> <input type="hidden" id="ext_shop" name="ext_shop" value="<?= $row_Rt2['ext_shop'] ?>" /> <br> <span class="help-block"></span> </div> </div> <div class="form-group form-actions"> <div class="col-md-12" style="text-align:center"> <button type="submit" class="btn btn-primary">保存</button> </div > </div> <input type="hidden" name="MM_update" value="fp1" /> <input type="hidden" id="coid" name="coid" value="<?= $row_Rt2['coid'] ; ?>" /> </form> </div> </div> </div> </div> <!-- end: Content --> <br><br><br> <div class="row"> <div class="col-md-6" align="center"><? if($row_Rt2['company_title']<>''){?> <a href="/shop/<?= $row_Rt2['company_title']?>.html" target="_blank" title="<?= $row_Rt2['company_title']?>"><img name="simgx" src="/shop/img/<?= 'logo_'.sprintf('%07d',$_SESSION['login_memid']).'.png' ; ?>" alt="" /></a><? }?></div> <br><br> <div class="col-md-6 box2"> <img name="" src="<?= $arr2[0][3] ?>" width="100%" alt="" /> <div align="center"><?= $arr2[0][2] ?></div> <div align="center"><br> <input type="button" id="b0" name="b0" value="上傳" onclick="updata(0)"/> </div> </div> <div class="col-md-9"> <? for($i=1;$i<4;$i++){ ?> <div class="col-sm-3 box2"><img name="simg<?= $i ?>" id="simg<?= $i ?>" src="/shop/img/<?= $arr1[$i-1][3] ?>" alt="" /> <div align="center"><?= $arr1[$i-1][2] ?></div><br /> <? /* <input name="fileToUpload<?= $i ?>" type="file" id="fileToUpload1" /> <input type="hidden" name="h<?= $i ?>" value="fp1" /> 連結<input type="text" id="l<?= $i ?>" name="l<?= $i ?>" value="<?= $arr1[$i-1][4] ?>" /><br> 說明<input type="text" id="t<?= $i ?>" name="t<?= $i ?>" value="<?= $arr1[$i-1][2] ?>" /> */ ?> <div align="center"><? if($arr1[$i-1][5]=='Y'){ ?> <?= ($arr1[$i-1][6]=='1')?"啟用":"停用"; ?><br> <input type="button" id="b<?= $i ?>" name="b<?= $i ?>" value="上傳" onclick="updata(<?= $i ?>)"/> <? }else{ echo " " ;} ?> </div> </div> <? } ?> </div> </div> <br /><br /> <div class="row"> <div class="col-md-9"> <? for($i=4;$i<7;$i++){ ?> <div class="col-sm-3 box2"><img name="simg<?= $i ?>" id="simg<?= $i ?>" src="/shop/img/<?= $arr1[$i-1][3] ?>" alt="" /> <? /* <input name="fileToUpload<?= $i ?>" type="file" id="fileToUpload1" /> <input type="hidden" name="h<?= $i ?>" value="fp1" /> 連結<input type="text" id="l<?= $i ?>" name="l<?= $i ?>" value="<?= $arr1[$i-1][4] ?>" /><br> 說明<input type="text" id="t<?= $i ?>" name="t<?= $i ?>" value="<?= $arr1[$i-1][2] ?>" /> */ ?><br /> <div align="center"><?= $arr1[$i-1][2] ?></div><br /> <div align="center"><? if($arr1[$i-1][5]=='Y'){ ?> <?= ($arr1[$i-1][6]=='1')?"啟用":"停用"; ?><br> <input type="button" id="b<?= $i ?>" name="b<?= $i ?>" value="更新" onclick="updata(<?= $i ?>)" /><? }else{ echo " " ;} ?></div> </div> <? } ?> </div> </div> <br /><br /> <div class="row"> <div class="col-md-9"> <? for($i=7;$i<10;$i++){ ?> <div class="col-sm-3 box2"><img name="simg<?= $i ?>" id="simg<?= $i ?>" src="/shop/img/<?= $arr1[$i-1][3] ?>" alt="" /> <? /* <input name="fileToUpload<?= $i ?>" type="file" id="fileToUpload1" /> <input type="hidden" name="h<?= $i ?>" value="fp1" /> 連結<input type="text" id="l<?= $i ?>" name="l<?= $i ?>" value="<?= $arr1[$i-1][4] ?>" /><br> 說明<input type="text" id="t<?= $i ?>" name="t<?= $i ?>" value="<?= $arr1[$i-1][2] ?>" /> */ ?><br /> <div align="center"><?= $arr1[$i-1][2] ?></div><br /> <div align="center"><? if($arr1[$i-1][5]=='Y'){ ?><?= ($arr1[$i-1][6]=='1')?"啟用":"停用"; ?> <br> <input type="button" id="b<?= $i ?>" name="b<?= $i ?>" value="更新" onclick="updata(<?= $i ?>)"/><? }else{ echo " " ;} ?></div> </div> <? } ?> </div> </div> <script type="text/javascript"> function Select_cotb1(){ var tb1= $("#co_tb1").val(); // $(city).find(':selected')[0].id; //alert(tb1); $.ajax({ type: 'POST', url: 'Selecttb2Api.php', data: {'tb1': tb1}, success: function (data) { //alert(data); // the next thing you want to do var $co_tb2 = $('#co_tb2'); $co_tb2.empty(); $("select#co_tb2").html(data); } }); } function updata(i){ window.location.href='editwebshop.html?id='+i; } function mklogo_ud(i){ var title=''; var shopname=i; var id=<?=$company_coid ;?>; if(i==1){ // $('#logo1').html(''); title=$('#company_titleu').val(); } else{ // $('#logo2').html(''); title=$('#company_titled').val(); } $.ajax({ method: "POST", url: "ajax_makelogo_ud.php", //data: $('#yourformid').serialize(), data: {'id':id,'shopname':i,'title':title}, datatype:"image/png" }).done(function( data ) { // alert( data); //if(data=="OK"){ if(i==1){ // $('#img1').attr('src', url.createObjectURL(data)); // $("#img3").attr("src", url.createObjectURL(data)); $("#img1").attr("src", $("#img1").attr("src")+"?timestamp=" + new Date().getTime()); }else{ $("#img2").attr("src", $("#img2").attr("src")+"?timestamp=" + new Date().getTime()); // $('#img2').attr('src', url.createObjectURL(data)); // $("#img3").attr("src", url.createObjectURL(data)); } alert('OK'); // } }); return false; } </script> <!-- end: Content --> <?php mysql_free_result($Rt2); // mysql_free_result($Rot2); mysql_free_result($Rtra) ?>
保存
取消
返回文件列表