查看文件: body_editnetinshop2b.php
大小: 10.96 KB
类型: application/octet-stream
<?php require_once('../Connections/BE2.php'); ?> <?php if (!isset($_SESSION)){ session_start(); } if($_SESSION['login_companyck']<>"Y"){ return -1 ;} if( isset($_POST["MM_update"]) && ($_POST["MM_update"] == "fp1")){ $idpath= sprintf("%07d",$_SESSION['login_coid']) ; $wwwpath='/www2/skybni'; $picpath= "/shop/img/wpi_".$idpath.'_'.$_POST['wrand']; $spicpath= "/shop/simg/wpi_".$idpath.'_'.$_POST['wrand']; $wimg="wpi_".$idpath.'_'.$_POST['wrand']; $tfile="fileToUpload1"; $wimgext=$_POST['wimgext']; $img_ext_array=array("jpg","jpeg","bmp","png","gif"); if($_FILES[$tfile]["name"]<>''){ $ext= explode('.',$_FILES[$tfile]['name']) ; $imgext=strtolower($ext[count($ext)-1]); //取最後一筆 if(in_array($imgext,$img_ext_array)){ $spic=$wwwpath.$spicpath.".".$imgext; $wimgext=$imgext; move_uploaded_file($_FILES[$tfile]["tmp_name"],$spic); $chk_file=true; while($chk_file) { if (file_exists($spic)){ $chk_file=false; } } $pic=$wwwpath.$picpath.".".$imgext; $syscall_3a="/usr/local/bin/convert $spic -thumbnail \"300x300^\" $pic"; $output1=`$syscall_3a`; $chk_file=true; while($chk_file) { if (file_exists($pic)){ $chk_file=false; } } $repic ='/www2/skybni/shop/reimg/wpi_'.$idpath.'_'.$_POST['wrand'].".".$imgext; $syscall_3b="/usr/local/bin/convert $spic -resize 300x300 -size 300x300 xc:white +swap -gravity center -composite $repic"; $output2=`$syscall_3b`; } } if($_POST['wid']==0){ $updateSQL = sprintf("INSERT INTO ecardext (wtitle,wlink,wimg,wimgext,windex,wflag,wkid,wkid2,wrand,wuid)VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", GetSQLValueString($_POST['wtitle'], "text"), GetSQLValueString($_POST['wlink'], "text"), GetSQLValueString($wimg, "text"), GetSQLValueString($wimgext, "text"), GetSQLValueString($_POST['windex'], "int"), GetSQLValueString($_POST['wflag'], "int"), GetSQLValueString($_POST['wkid'], "int"), GetSQLValueString('I', "text"), // P= product, I = user define image GetSQLValueString($_POST['wrand'], "text"), // P= product, I = user define image GetSQLValueString($_SESSION['login_coid'], "int")); } else{ $updateSQL = sprintf("UPDATE ecardext SET wtitle=%s,wlink=%s,wimgext=%s,wflag=%s,windex=%s ,wrand=%s WHERE wkid=2 AND wid=%s AND wuid=%s", GetSQLValueString($_POST['wtitle'], "text"), GetSQLValueString($_POST['wlink'], "text"), GetSQLValueString($wimgext, "text"), GetSQLValueString($_POST['wflag'], "int"), GetSQLValueString($_POST['windex'], "int"), GetSQLValueString($_POST['wrand'], "int"), GetSQLValueString($_POST['wid'], "int"), GetSQLValueString($_SESSION['login_coid'], "int")); } mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($updateSQL, $BE2) or die(mysql_error()); $msg='更新完成....' ; $updateGoTo = "netinshop2.html"; //webshop2 // echo $updateSQL; echo "<script>alert('".$msg."');location.href='".$updateGoTo."';</script>"; } //update `member` set company_title=mem_name WHERE mem_auto>10 and mem_auto<26 $id=-1; $id= (isset($_GET["id"]))?$_GET["id"]:-1; $canedit=true; // if($id>45){ $id=45;} // mysql_select_db($database_BE2, $BE2); $query_Rt3 = sprintf("SELECT * FROM ecardext WHERE wkid=2 AND wuid= '%s' AND wid='%s' " ,$_SESSION['login_coid'],$id); // $query_Rt3 = sprintf("SELECT * FROM webshop WHERE wid= '%s' ",$id); $Rt3 = mysql_query($query_Rt3, $BE2) or die(mysql_error()); $row_Rt3 = mysql_fetch_assoc($Rt3); $totalRows_Rt3 = mysql_num_rows($Rt3); ?> <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> <? if($canedit){ ?> <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"> <form action="" method="post" name="fop1" id="fop1" enctype="multipart/form-data"> <div class="form-group"> <label class="col-md-3 control-label" for="wtitle"> 標題說明: </label> <div class="col-md-9"> <input type="text" name="wtitle" id="wtitle" placeholder="請填寫名片標題" value="<?= isset($row_Rt3['wtitle'])?$row_Rt3['wtitle']:""; ?>" maxlength="200" size="40"/> <input type="hidden" name="wid" id="wid" value="<?= isset($row_Rt3['wid'])?$row_Rt3['wid']:0; ?>" /> <input type="hidden" name="wimg" id="wimg" value="<?= isset($row_Rt3['wimg'])?$row_Rt3['wimg']:"" ?>" /> <input type="hidden" name="wimgext" id="wimgext" value="<?= isset($row_Rt3['wimgext'])?$row_Rt3['wimgext']:""; ?>" /> <input type="hidden" name="wkid" id="wkid" value="2" /> <input type="hidden" name="wuid" id="wuid" value="<?= $_SESSION['login_coid'] ?>" /> <input type="hidden" name="wkid2" id="wkid2" value="I" /> <span class="help-block"> </span> <input type="hidden" name="wrand" id="wrand" value="<?= isset($row_Rt3['wrand'])?$row_Rt3['wrand']: sprintf("%04d",rand(1,9999)); ?>" /> </div> </div> <br><br> <div class="form-group"> <label class="col-md-3 control-label" for="windex"> 請填排列順序: </label> <div class="col-md-9"> <input type="text" name="windex" id="windex" value="<?= isset($row_Rt3['windex'])?$row_Rt3['windex']:"0"; ?>" placeholder="請填排列順序"/> <span class="help-block"> </span> </div> </div> <br><br> <div class="form-group"> <label class="col-md-3 control-label" for="wlink">連結:</label> <div class="col-md-9"> <input name="wlink" type="text" id="wlink" placeholder="請填寫要連結的網址" value="<?= $row_Rt3['wlink'] ; ?>" maxlength="200" size="40" /> <span class="help-block"> </span> </div> </div> <div class="form-group"> <label class="col-md-3 control-label" for="wlink">啟用:</label> <div class="col-md-9"> <? $ss= isset($row_Rt3['wflag'])?$row_Rt3['wflag']:"1"; ?> 啟用<input name="wflag" type="radio" id="wflag" value="1" <?= ($ss==1)?'checked="checked"':'' ?> /> 不啟用<input type="radio" name="wflag" id="wflag" value="0" <?= ($ss==0)?'checked="checked"':'' ?>/> <span class="help-block"> </span> </div> </div> <div class="form-group"> <label class="col-md-3 control-label" for="fileToUpload1">圖檔:</label> <div class="col-md-9"> <input name="fileToUpload1" type="file" id="fileToUpload1" /> <span class="help-block"> 圖檔 Size 350 x 350 dpi </span> </div> </div> <div class="form-group"> <div class="col-md-9"> <span class="help-block"> </span> </div> </div> <div class="form-group"> <div class="col-md-9"> <span class="help-block"></span> </div> </div> <div class="form-group form-actions"> <button type="submit" class="btn btn-primary">保存</button> </div> <input type="hidden" name="MM_update" value="fp1" /> <input type="hidden" id="wuid" name="wuid" value="<?= $row_Rt3['wuid'] ; ?>" /> </form> </div> </div> </div> <div class="col-sm-6"> <? if(isset($row_Rt3['wimgext'])){ $imgpic ='/shop/reimg/wpi_'.sprintf("%07d",$_SESSION['login_coid']).'_'.$row_Rt3['wrand'].".".$row_Rt3['wimgext']; ?> <img name="simg" id="simg" src="<?= $imgpic ?>" width="350" height="350" /> <? }?> </div> </div> <!-- end: Content --> <? } ?> <button onclick="window.location.href='netinshop2.html';" >回上頁</button> <!-- end: Content --> <?php mysql_free_result($Rt3); ?>
保存
取消
返回文件列表