查看文件: marketshop_add.php
大小: 10.63 KB
类型: application/octet-stream
<?php require('system/login.php'); ?> <?php require_once('../Connections/BE2.php'); ?> <?php if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { mysql_select_db($database_BE2, $BE2); $sql="SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'newskybni'AND TABLE_NAME = 'shop5'"; $Rt2 = mysql_query($sql, $BE2) or die(mysql_error()); $row_Rt2 = mysql_fetch_assoc($Rt2); $last_id=$row_Rt2['AUTO_INCREMENT']; $wwwpath='/www2/skybni'; $picpath= "/number_jpg/m_".$last_id; $spicpath= "/number_jpgs/m_".$last_id; $tfile="fileToUpload1"; $wimgext=''; $img_ext_array=array("jpg","jpeg","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; 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; $picn=$wwwpath.$spicpath.".png"; //$extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); switch ($imgext) { case 'jpg': case 'jpeg': $image = imagecreatefromjpeg($spic); break; case 'gif': $image = imagecreatefromgif($spic); break; case 'png': $image = imagecreatefrompng($spic); break; } imagepng($image, $picn); $chk_file=true; $c=time()+10; $ff=0; while($chk_file) { if (file_exists($picn)){ $ff=1; $chk_file=false; } $c1=time(); if($c1>$c){ $chk_file=false; } } if($ff>0){ $repic ='/www2/skybni/number_jpg/m_'.$last_id.".png"; $syscall_3b="/usr/local/bin/convert $picn -resize 100x100 -size 100x100 xc:white +swap -gravity center -composite $repic"; $output2=`$syscall_3b`; } } } // "INSERT INTO shop5 (si10,si10b,sicf,address_id)VALUES('0','%s','N','1')",$coid ; // si10 超商 , si10b companyID,sicf 啟用,address_id //$_POST['si11'] is_null $si11=($_POST['si11']==null)?'':$_POST['si11'];// strlen($str) == 0 $si12=($_POST['si12']==null)?'':$_POST['si12'];// strlen($str) == 0 $si14=(strlen($_POST['si14'])==0)?'1':$_POST['si14'];// strlen($str) == 0 $updateSQL = sprintf("INSERT INTO shop5(si10,si10b,sicf,smid,si5,si6,si6a,si11,si12,si13,si14,address_id)VALUES('0','0','Y',%s,%s,%s,%s,%s,%s,%s,%s,%s)", GetSQLValueString($_POST['mid'], "int"), GetSQLValueString($_POST['si5'], "text"), GetSQLValueString($_POST['si6'], "text"), GetSQLValueString($_POST['si6a'], "text"), GetSQLValueString($si11, "text"), GetSQLValueString($si12, "text"), GetSQLValueString($_POST['si13'], "text"), GetSQLValueString($si14, "text"), GetSQLValueString($_POST['maddress_id'], "int")); mysql_select_db($database_BE2, $BE2); mysql_query($updateSQL, $BE2) or die(mysql_error()); // echo $upSQL; $updateGoTo =$_POST['url']; echo "<script>alert('新增完成 ..');location.href='".$updateGoTo."';</script>"; //https://www.skybni.com/search.html?search2=%E8%A1%97%E9%81%93%E7%B6%B2%E5%BA%97%E5%95%86%E5%9F%8E&keyword=%E5%8F%B0%E5%8C%97%E5%B8%82%E6%96%87%E5%B1%B1%E5%8D%80%E6%94%BF%E5%A4%A7%E4%B8%80%E8%A1%97%E9%9B%99%E8%99%9F%E5%81%B4# //台北市文山區政大一街 } //SELECT a.*, b.* FROM marketstreet as a left join shop5 as b on a.mid=b.smid where a.mid='1' order by b.smid $mid='-1'; if (isset($_GET['mid'])) { $mid= $_GET['mid']; } mysql_select_db($database_BE2, $BE2); // address_id county district street $query_Rt2 = sprintf("SELECT * FROM marketstreet where mid='%s'",$mid); $Rt2 = mysql_query($query_Rt2, $BE2) or die(mysql_error()); $row_Rt2 = mysql_fetch_assoc($Rt2); $totalRows_Rt2 = mysql_num_rows($Rt2); ?> <div class="row"> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">街道網店商城-新增</h3> </div> <form action="" method="post" name="form1" id="form1" enctype="multipart/form-data"> <table width="51%" align="center"> <tr valign="baseline"> <th height="38" colspan="2" align="center" valign="middle" nowrap="nowrap"><h2><?= $row_Rt2['mname']?></h2></th> </tr> <tr valign="baseline"> <th width="26%" height="42" align="center" valign="middle" nowrap="nowrap"><span class="font2">商店名稱說明:</span></th> <td width="74%" valign="middle"><span class="col-md-8"> <input name="si5" type="text" id="si5" value="" maxlength="24" /> </span></td> </tr> <tr valign="baseline"> <th height="42" align="center" valign="middle" nowrap="nowrap">城市:</th> <td valign="middle"><table width="100%" border="0" cellpadding="0"> <tr> <? $ss0='';?> <td width="15%" height="4"><input name="si11" type="text" class="form-control g-color-black g-bg-white g-bg-white--focus g-brd-gray-light-v4 g-brd-primary--hover rounded g-py-10 g-px-15" id="si11" placeholder="巷" value="<?=$ss0;?>" size="4" maxlength="4" /></td> <td width="12%">巷</td> <td width="15%"><input name="si12" type="text" class="form-control g-color-black g-bg-white g-bg-white--focus g-brd-gray-light-v4 g-brd-primary--hover rounded g-py-10 g-px-15" id="si12" placeholder="弄" value="<?=$ss0;?>" size="4" maxlength="4" /></td> <td width="12%">弄</td> <td width="15%"><input name="si13" type="text" required="required" class="form-control g-color-black g-bg-white g-bg-white--focus g-brd-gray-light-v4 g-brd-primary--hover rounded g-py-10 g-px-15" id="si13" placeholder="號" onchange="show_id()" value="<?=$ss0;?>" size="4" maxlength="4"/></td> <td width="12%">號</td> <td width="15%"><input name="si14" type="text" class="form-control g-color-black g-bg-white g-bg-white--focus g-brd-gray-light-v4 g-brd-primary--hover rounded g-py-10 g-px-15" id="si14" placeholder="樓" onchange="show_id()" value="<?=$ss0;?>" size="4" maxlength="4"/></td> <td width="13%">樓</td> </tr> </table></td> </tr> <tr valign="baseline"> <th height="42" colspan="2" align="center" valign="middle" nowrap="nowrap"><input id="si6" name="si6" type="text" required="required" class="form-control g-color-black g-bg-white g-bg-white--focus g-brd-gray-light-v4 g-brd-primary--hover rounded g-py-10 g-px-15" placeholder="地址" value="" readonly="readonly"/> <input id="si6a" name="si6a" type="hidden" value=" <? $s=str_replace(",","",$row_Rt2['maddress_name']); echo $s?>" /> </th> </tr> <tr valign="baseline"> <th height="42" align="center" valign="middle" nowrap="nowrap"><span class="form-group"> <label class="col-md-3 control-label" for="fileToUpload1">圖檔:</label> </span></th> <td valign="middle"><input name="fileToUpload1" type="file" id="fileToUpload1" /> <span class="help-block">圖檔(jpg,png) : Size 100 x 100 px </span></td> </tr> <tr valign="baseline"> <td height="40" colspan="2" align="center" valign="middle" nowrap="nowrap"><input type="submit" value="更新" /></td> </tr> </table> <input type="hidden" name="MM_update" id="MM_update" value="form1" /> <input name="url" type="hidden" id="url" value="<?= $_SERVER['HTTP_REFERER']; ?>" /> <span class="col-md-8"> <input id="maddress_id" name="maddress_id" type="hidden" value="<?= $row_Rt2['maddress_id'] ?>" readonly="readonly" /> </span> <span class="col-md-8"> <input id="maddress_name" name="maddress_name" type="hidden" value="<?= $row_Rt2['maddress_name'] ?>" readonly="readonly" /> </span> <span class="col-md-8"> <input id="mid" name="mid" type="hidden" value="<?= $row_Rt2['mid'] ?>" readonly="readonly" /> </span> </form> <div id="back"><a href="javascript:history.back();"><img src="images/back.gif" alt="回上一頁" title="回上一頁" width="115" height="32" border="0"></a></div> </div> </div> </div> <script type="text/javascript"> function Selectstreet() { var county= $("#city").val(); // $(city).find(':selected')[0].id; var district = $("#district").val(); //.find(':selected')[0].id; $.ajax({ type: 'POST', url: 'SelectstreetApi.php', data: { 'county': county,'district':district }, success: function (data) { // the next thing you want to do var $street = $('#street'); $street.empty(); $("select#street").html(data); show_id(); } }); } function Selectcity() { var county= $("#city").val(); // $(city).find(':selected')[0].id; $.ajax({ type: 'POST', url: 'SelectcityApi.php', data: {'county': county}, success: function (data) { // the next thing you want to do var $street = $('#street'); $street.empty(); var $district = $('#district'); $district.empty(); $("select#district").html(data); Selectstreet(); } }); } function show_id(){ //var s=$('#city').val()+","+$('#district').val()+","+$.trim($('#street').find(":selected").text()); //$('#maddress_id').val($('#street').val()); //$('#maddress_name').val(s); <? // $s=str_replace(",","",$row_Rt2['maddress_name']); ?> var s= $('#si6a').val(); //$('#city').val() +$('#district').val()+$.trim($('#street').find(":selected").text()); //$('#aioConceptName :selected').text(); // var county= $("#city").val(); //$('#si6a').val(s); s=s+$('#si13').val()+'號'; if($('#si14').val()!=''){ s=s+$('#si14').val()+'樓'; } $('#si6').val(s); //$('#address_id').val($('#street').val()); // alert(1); } </script> <? mysql_free_result($Rt2); ?>
保存
取消
返回文件列表