查看文件: market_qmake.php
大小: 11.19 KB
类型: application/octet-stream
<?php require('system/login.php'); ?> <?php require_once('../Connections/BE2.php'); ?> <?php function wf_to_nf($strs ){ //全形半形轉換 $wft = array( '一段', '二段', '三段', '四段', '五段', '六段', '七段', '八段', '九段'); $nft = array( "1段", "2段", "3段", "4段", "5段", "6段", "7段", "8段", "9段"); $a1=str_replace($wft,$nft,$strs); //半形到全形 return $a1; } function wf_to_nfp2($strs ){ //全形半形轉換 $wft = array( '一段', '二段', '三段', '四段', '五段', '六段', '七段', '八段', '九段', "大道"); $nft = array( "1段", "2段", "3段", "4段", "5段", "6段", "7段", "8段", "9段", "大道"); //return str_replace($wft,$nft,$strs); //半形到全形 global $str01 ; global $str02 ; $a1=str_replace($nft,$wft,$strs); //半形到全形 $str01=$a1 ; foreach ($wft as $letter) { if (strpos($a1, $letter) !== false) { //$flag = true; $str01=str_replace($letter,"",$a1); $str02=$letter ; } } return $a1; } if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $w=true; $wmaster=false; if($_POST['mname']==''|| $_POST['city']==''){ $w=false;} if($w){ $query_Rt1 = sprintf("select * from marketmaster WHERE msname='%s'",$_POST['mname']) ; $Rt1 = mysql_query($query_Rt1, $BE2) or die(mysql_error()); $row_Rt1 = mysql_fetch_assoc($Rt1); $totalRows_Rt1 = mysql_num_rows($Rt1); if($totalRows_Rt1==0){ $wmaster=true;} $txt=explode("\r\n",$_POST['text2']); $ind=($_POST['ind']==0)?0:$_POST['ind']-50; for($x1=0;$x1<count($txt);$x1++){ echo $x1.'=>'.trim($txt[$x1]).' ' ; $s=wf_to_nf(trim($txt[$x1])); mysql_select_db($database_BE2, $BE2); $query_Rt3 = sprintf("select * from address WHERE county='%s' AND street='%s' ",$_POST['city'],$s) ; $Rt3 = mysql_query($query_Rt3, $BE2) or die(mysql_error()); $row_Rt3 = mysql_fetch_assoc($Rt3); $totalRows_Rt3 = mysql_num_rows($Rt3); // echo $query_Rt3 .'<br>'; if($totalRows_Rt3>0){ echo 'PASS <br>'; $maddress_id=$row_Rt3['address_id']; $maddress_name=$row_Rt3['county'].','.$row_Rt3['district'].','.$row_Rt3['street']; //$row_Rt2['maddress_name'] //台北市,南港區,市民大道8段 $vimg=sprintf("%04d",$x1+1).'_'.date('Ymdhis',time()).'_1.png' ; $vimg2=sprintf("%04d",$x1+1).'_'.date('Ymdhis',time()).'_2.png' ; $savepath = '/www2/skybni/submarket/images/'; $background="/www2/skybni/test007/bb.png"; $myfont="/www2/skybni/fonts/wt009.ttf"; $im = imagecreatefrompng($background); $im2 = imagecreatefrompng($background); $white = ImageColorAllocate($im, 255,255,255); $point_y=array(105,165,225,285);//high $point_4x=40; $doc1=explode(",",$maddress_name); $str01=''; $str02=''; $doc1[2]= wf_to_nfp2($doc1[2]); //台北市 南港區 南港路1段 單號 $str02n = $str02.'單號' ;//$row_Rt2['mside']; //1段單號 $str03 ='網店商城'; if(mb_strlen($str01)==5){ //五谷王 南街單號 if(mb_strlen($str02n)==2){ $str02n=mb_substr($str01,3,2,"utf-8").$str02n; $str01=mb_substr($str01,0,3,"utf-8"); } } $drawstr=array($str01,$str02n,'網店商城'); for ($i=0;$i<3;$i++){ $l=mb_strlen($drawstr[$i]); if($l==2){ $word=mb_substr( $drawstr[$i],0,1,"utf-8"); ImageTTFText($im,40,0,40,$point_y[$i], $white,$myfont,$word); $word=mb_substr( $drawstr[$i],1,1,"utf-8") ; ImageTTFText($im,40,0,200,$point_y[$i], $white,$myfont,$word); }else if($l==3){ $word=mb_substr( $drawstr[$i],0,1,"utf-8"); ; ImageTTFText($im,40,0,40,$point_y[$i], $white,$myfont,$word); $word=mb_substr( $drawstr[$i],1,1,"utf-8") ; ImageTTFText($im,40,0,120,$point_y[$i], $white,$myfont,$word); $word=mb_substr( $drawstr[$i],2,1,"utf-8") ; ImageTTFText($im,40,0,200,$point_y[$i], $white,$myfont,$word); }else if($l==4){ $word=$drawstr[$i]; ImageTTFText($im,40,0,40,$point_y[$i], $white,$myfont,$word); } } ImagePNG($im, $savepath.$vimg); ImageDestroy($im); $str02n = $str02.'雙號'; if(mb_strlen($str01)==5){ //五谷王 南街單號 if(mb_strlen($str02n)==2){ $str02n=mb_substr($str01,3,2,"utf-8").$str02n; $str01=mb_substr($str01,0,3,"utf-8"); } } $drawstr=array($str01,$str02n,'網店商城'); for ($i=0;$i<3;$i++){ $l=mb_strlen($drawstr[$i]); if($l==2){ $word=mb_substr( $drawstr[$i],0,1,"utf-8"); ;//'南港路' ;//substr($authnum,$c,1); ImageTTFText($im2,40,0,40,$point_y[$i], $white,$myfont,$word); $word=mb_substr( $drawstr[$i],1,1,"utf-8") ;//'南港路' ;//substr($authnum,$c,1); ImageTTFText($im2,40,0,200,$point_y[$i], $white,$myfont,$word); }else if($l==3){ $word=mb_substr( $drawstr[$i],0,1,"utf-8"); ;//'南港路' ;//substr($authnum,$c,1); ImageTTFText($im2,40,0,40,$point_y[$i], $white,$myfont,$word); $word=mb_substr( $drawstr[$i],1,1,"utf-8") ;//'南港路' ;//substr($authnum,$c,1); ImageTTFText($im2,40,0,120,$point_y[$i], $white,$myfont,$word); $word=mb_substr( $drawstr[$i],2,1,"utf-8") ;//'南港路' ;//substr($authnum,$c,1); ImageTTFText($im2,40,0,200,$point_y[$i], $white,$myfont,$word); }else if($l==4){ $word=$drawstr[$i]; ImageTTFText($im2,40,0,40,$point_y[$i], $white,$myfont,$word); } } ImagePNG($im2, $savepath.$vimg2); ImageDestroy($im2); $ind +=50; $insertSQL = sprintf("INSERT INTO marketstreet(mname,mcounty,maddress_id,mside,maddress_name,mind,mpic,fcc)VALUES('%s','%s','%s','%s','%s','%s','%s',1)", $_POST['mname'],$_POST['city'],$maddress_id,'單號',$maddress_name,$ind,$vimg); mysql_query($insertSQL, $BE2) or die(mysql_error()); $ind +=50; $insertSQL = sprintf("INSERT INTO marketstreet(mname,mcounty,maddress_id,mside,maddress_name,mind,mpic,fcc)VALUES('%s','%s','%s','%s','%s','%s','%s',1)", $_POST['mname'],$_POST['city'],$maddress_id,'雙號',$maddress_name,$ind,$vimg2); mysql_query($insertSQL, $BE2) or die(mysql_error()); }else { echo ' not Found<br>' ; } // $mname=$_POST['mname']; $_GET['mname']=$_POST['mname']; } } else{ echo "<script>alert('商圈及城市名稱 不可空白!');</script>"; } if($wmaster){ $insertSQL2 = sprintf("INSERT INTO marketmaster(msname,mslink)VALUES(%s,%s)", GetSQLValueString($_POST['mname'], "text"), GetSQLValueString('/'.$_POST['mname'].'介紹.html', "text")); mysql_query($insertSQL2, $BE2) or die(mysql_error()); } } $city='-1'; if (isset($_GET['city'])) { $city = $_GET['city']; } $mname='-1'; if (isset($_GET['mname'])) { $mname = $_GET['mname']; } mysql_select_db($database_BE2, $BE2); // address_id county district street $query_Rot2 = "SELECT distinct(county) FROM address where 1 order by address_id"; $Rot2 = mysql_query($query_Rot2, $BE2) or die(mysql_error()); $row_Rot2 = mysql_fetch_assoc($Rot2); $totalRows_Rot2 = mysql_num_rows($Rot2); ?> <div class="row"> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">街道網店商城-快速新增</h3> <br><a href="main.php?act=market_list<?= (isset($mname)&&($mname<>'-1'))?'&selkid='.$mname:"" ; ?>"> 回街道商圈管理</a> </div> <form action="" method="post" name="form1" id="form1" enctype="multipart/form-data"> <table width="64%" align="center"> <tr valign="baseline"> <th height="38" colspan="3" align="center" valign="middle" nowrap="nowrap"> </th> </tr> <tr valign="baseline"> <th width="24%" height="42" align="center" valign="middle" nowrap="nowrap"><span class="font2">商圈名稱說明:</span></th> <td width="73%" valign="middle"><span class="col-md-8"> <input name="mname" type="text" id="mname" value="" maxlength="24" /> <br> 字符串不要包含符号</span></td> </tr> <tr valign="baseline"> <th height="42" align="center" valign="middle" nowrap="nowrap">城市:</th> <td valign="middle"><? $address_name= $city.',';?><select name="city" id="city" class="form-control placeholder col-xs-12 col-sm-4 mb-4" > <option value=""></option> <? do { ?> <option value="<?= $row_Rot2['county']; ?>" ><?= $row_Rot2['county']; ?></option> <?php } while ($row_Rot2 = mysql_fetch_assoc($Rot2)); ?> </select></td> </tr> <tr valign="baseline"> <th height="42" align="center" valign="middle" nowrap="nowrap"><span class="font2">街道區域</span>:</th> <td valign="middle"><span class="col-md-8"> <textarea name="text2" cols="60" rows="8" id="text2">北投路二段 北投路一段 新市街</textarea> </span></td> </tr> <tr valign="baseline"> <th height="42" align="center" valign="middle" nowrap="nowrap">排序啟始值:</th> <td valign="middle"><span class="col-md-8"> <input name="ind" type="text" id="ind" value="0" size="5" maxlength="5" /> </span></td> </tr> <tr valign="baseline"> <th height="42" align="center" valign="middle" nowrap="nowrap"> </th> <td valign="middle"> </td> </tr> <tr valign="baseline"> <th height="42" align="center" valign="middle" nowrap="nowrap"> </th> <td valign="middle"> </td> </tr> <tr valign="baseline"> <td height="40" align="center" valign="middle" nowrap="nowrap"> </td> <td height="40" align="center" valign="middle" nowrap="nowrap"> </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="<?= isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:''; ?>" /> <span class="col-md-8"> <input id="maddress_id" name="maddress_id" type="hidden" value="<?= $address_id ?>" readonly="readonly" /> </span> <span class="col-md-8"> <input id="maddress_name" name="maddress_name" type="hidden" value="<?= $address_name ?>" readonly="readonly" /> </span> </form> <div class="clearfix"> </div> <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> <? mysql_free_result($Rot2); ?>
保存
取消
返回文件列表