查看文件: index_registerform.php
大小: 15.06 KB
类型: application/octet-stream
<?php require_once('Connections/BE2.php'); if (!isset($_SESSION)){ session_start(); } function ge2($length = 2) { $characters = 'abcdefghijklmnopqrstuvwxyz'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $randomString; } function ge5($length = 5) { $characters = '012356789'; //0123456789 $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $randomString; } if ((isset($_POST["registerform"])) && ($_POST["registerform"] == "form1")) { $mobile=$_POST['mem_mobile']; // if($pas1==$pas2) mysql_select_db($database_BE2, $BE2); $query_Rft2 = "SELECT * FROM member where mem_mobile='$mobile' "; $Rft2 = mysql_query($query_Rft2, $BE2) or die(mysql_error()); $row_Rft2 = mysql_fetch_assoc($Rft2); $totalRows_Rft2 = mysql_num_rows($Rft2); $t=$totalRows_Rft2; mysql_free_result($Rft2); if($t==0){ $k=1; $scode=""; while($k>0){ $scode = ge2().ge5(); $q2= "SELECT * FROM member where scode='$scode' "; $Rq2 = mysql_query($q2, $BE2) or die(mysql_error()); $row_Rq2 = mysql_fetch_assoc($Rq2); $k = mysql_num_rows($Rq2); } mysql_free_result($Rq2); $mem_time=date('Y-m-d H:i:s'); $mem_code=($_POST['mem_code']=='')?1:$_POST['mem_code']; // mem_address street 路街 ,mem_address2 street_number 號 ,mem_address3 street_number3 樓 // mcapture=1 ;;/ set upload $insertSQL = sprintf("INSERT INTO member(mem_time,mem_uptime, mem_mobile, mem_passwd, scode, mem_free,mcapture, mem_num) VALUES (%s, %s, %s, %s, %s, %s, %s, %s )", GetSQLValueString($mem_time, "text"), GetSQLValueString($mem_time, "text"), GetSQLValueString($_POST['mem_mobile'], "text"), GetSQLValueString($_POST['mem_passwd'], "text"), GetSQLValueString($scode, "text"), GetSQLValueString("1", "text"), GetSQLValueString("1", "text"), GetSQLValueString($_POST['bid'], "int")); mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($insertSQL, $BE2) or die(mysql_error()); $doc='歡迎新會員加入 SKYBNI 請盡快上傳企業資料,已完成資料審核 , SKYBNI 敬上.'; $Ins_guestdoc = sprintf("INSERT INTO guestdoc(guid,gdate,gsource,gdoc) Select mem_auto,concat('%s'),concat('%s'),concat('%s') from member WHERE mem_mobile ='%s' order by mem_auto desc limit 1",date('Y-m-d'),1,$doc,$_POST['mem_mobile']); mysql_query($Ins_guestdoc, $BE2) or die(mysql_error()); $q2= "SELECT mem_auto FROM member where scode='$scode' "; $Rq2 = mysql_query($q2, $BE2) or die(mysql_error()); $row_Rq2 = mysql_fetch_assoc($Rq2); $k = mysql_num_rows($Rq2); $euid=$row_Rq2['mem_auto']; $_SESSION['login_memid']=$row_Rq2['mem_auto']; //tzhu $_SESSION['login_mobile']=$row_Rft2['mem_mobile']; //A,B,C $_SESSION['login_memname']=$row_Rft2['mem_name']; $_SESSION['login_companyck']=$row_Rft2['mem_check'];//$row_Rft2['ck_company']; $_SESSION['mem_free']=$row_Rft2['mem_free']; //userid // add company blank data $t=date('Y-m-d H:i:s'); $Ins_01 = sprintf("INSERT INTO company(mid,co_time)VALUES('%s','%s')",$_SESSION['login_memid'],$t); mysql_select_db($database_BE2, $BE2); mysql_query($Ins_01, $BE2) or die(mysql_error()); mysql_free_result($Rq2); $insertSQL6 =sprintf("insert into order_point(eccid,emem_num,euid,e_type,e_ival,e_date,e_flag)VALUES('0',%s,%s,%s,%s,%s,'Y')", GetSQLValueString($euid, "int"), //mem_auto 自己 ID GetSQLValueString($_POST['bid'], "int"), // 介紹人ID e_flag 可用 GetSQLValueString("6", "int"), // 招募雲點 order_rtype GetSQLValueString($_POST['Rtype_pric'], "int"), // 3 點 //Rtype_pric GetSQLValueString(date('Y-m-d'), "text")); mysql_select_db($database_BE2, $BE2); mysql_query($insertSQL6, $BE2) or die(mysql_error()); $insertGoTo = '/guest/editecardfile.html'; // $insertGoTo = '/新會員.html'; $write='資料已更新...'; echo "<script>alert('".$write."');location.href='".$insertGoTo."';</script>"; } else{ echo "<script>alert('手機號已註冊過了');</script>"; } //$mobile } mysql_select_db($database_BE2, $BE2); // address_id county district street $query_Rat2 = "SELECT distinct(district) FROM address where county='台北市' order by district"; $Rat2 = mysql_query($query_Rat2, $BE2) or die(mysql_error()); $row_Rat2 = mysql_fetch_assoc($Rat2); $totalRows_Rat2 = mysql_num_rows($Rat2); $district=$row_Rat2['district']; if (isset($_POST['district'])){$district=$_POST['district']; } mysql_select_db($database_BE2, $BE2); // address_id county district street $bid=1; $recom=""; //echo 'Hello ' . htmlspecialchars($_COOKIE["name"]) . '!'; if(isset($_GET['recom'])){ mysql_select_db($database_BE2, $BE2); $qscode = sprintf("SELECT * FROM member WHERE scode='%s'",trim($_GET['recom']));// 會員 $_GET['recom'] $Rqs = mysql_query($qscode, $BE2) or die(mysql_error()); $row_Rqs = mysql_fetch_assoc($Rqs); $totalRows_Rqs = mysql_num_rows($Rqs); if($totalRows_Rqs>0){$bid=$row_Rqs['mem_auto']; $recom= $row_Rqs['scode'];} else{$bid=1; $recom= "";} mysql_free_result($Rqs); } if($bid==1){ $recom=isset($_COOKIE["scode"])?htmlspecialchars($_COOKIE["scode"]):''; if($recom<>''){ mysql_select_db($database_BE2, $BE2); $qscode = sprintf("SELECT * FROM member WHERE scode='%s'",$recom);// 會員 $_GET['recom'] $Rqs = mysql_query($qscode, $BE2) or die(mysql_error()); $row_Rqs = mysql_fetch_assoc($Rqs); $totalRows_Rqs = mysql_num_rows($Rqs); if($totalRows_Rqs>0){$bid=$row_Rqs['mem_auto']; $recom= $row_Rqs['scode'];} else{$bid=1; $recom= "";} mysql_free_result($Rqs); } } mysql_select_db($database_BE2, $BE2); $query_Rtype = "SELECT * FROM order_rtype where rid=6";// 招募雲點 $Rtype= mysql_query($query_Rtype, $BE2) or die(mysql_error()); $row_Rtype = mysql_fetch_assoc($Rtype); $totalRows_Rtype = mysql_num_rows($Rtype); $Rtype_pric=$row_Rtype['pric']; mysql_free_result($Rtype); ?> <div class="row"> <div class="col-lg-12 flex-lg-unordered g-mb-80"> <div class="g-brd-around g-brd-gray-light-v4 rounded g-py-40 g-px-30"> <header class="text-center"> <h1 class="h3 g-color-black g-font-weight-300 text-capitalize">天空商城 會員註冊</h1> </header> <!-- Form --> <form action="/registerform.html" class="g-py-15" method="post" name="form4" onsubmit="return checkForm1(this);"> <input id="registerform" name="registerform" type="hidden" value="form1" /> <div style="max-width:780px; padding:margin:auto"> <div class="input-icons" style="color:green"> <i id="mobileicon" class="fa fa-check"></i> <div class="g-mb-5">手機號碼</div> <input id="mem_mobile" name="mem_mobile" class="input-field" type="text" placeholder="手機號碼?" maxlength="10" data-mask="9999999999" oninput="ickphone()"> </div> <? /* <div class="row"> </div> */ ?> <div class="row" id="po1" style="display:none" > <div class="col-xs-6 col-sm-6 mb-4"> <div class="g-mb-5">密碼</div> <input 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="mem_passwd" name="mem_passwd" placeholder="密碼最少要6個英數字" required type="password" /> </div> <div class="col-xs-6 col-sm-6 mb-4" > <div class="g-mb-5">確認密碼</div> <input 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="mem_passwd2" name="mem_passwd2" required type="password" oninput="showpo2()"/> </div> </div> <div class="row" id="po2" style="display:none" > <div class="col-xs-12 col-sm-6 mb-4"> <div class="g-mb-5">會員推薦碼<span style="color:#F00">(非必填)</span></div> <input 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-10" id="mem_code" name="mem_code" placeholder="不知道推薦碼請留空白" type="text" value="<?= $recom ?>" <?= $recom==''?'onchange="foundmember()"':'readonly' ;?> /> <input id="bid" name="bid" type="hidden" value="<?= $bid ?>" /></div> </div> <div id="sendsms" style="display:none" > <div class="settings" style="margin-top:15px"> <label id='iitime' >傳送簡訊確認碼:</label> <input type="button" id="btphone" name="btphone" value="傳送" onclick="sendsmss()" /> </div> <div class="settings" style="margin-top:15px"> <label>簡訊回傳碼:</label> <input class="form-control g-color-black g-brd-gray-light-v3 g-brd-primary--hover g-py-10 g-px-15" id="Chkphone" name="Chkphone" placeholder="請輸入簡訊回傳碼" required type="text" maxlength="6" oninput="icksms()" /></div> </div> </div> <input id="go" name="go" type="hidden" value="" /> <input id="Rtype_pric" name="Rtype_pric" type="hidden" value="<?= $Rtype_pric ?>" /> <div class="col-xs-12 col-sm-6 mb-4"> <div class="settings"> <? /* <label>手機 (帳號):</label> <input name="mem_mobile1" type="text" 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="mem_mobile1" value="<?= isset($_POST['mem_mobile'])?$_POST['mem_mobile']:"" ?>" onchange="rephonev();" /> */ ?> <input name="phonev" id="phonev" type="hidden" value="0" size="1"/> </div> </div> <div class="row"></div> <div style="clear:both;"></div> <!-- End Demo modal window --> <div id="ckread" ></div> </form> <div style="clear:both;"></div> <div class="row"> 點擊「同意並註冊」,即表示您已閱讀並同意天空商城的 <a href="/會員條款.html">會員條款</a> 和 <a href="/SKYBNI個人資料保護法.html">隱私權政策</a> <!-- End Form --></div> </div> </div> <script> var icount=0; function showpo2(){ if(checkFormc()){ $("#po2").css('display',''); $("#sendsms").css('display',''); } } function checkFormc(){ var p1= $("#mem_passwd").val(); var p2= $("#mem_passwd2").val(); if(p1==p2){ return true ;} else{ return false ;} } function icksms(){ var mobile = $("#mem_mobile").val(); //.find(':selected')[0].id; var smscode = $.trim($("#Chkphone").val()); if(smscode.length==6){ $.ajax({ type: 'POST', url: 'ajax_smss_check.php', data: { 'mobile': mobile,'smscode':smscode}, success: function (data) { if(data=='1'){ alert('簡訊傳送碼OK...') ; $( "#ckread" ).html( '<input class="btn btn-block u-btn-blue g-py-13 g-font-size-16" name="Submitid" type="submit" value="同意並註冊" />' ); } else{ alert('簡訊傳送碼錯誤...') ; return false ; } } }); } } function ickphone(){ //fa-check if(icount>0){ exit; } $("#mobileicon").removeClass("fa-check"); // $("#mobileicon").addClass("fa-check"); // mobileicon $("#smsmobileicon").removeClass("fa-check"); $("#sendsms").css('display','none'); //$("#po1").css('display','none'); //$("#po2").css('display','none'); //$("#po3").css('display','none'); var phone= $.trim($("#mem_mobile").val()); $("#mem_mobile").val(phone) ; if( phone.length==10){ if(isPhoneNo(phone)==false){ alert('手機號格式錯誤...'); }else{ ckphone(); // $("#mobileicon").addClass("fa-check"); } } } //$pas1 function checkForm1(my){ var p1= $("#mem_passwd").val(); var p2= $("#mem_passwd2").val(); if(p1==p2){ return true ;} else{ alert("密碼不一致 ??..\n "); return false ;} } function read() { checkBox = document.getElementById('readchk'); // Check if the element is selected/checked if(checkBox.checked) { // Respond to the result $( "#ckread" ).html( '<input class="btn btn-block u-btn-blue g-py-13 g-font-size-16" name="Submitid" type="submit" value="確認註冊" />' ); } else{ $( "#ckread" ).html("") ; } } function ckphone(){ var mobile = $.trim($("#mem_mobile").val()); //.find(':selected')[0].id; $("#mem_mobile").val(mobile); $("#phonev").val(0); $.ajax({ type: 'POST', url: 'CkphoneApi.php', data: { 'mobile': mobile}, success: function (data) { // the next thing you want to do // alert(data); if(data!=9){ alert('手機號不可註冊...') ; $("#mem_mobile").val(''); return false ;} else{ $("#po1").css('display',''); $("#mobileicon").addClass("fa-check"); $("#phonev").val(data); ; return true ; } } }); } function foundmember(){ var memcode = $("#mem_code").val(); //.find(':selected')[0].id; $("#bid").val("1"); if(memcode == "") { return 0; }; $.ajax({ type: 'POST', url: 'CkmemberApi.php', data: { 'memcode': memcode}, success: function (data) { response = JSON.parse(data); if(response.err==1){ $("#bid").val(response.id); } else{ $("#mem_code").val("");} } }); } function rebtphone(){ icount=icount-1; if(icount==0){ //$("#iitime").html("傳送簡訊確認碼:") $("#btphone").val("傳送"); ; $("#btphone").attr("disabled", false); //iitime }else{ $("#btphone").val(icount); setTimeout(rebtphone, 1000); } } function sendsmss(){ if($("#phonev").val()!=9){ alert("請檢查手機號?...") ; return 0; } var mobile = $("#mem_mobile").val(); $("#btphone").attr("disabled", true); // $("#mem_mobile").prop("readonly",true); // sendsmss() // $("#sendsms").html(""); $.ajax({ type: 'POST', url: 'ajax_send_smss.php', data: {'mobile': mobile}, success: function (data) { response = JSON.parse(data); if(response.err==9){ icount=60; setTimeout(rebtphone, 1000); alert("簡訊已傳送..請取得6個字回傳碼.."); }else{ alert("重複使用,請5分鐘後再使用..."); } } }); } function isPhoneNo(phone) { var MobileReg = /^(09)[0-9]{8}$/; return (phone.match(MobileReg)) ? true : false } function rephonev(){ $("#phonev").val(0); } </script> <?php mysql_free_result($Rat2); // include "newman_html.php"; ?>
保存
取消
返回文件列表