查看文件: cuser_addweb.php
大小: 10.96 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")) { $INSERTSQL = sprintf("INSERT into cuser (name,name2,passwd,webname,tel1,tel2,fax,addr,addr_2,addr_4,addr_5,addr_6,addr_7,addr_8,lineid ,email,webmemo,website,idate) VALUES(%s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", GetSQLValueString($_POST['name'], "text"), GetSQLValueString($_POST['name2'], "text"), GetSQLValueString($_POST['pw1'], "text"), GetSQLValueString($_POST['webname'], "text"), GetSQLValueString($_POST['tel1'], "text"), GetSQLValueString($_POST['tel2'], "text"), GetSQLValueString($_POST['fax'], "text"), GetSQLValueString($_POST['addr'], "text"), GetSQLValueString($_POST['addr_2'], "int"), GetSQLValueString($_POST['addr_4'], "int"), GetSQLValueString($_POST['addr_5'], "text"), GetSQLValueString($_POST['addr_6'], "text"), GetSQLValueString($_POST['addr_7'], "text"), GetSQLValueString($_POST['addr_8'], "text"), GetSQLValueString($_POST['lineid'], "text"), GetSQLValueString($_POST['email'], "text"), GetSQLValueString($_POST['webmemo'], "text"), GetSQLValueString("bus104user", "text"), GetSQLValueString(date('Y-m-d'), "date")); mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($INSERTSQL, $BE2) or die(mysql_error()); $query_Rtc = sprintf("SELECT cuid FROM cuser where webname='%s' order by cuid desc limit 1",$_POST['webname']); $Rtc = mysql_query($query_Rtc, $BE2) or die(mysql_error()); $row_Rtc = mysql_fetch_assoc($Rtc); $cuid=$row_Rtc['cuid']; $updateSQL = sprintf("UPDATE tb2 SET cuid4='%s' WHERE buid='%s'",$cuid,$_POST['buid']); mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($updateSQL, $BE2) or die(mysql_error()); mysql_free_result($Rtc); $path='/www/bus104/shoppic/'.$cuid; if (!file_exists($path)) { mkdir($path); } //makeqrcode require_once('./tcpdf/tcpdf_barcodes_2d.php'); $code=$_POST['webname']; $pngurl='http://www.bus104.com/'.$code; $barcodeobj = new TCPDF2DBarcode($pngurl, 'QRCODE,H'); // output the barcode as PNG image $filepng2=$path.'/'.$_POST['webname'].".png"; if (file_exists($filepng2)){ unlink($filepng2); } $hex = $color1[$contentcolor] ; $r = hexdec(substr($hex,0,2)); $g = hexdec(substr($hex,2,2)); $b = hexdec(substr($hex,4,2)); $barcodeobj->getBarcodePNG(8, 8, array($r,$g,$b),$filepng2); $write='資料已更新...'; echo "<script>alert('".$write."');</script>"; $updateGoTo =$_POST['url'];// "main.php?act=user"; header(sprintf("Location: %s", $updateGoTo)); } $colname_Rt2 = "-1"; if (isset($_GET['id'])) { $colname_Rt2 = $_GET['id']; } mysql_select_db($database_BE2, $BE2); $query_Rt2 = sprintf("SELECT * FROM tb2 where buid = '%s'",$colname_Rt2 ); $Rt2 = mysql_query($query_Rt2, $BE2) or die(mysql_error()); $row_Rt2 = mysql_fetch_assoc($Rt2); $totalRows_Rt2 = mysql_num_rows($Rt2); mysql_select_db($database_BE2, $BE2); $query_Rt1 = "SELECT * FROM city1 ORDER BY zpa0 ASC"; $Rt1 = mysql_query($query_Rt1, $BE2) or die(mysql_error()); $row_Rt1 = mysql_fetch_assoc($Rt1); $totalRows_Rt1 = mysql_num_rows($Rt1); /* 租車業者內頁 基本資料: 縣巿/區 地址 電話 訂車聯絡人 訂車專線 傳真 E-mail */ ?> <script> function ceForm(){ var s=''; var de1 = $('#ck1').val(); var de2 = $('#ck2').val(); var de3 = $('#ck3').val(); var ck = true; de1=jQuery.trim(de1); de2=jQuery.trim(de2); if( de1!='2.png' ) { s += '帳號為必要欄位及不可重複 ? \n'; ck =false; } if ( de2!='2.png' ){ s +='公司抬頭為必要欄位及不可重複..\n'; // alert("旅遊行程內文請勿少於10個字..\n"); ck = false; } if ( de3!='2' ){ s +='密碼欄位為必要欄位及不可少於6個字..\n'; // alert("旅遊行程內文請勿少於10個字..\n"); ck = false; } if(s != '')alert (s); return ck; } function ckpw(){ var n3=$("#pw1").val(); //console.log(n3); if( n3.length <6){ $("#ck3").val(0); $("#ret3").html('密碼必須大於6個字元'); } else{ $("#ck3").val(2); $("#ret3").html('<img src="images/2.png" />'); } } function ckname(s){ var n1=$("#name").val(); var n2=$("#webname").val(); var url="checkname.php"; var pt=true; //console.log(s); if(s==1){ if( n1.length <6){ $("#ck1").val(0); $("#ret1").html('帳號必須大於6個字元'); pt=false; } } if(s==2){ if( n2.length <4){ $("#ck2").val(0); $("#ret2").html('公司抬頭必須大於4個字元'); pt=false; } } if(pt){ $.post(url,{"s":s,"n1":n1,"n2":n2}, function(data){ //alert(s+','+n1+','+n2); //alert(data); $("#ck"+s).val(data); $("#ret"+s).html('<img src="images/'+data+'" />'); }); } } </script> <form action="" method="POST" name="form1" id="form1" onsubmit="return ceForm(this.form);"> <table width="44%" align="center"> <tr valign="baseline"> <th height="33" align="right" valign="top" nowrap="nowrap"><span class="font2">公司名稱</span></th> <td valign="baseline"><span class="font3"><?php echo $row_Rt2['bc2']; ?></span></td> </tr> <tr valign="baseline"> <th height="33" align="right" valign="top" nowrap="nowrap"><span class="font2">縣市分區</span></th> <td valign="baseline"><span class="font3"><?php echo $row_Rt2['bc3']; ?></span></td> </tr> <tr valign="baseline"> <th height="33" align="right" valign="top" nowrap="nowrap"><span class="font2">分區</span></th> <td valign="baseline"><span class="font3"><?php echo $row_Rt2['bc4']; ?></span></td> </tr> <tr valign="baseline"> <th height="33" align="right" valign="top" nowrap="nowrap"><span class="font2">通訊處</span></th> <td valign="baseline"><span class="font3"><?php echo $row_Rt2['bc5']; ?></span></td> </tr> <tr valign="baseline"> <th height="34" align="right" valign="top" nowrap="nowrap"><span class="font2">電話FAX</span></th> <td valign="baseline"><span class="font3"><?php echo $row_Rt2['bc6']; ?></span></td> </tr> <tr valign="baseline"> <th height="22" align="right" valign="top" nowrap="nowrap"> </th> <td valign="baseline"></td> </tr> <tr valign="baseline"> <th width="20%" height="33" align="right" valign="top" nowrap="nowrap"><span class="font2">帳 號:</span></th> <td width="80%" valign="baseline"><input name="name" type="text" id="name" size="20" onchange="ckname(1)" /><label id="ret1"></label></td> </tr> <tr valign="baseline"> <th height="31" align="right" valign="top" nowrap="nowrap"><span class="font2">密 碼:</span></th> <td valign="baseline"><input name="pw1" type="text" id="pw1" size="20" onchange="ckpw()" /><label id="ret3"></label></td> </tr> <tr valign="baseline"> <th height="31" align="right" valign="top" nowrap="nowrap"><span class="font2">公司抬頭:</span></th> <td valign="baseline"><input name="webname" type="text" id="webname" size="32" onchange="ckname(2)"/><label id="ret2"></label></td> </tr> <tr valign="baseline"> <th height="30" align="right" valign="middle" nowrap="nowrap"><span class="font2">聯絡處:</span></th> <td height="30" align="left" valign="middle" nowrap="nowrap"><input type="text" name="addr" id="addr" size="60" class="addr" readonly="" /></td> </tr> <tr valign="baseline"> <th height="30" align="right" valign="middle" nowrap="nowrap"><span class="font2">訂車聯絡人:</span></th> <td height="30" align="left" valign="middle" nowrap="nowrap"><input name="name2" type="text" id="name2" size="32" /> <input name="addr_2" type="hidden" id="addr_2" value="" /> <input name="addr_5" type="hidden" id="addr_5" value="" /> <input name="addr_4" type="hidden" id="addr_4" value="" /> <input name="addr_7" type="hidden" id="addr_7" value="" /> <input name="addr_9" type="hidden" id="addr_9" value="" /></td> </tr> <tr valign="baseline"> <th height="30" align="right" valign="middle" nowrap="nowrap"><span class="font2">訂車專線1:</span></th> <td height="30" align="left" valign="middle" nowrap="nowrap"><input name="tel1" type="text" id="tel1" size="32" maxlength="12" /> <input name="addr_8" type="hidden" id="addr_8" value="" /> <input name="addr_6" type="hidden" id="addr_6" value="" /></td> </tr> <tr valign="baseline"> <th height="30" align="right" valign="middle" nowrap="nowrap"><span class="font2">訂車專線2:</span></th> <td height="30" align="left" valign="middle" nowrap="nowrap"><input name="tel2" type="text" id="tel2" size="32" maxlength="12" /> <input name="addrfield" type="hidden" id="addrfield" value="addr" /></td> </tr> <tr valign="baseline"> <th height="30" align="right" valign="middle" nowrap="nowrap"><span class="font2">傳真專線:</span></th> <td height="30" align="left" valign="middle" nowrap="nowrap"><label for="stat"> <input name="fax" type="text" id="fax" size="32" /> <input name="ck1" type="hidden" id="ck1" value="0" /> <input name="ck2" type="hidden" id="ck2" value="0" /> <input name="ck3" type="hidden" id="ck3" value="0" /> </label></td> </tr> <tr valign="baseline"> <th height="30" align="right" valign="middle" nowrap="nowrap"><span class="font2">Line ID :</span></th> <td height="30" align="left" valign="middle" nowrap="nowrap"><input name="lineid" type="text" id="lineid" size="32" maxlength="80" /></td> </tr> <tr valign="baseline"> <th height="30" align="right" valign="middle" nowrap="nowrap"><span class="font2">E-mail :</span></th> <td height="30" align="left" valign="middle" nowrap="nowrap"><label for="radio"> <input name="email" type="text" id="email" size="20" maxlength="80" /> </label></td> </tr> <tr valign="baseline"> <td height="40" colspan="2" align="center" valign="middle" nowrap="nowrap"><input type="submit" value="修改資料" /></td> </tr> </table> <input name="buid" type="hidden" id="buid" value="<?php echo $row_Rt2['buid']; ?>" /> <input type="hidden" name="MM_update" value="form1" /> <input name="url" type="hidden" id="url" value="<?= $_SERVER['HTTP_REFERER']; ?>" /> </form> <div id="addrdiv" style="display:none"><? include "addr.php" ;?></div> <?php mysql_free_result($Rt2); mysql_free_result($Rt1); ?>
保存
取消
返回文件列表