查看文件: body_editwebshop.php
大小: 9.8 KB
类型: application/octet-stream
<?php require_once('../Connections/BE2.php'); ?> <?php if (!isset($_SESSION)){ session_start(); } if($_POST["MM_update"] == "fp1"){ //$logpath="/www2/skybni/guest/debug.txt"; //$fp = fopen($logpath, "a"); // fwrite($fp,"log => editweshop " .date('Y-m-d H:i:s')."\r\n"); // fclose($fp); $idpath= sprintf("%07d",$_SESSION['login_memid']) ; $wwwpath='/www2/skybni'; $picpath= "/shop/img/wp_".$idpath.'_'.$_POST['windex']; $wimg="wp_".$idpath.'_'.$_POST['windex']; $tfile="fileToUpload1"; $wimgext=$_POST['wimgext']; 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); } if($_POST['wid']==0){ $updateSQL = sprintf("INSERT INTO webshop (wtitle,wlink,wimg,wimgext,windex,wflag,coid)VALUES (%s,%s,%s,%s,%s,%s,%s)", GetSQLValueString($_POST['wtitle'], "text"), GetSQLValueString($_POST['wlink'], "text"), GetSQLValueString($wimg, "text"), // GetSQLValueString($_POST['coid'], "int"), GetSQLValueString($wimgext, "text"), GetSQLValueString($_POST['windex'], "int"), GetSQLValueString($_POST['wflag'], "int"), GetSQLValueString($_SESSION['login_coid'], "int")); //$_SESSION['login_memid'] } else{ $updateSQL = sprintf("UPDATE webshop SET wtitle=%s,wlink=%s,wimgext=%s,wflag=%s WHERE wid=%s AND coid=%s", GetSQLValueString($_POST['wtitle'], "text"), GetSQLValueString($_POST['wlink'], "text"), GetSQLValueString($wimgext, "text"), GetSQLValueString($_POST['wflag'], "int"), GetSQLValueString($_POST['wid'], "int"), GetSQLValueString($_SESSION['login_coid'], "int")); //$_SESSION['login_memid'] } // fwrite($fp,"updateSQL => " .$updateSQL."\r\n"); // fclose($fp); mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($updateSQL, $BE2) or die(mysql_error()); $msg='更新完成....' ; $updateGoTo = "webshop.html"; 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=false; $arr1=array(); // 1,2,5 fail3,4,6,7,8,9 mysql_select_db($database_BE2, $BE2); $query_Rt1 = "SELECT * FROM webshop WHERE coid= 1 order by windex" ; // $query_Rt3 = sprintf("SELECT * FROM webshop WHERE wid= '%s' ",$id); $Rt1 = mysql_query($query_Rt1, $BE2) or die(mysql_error()); $row_Rt1 = mysql_fetch_assoc($Rt1); $totalRows_Rt1 = mysql_num_rows($Rt1); $i=0; do { if($row_Rt1['wuse']=='Y'){ $arr1[$i]=$row_Rt1['windex']; $i++; } } while ($row_Rt1 = mysql_fetch_assoc($Rt1)); mysql_free_result($Rt1); if (in_array($id, $arr1)){ $canedit=true;} if ($id==0){ $canedit=true;} //if (($id>3) && ($id<10)){ $canedit=true;} mysql_select_db($database_BE2, $BE2); $query_Rt3 = sprintf("SELECT * FROM webshop WHERE coid= '%s' AND windex='%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 name="wtitle" type="text" id="wtitle" class="form-control" placeholder="請輸入圖檔標題" value="<?= isset($row_Rt3['wtitle'])?$row_Rt3['wtitle']:""; ?>" size="40" maxlength="60" /> <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="windex" id="windex" value="<?= $id ?>" /> <input type="hidden" name="coid" id="coid" value="<?= $_SESSION['login_memid'] ?>" /> <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="<?= ($row_Rt3['windex']==5)?'hidden':'text' ;?>" id="wlink" class="form-control" placeholder="請輸入圖檔連結" value="<?= $row_Rt3['wlink'] ; ?>" size="40" maxlength="200" /> <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="coid" name="coid" value="<?= $row_Rt3['coid'] ; ?>" /> </form> </div> </div> </div> <div class="col-sm-6"> <? if(isset($row_Rt3['wimgext'])){?> <img name="simg" id="simg" src="/shop/img/wp_<?= sprintf("%07d",$_SESSION['login_memid']).'_'.$id.'.'.$row_Rt3['wimgext'] ?>" alt="" /> <? }?> </div> </div> <!-- end: Content --> <br><br><br> <? } ?> <button onclick="window.location.href='webshop.html';" >回上頁</button> <!-- end: Content --> <?php mysql_free_result($Rt3); ?>
保存
取消
返回文件列表