|
|
|
ขอโค้ดที่ทำให้เบอร์โทรศัพท์ 4 ตัวท้ายเป็น xxxx หน่อยครับ .php |
|
|
|
|
|
|
|
echo preg_replace('/(.+)([0-9]{4})$/','$1xxxx', $a);
|
ประวัติการแก้ไข 2018-11-21 12:27:52
|
|
|
|
Date :
2018-11-21 12:27:11 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
มาเป็นรูปภาพอีกแล้ว
|
|
|
|
|
Date :
2018-11-21 13:45:00 |
By :
mr.v |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ตอบความคิดเห็นที่ : 4 เขียนโดย : mr.v เมื่อวันที่ 2018-11-21 13:45:00
รายละเอียดของการตอบ ::
... ใส่ความคิดเห็นตรงนี้....... Code (PHP)
<?php
/*
* include file start***********************************************************
*/
/*
* include file start***********************************************************
*/
/*
* title ***********************************************************************
*/
$pageUrl = 'search';
$pageName = 'index';
$headtitle = 'จัดการสมาชิก';
$title = 'สมาชิก';
$subtitle = '';
$icon = 'fa fa-user';
/*
* title ***********************************************************************
*/
/*
* php code///////////**********************************************************
*/
$db_room = new database();
$option_room = array(
"table" => _prefix."room",
"condition" => "activate='อนุญาต'",
"order" => "codename asc"
);
$query_room = $db_room->select($option_room);
/*
* php code///////////**********************************************************
*/
/*
* header***********************************************************************
*/
require 'template/front/home_header.php';
/*
* header***********************************************************************
*/
?>
<div id="action-success"></div>
<!-- Header -->
<?/* <header class="masthead bg-primary text-white text-center">
<div class="container">
<?/*<img class="img-fluid mb-5 d-block mx-auto" src="<?php echo $baseUrl;?>/application/front/home/freelancer/img/profile.png" alt="">*/?>
<?/* <div class="img-fluid mb-5 d-block mx-auto"><i class="fa fa-book fa-5x"></i></div>
<h1 class="text-uppercase mb-0">KLANGPLAZA APP</h1>
<hr class="star-light mt-5">
<h2 class="font-weight-light mb-5 mt-5">ลูกค้า สามารถตรวจสอบยอดซื้อ และ คะแนนได้</h2>
</div>
<div class="text-center mt-5">
<a class="btn btn-xl btn-outline-light js-scroll-trigger" href="#register">
<i class="fa fa-chevron-down"></i>
</a>
</div>
</header>*/?>
<header class="masthead text-center">
<div class="container">
<?/*<img class="img-fluid mb-5 d-block mx-auto" src="<?php echo $baseUrl;?>/application/front/home/freelancer/img/profile.png" alt="">*/?>
<form method="POST" novalidate="novalidate">
<div class="control-group">
<div class="form-group <?/*floating-label-form-group controls mb-0 pb-2*/?>">
<label>รหัสสมาชิก/เบอร์โทรศัพท์</label>
<?/*<input class="form-control input-lg" id="itemname" type="text" placeholder="" required="required" data-validation-required-message="กรุณาป้อน รหัสสมาชิก/เบอร์โทรศัพท์" autocomplete="off">*/?>
<input type="text" name="itemname" id="itemname" class="form-control" placeholder="ข้อความ คำค้นหา!" autocomplete="off">
<p class="help-block text-danger"></p>
</div>
</div>
<br>
<div id="success"></div>
<div class="form-group">
<?/*<button type="submit" class="btn btn-primary btn-xl" id="btnSearch">ตรวจสอบแต้มสะสม</button>*/?>
<button type="click" class="btn btn-primary" id="btnSearch" data-toggle="modal" data-target="#exampleModal">
<span class="glyphicon glyphicon-search"></span>
ค้นหา
</button>
</div>
<!-- ส่วน DataBase -->
<?
$db_customer = new database();
$select_customer_id = isset($_POST['itemname']) ? $_POST['itemname'] : "";
$sql_customer = "Select * from "._prefix."customer where CustomerID = '{$_POST['itemname']}' ";
/*CustomerID='{$select_customer_id}' order by id asc";*/
$query_customer = $db_customer->query($sql_customer);
$rows_customer = $db_customer->rows($query_customer);
//if ($rows_customer > 0) {
while ($rs_customer = $db_customer->get($query_customer)) {
//$spc = ($rs['group_id']==$rs_group['id']) ? "selected" : "";
?>
<td nowrap>รหัสสมาชิก : </td><?php echo $rs_customer['CustomerID']; ?> <br>
<td nowrap>ชื่อ : </td><?php echo $rs_customer['FullName']; ?> <br>
<td nowrap>เบอร์โทรศัพท์ : </td><?php echo $rs_customer['MobileNo']; ?> <br>
<td nowrap>แต้มสะสม : </td><?php echo $rs_customer['TotalPoint']; ?>
<?php } //}?>
</form>
<div class="loading"></div>
<div class="row" id="list-data" style="margin-top: 10px;">
</div>
</header>
<!-- Portfolio Grid Section -->
<section class="register mb-5" id="register">
<div class="container">
<h2 class="text-center text-uppercase text-secondary mb-0">ลงทะเบียน</h2>
<hr class="star-dark mb-5">
<div class="row">
<?/*<div class="col-lg-12 text-center text-inline">
<?php
$i=1;
while($rs_room = $db_room->get($query_room)) {
?>
<div class="col-md-3">
<div class="text-center">
<button class="btn btn-xl btn-outline-light">
<?php echo $rs_room['name'];?>
</button>
</div>
</div>
<?php } ?>*/?>
<?php
$i=1;
while($rs_room = $db_room->get($query_room)) {
if(($rs_room['stop_date']) > date("Y-m-d 59:59:59")){
?>
<div class="col-md-4 col-xs-6">
<div class="text-center mb-4">
<?/*<a class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger btn btn-xl btn-default portfolio-item d-block mx-auto" href="#register-modal-<?php echo $rs_room['id'];?>" style="background-color: <?php echo $rs_room['color'];?>;color:#fff;"> <h1><?php echo $rs_room['name'];?></h1>
<?php if($rs_room['room_group']!=''){ echo $rs_room['room_group']; }else{ echo ' '; }?>
</a>*/?>
<form role="form" id="addForm" data-toggle="validator" class="shake" action="<?php echo $baseUrl;?>/register" method="post">
<a class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger btn btn-xl btn-default portfolio-item d-block mx-auto" href="#" style="background-color: <?php echo $rs_room['color'];?>;color:#fff;"> <h1><?php echo $rs_room['name'];?></h1>
<?php if($rs_room['room_group']!=''){ echo $rs_room['room_group']; }else{ echo ' '; }?>
</a>
<div class="">
<p class="h5 mt-2">เปิดลงทะเบียนระหว่างวันที่</p>
<p class="h4"><?php echo thaidateNotime($rs_room['start_date']);?> - <?php echo thaidateNotime($rs_room['stop_date']);?></p>
</div>
<input type="hidden" name="_add_" value="_add_">
<input type="hidden" name="id" value="<?php echo $rs_room['id'];?>">
<button type="submit" class="btn btn-warning btn-block"><i class="fa fa-file-text-o"></i> เลือก</button>
</form>
</div>
</div>
<div class="portfolio-modal mfp-hide" id="register-modal-<?php echo $rs_room['id'];?>">
<div class="portfolio-modal-dialog bg-white">
<a class="close-button d-none d-md-block portfolio-modal-dismiss" href="#">
<i class="fa fa-3x fa-times"></i>
</a>
<div class="container text-center">
<div class="row">
<div class="col-lg-8 mx-auto">
<button class="btn btn-block" style="background-color: <?php echo $rs_room['color'];?>;color:#fff;"><h2 class=" mb-0"><?php echo $rs_room['name'];?> <?php echo $rs_room['room_group'];?></h2></button>
<div class="">
<p class="h5 mt-2">เปิดลงทะเบียนระหว่างวันที่</p>
<p class="h4"><?php echo thaidateNotime($rs_room['start_date']);?> - <?php echo thaidateNotime($rs_room['stop_date']);?></p>
</div>
<hr class="star-dark mb-5">
<a class="btn btn-primary btn-lg rounded-pill portfolio-modal-dismiss" href="#">
<i class="fa fa-close"></i>
ปิดหน้าต่าง</a>
</div>
</div>
</div>
</div>
</div>
<?php } }?>
</div>
</div>
</section>
<!-- About Section -->
<section class="bg-primary text-white mb-0" id="recheck">
<div class="container">
<h2 class="text-center text-uppercase text-white">ตรวจสอบการลงทะเบียน</h2>
<hr class="star-light mb-5">
<div class="row">
</div>
<div class="text-center mt-4">
</div>
</div>
</section>
<!-- Contact Section -->
<section id="contact">
<div class="container">
<h2 class="text-center text-uppercase text-secondary mb-0">ติดต่อ</h2>
<hr class="star-dark mb-5">
<div class="row">
<div class="col-lg-8 mx-auto">
<!-- To configure the contact form email address, go to mail/contact_me.php and update the email address in the PHP file on line 19. -->
<!-- The form should work on most web servers, but if the form is not working you may need to configure your web server differently. -->
<?/* <form name="sentMessage" id="contactForm" novalidate="novalidate">
<div class="control-group">
<div class="form-group floating-label-form-group controls mb-0 pb-2">
<label>Name</label>
<input class="form-control" id="name" type="text" placeholder="Name" required="required" data-validation-required-message="Please enter your name.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="control-group">
<div class="form-group floating-label-form-group controls mb-0 pb-2">
<label>Email Address</label>
<input class="form-control" id="email" type="email" placeholder="Email Address" required="required" data-validation-required-message="Please enter your email address.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="control-group">
<div class="form-group floating-label-form-group controls mb-0 pb-2">
<label>Phone Number</label>
<input class="form-control" id="phone" type="tel" placeholder="Phone Number" required="required" data-validation-required-message="Please enter your phone number.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="control-group">
<div class="form-group floating-label-form-group controls mb-0 pb-2">
<label>Message</label>
<textarea class="form-control" id="message" rows="5" placeholder="Message" required="required" data-validation-required-message="Please enter a message."></textarea>
<p class="help-block text-danger"></p>
</div>
</div>
<br>
<div id="success"></div>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-xl" id="sendMessageButton">Send</button>
</div>
</form>*/?>
</div>
</div>
</div>
</section>
<!-- Portfolio Modals -->
<!-- Portfolio Modal 1 -->
<div class="portfolio-modal mfp-hide" id="portfolio-modal-1">
<div class="portfolio-modal-dialog bg-white">
<a class="close-button d-none d-md-block portfolio-modal-dismiss" href="#">
<i class="fa fa-3x fa-times"></i>
</a>
<div class="container text-center">
<div class="row">
<div class="col-lg-8 mx-auto">
<h2 class="text-secondary text-uppercase mb-0">Project Name</h2>
<hr class="star-dark mb-5">
<img class="img-fluid mb-5" src="<?php echo $baseUrl;?>/application/front/home/freelancer/img/portfolio/cabin.png" alt="">
<p class="mb-5">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia neque assumenda ipsam nihil, molestias magnam, recusandae quos quis inventore quisquam velit asperiores, vitae? Reprehenderit soluta, eos quod consequuntur itaque. Nam.</p>
<a class="btn btn-primary btn-lg rounded-pill portfolio-modal-dismiss" href="#">
<i class="fa fa-close"></i>
Close Project</a>
</div>
</div>
</div>
</div>
</div>
<!-- Portfolio Modal 2 -->
<div class="portfolio-modal mfp-hide" id="portfolio-modal-2">
<div class="portfolio-modal-dialog bg-white">
<a class="close-button d-none d-md-block portfolio-modal-dismiss" href="#">
<i class="fa fa-3x fa-times"></i>
</a>
<div class="container text-center">
<div class="row">
<div class="col-lg-8 mx-auto">
<h2 class="text-secondary text-uppercase mb-0">Project Name</h2>
<hr class="star-dark mb-5">
<img class="img-fluid mb-5" src="<?php echo $baseUrl;?>/application/front/home/freelancer/img/portfolio/cake.png" alt="">
<p class="mb-5">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia neque assumenda ipsam nihil, molestias magnam, recusandae quos quis inventore quisquam velit asperiores, vitae? Reprehenderit soluta, eos quod consequuntur itaque. Nam.</p>
<a class="btn btn-primary btn-lg rounded-pill portfolio-modal-dismiss" href="#">
<i class="fa fa-close"></i>
Close Project</a>
</div>
</div>
</div>
</div>
</div>
<!-- Portfolio Modal 3 -->
<div class="portfolio-modal mfp-hide" id="portfolio-modal-3">
<div class="portfolio-modal-dialog bg-white">
<a class="close-button d-none d-md-block portfolio-modal-dismiss" href="#">
<i class="fa fa-3x fa-times"></i>
</a>
<div class="container text-center">
<div class="row">
<div class="col-lg-8 mx-auto">
<h2 class="text-secondary text-uppercase mb-0">Project Name</h2>
<hr class="star-dark mb-5">
<img class="img-fluid mb-5" src="<?php echo $baseUrl;?>/application/front/home/freelancer/img/portfolio/circus.png" alt="">
<p class="mb-5">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia neque assumenda ipsam nihil, molestias magnam, recusandae quos quis inventore quisquam velit asperiores, vitae? Reprehenderit soluta, eos quod consequuntur itaque. Nam.</p>
<a class="btn btn-primary btn-lg rounded-pill portfolio-modal-dismiss" href="#">
<i class="fa fa-close"></i>
Close Project</a>
</div>
</div>
</div>
</div>
</div>
<!-- Portfolio Modal 4 -->
<div class="portfolio-modal mfp-hide" id="portfolio-modal-4">
<div class="portfolio-modal-dialog bg-white">
<a class="close-button d-none d-md-block portfolio-modal-dismiss" href="#">
<i class="fa fa-3x fa-times"></i>
</a>
<div class="container text-center">
<div class="row">
<div class="col-lg-8 mx-auto">
<h2 class="text-secondary text-uppercase mb-0">Project Name</h2>
<hr class="star-dark mb-5">
<img class="img-fluid mb-5" src="<?php echo $baseUrl;?>/application/front/home/freelancer/img/portfolio/game.png" alt="">
<p class="mb-5">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia neque assumenda ipsam nihil, molestias magnam, recusandae quos quis inventore quisquam velit asperiores, vitae? Reprehenderit soluta, eos quod consequuntur itaque. Nam.</p>
<a class="btn btn-primary btn-lg rounded-pill portfolio-modal-dismiss" href="#">
<i class="fa fa-close"></i>
Close Project</a>
</div>
</div>
</div>
</div>
</div>
<!-- Portfolio Modal 5 -->
<div class="portfolio-modal mfp-hide" id="portfolio-modal-5">
<div class="portfolio-modal-dialog bg-white">
<a class="close-button d-none d-md-block portfolio-modal-dismiss" href="#">
<i class="fa fa-3x fa-times"></i>
</a>
<div class="container text-center">
<div class="row">
<div class="col-lg-8 mx-auto">
<h2 class="text-secondary text-uppercase mb-0">Project Name</h2>
<hr class="star-dark mb-5">
<img class="img-fluid mb-5" src="<?php echo $baseUrl;?>/application/front/home/freelancer/img/portfolio/safe.png" alt="">
<p class="mb-5">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia neque assumenda ipsam nihil, molestias magnam, recusandae quos quis inventore quisquam velit asperiores, vitae? Reprehenderit soluta, eos quod consequuntur itaque. Nam.</p>
<a class="btn btn-primary btn-lg rounded-pill portfolio-modal-dismiss" href="#">
<i class="fa fa-close"></i>
Close Project</a>
</div>
</div>
</div>
</div>
</div>
<!-- Portfolio Modal 6 -->
<div class="portfolio-modal mfp-hide" id="portfolio-modal-6">
<div class="portfolio-modal-dialog bg-white">
<a class="close-button d-none d-md-block portfolio-modal-dismiss" href="#">
<i class="fa fa-3x fa-times"></i>
</a>
<div class="container text-center">
<div class="row">
<div class="col-lg-8 mx-auto">
<h2 class="text-secondary text-uppercase mb-0">Project Name</h2>
<hr class="star-dark mb-5">
<img class="img-fluid mb-5" src="<?php echo $baseUrl;?>/application/front/home/freelancer/img/portfolio/submarine.png" alt="">
<p class="mb-5">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia neque assumenda ipsam nihil, molestias magnam, recusandae quos quis inventore quisquam velit asperiores, vitae? Reprehenderit soluta, eos quod consequuntur itaque. Nam.</p>
<a class="btn btn-primary btn-lg rounded-pill portfolio-modal-dismiss" href="#">
<i class="fa fa-close"></i>
Close Project</a>
</div>
</div>
</div>
</div>
</div>
<!-- Modal search--> <!-- Pop up -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">ข้อมูลสมาชิก</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">ปิด</button>
</div>
</div>
</div>
</div>
<script src="<?php echo $baseUrl; ?>/dist/js/jquery-1.11.2.min.js"></script>
<!-- ส่วนของ ajax -->
<script type="text/javascript">
$(function () {
$("#btnSearch").click(function () {
$.ajax({
url: '<?php echo $baseUrl;?>/<?php echo $pageUrl;?>/select_customer',
type: "POST",
data: {itemname: $("#itemname").val()},
beforeSend: function () {
$(".loading").show();
},
complete: function () {
$(".loading").hide();
},
success: function (data) {
$("#list-data").html(data);
}
});
});
/*$(document).ready(function() {
$('#btnSearch').on("submit",function() {
//var name = $("#name").val();
//document.getElementById("xx").value=$('#room').val();
$.ajax({
type: 'POST',
data: {itemname: $(this).val()},
url: '<?php echo $baseUrl;?>/front/<?php echo $pageUrl;?>/select_customer',
success: function(data) {
$('#customer').html(data);
}
});
return false;
});
});*/
/*
$("button").click(function(){
$.post("<?php echo $baseUrl;?>/front/<?php echo $pageUrl;?>/select_customer",
{
name: "itoffside",
city: "Duckburg",
tel: "02394824243"
},
function(data,status){
alert("Data: " + data + "\nStatus: " + status);
});
});*/
</script>
<?
/*
* footer***********************************************************************
*/
require 'template/front/home_footer.php';
/*
* footer***********************************************************************
*/
?>
|
|
|
|
|
Date :
2018-11-21 13:49:18 |
By :
toeyy8140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
คงไม่ตอบนะครับ วิเคราะห์เอาหน่อย หรือ หา document อ่านเอาหน่อย จะได้ความรู้เพิ่มขึ้น
ที่ให้ไปเป็นแค่ตัวอย่างเท่านั้นครับ
ถ้าถีงขนาดต้องใส่ลงไปในโค๊ดให้ด้วย นี่จ้างดีกว่าครับ
เพราะนั่นแสดงว่าคุณไม่มีความรู้เรื่องการเขียนโปรแกรมเลย ไม่มี algorithm ที่จะเขียนโปรแกรมเองได้
ผมจะช่วยเฉพาะคนที่สนใจในการเขียนโปรแกรมจริงๆ ประเภทฉาบฉวย ไม่อยากช่วยครับ
ประเภทมือใหม่หัดขับ แต่ชอบจะกระโดดไปขับรถแข่งเลยก็ไม่ไหวเหมือนกัน
พื้นฐานยังไม่แน่นแต่จะเอาแต่ผลลัพท์ก็ไม่ช่วยครับ อยากให้เป็นจริงๆ
ส่วนใครจะช่วยนั่นก็เป็นเรื่องของคนที่ช่วยครับผมไม่เกี่ยว
ส่วนผมถ้าคนไม่เป็นแต่อยากได้ผลลัพท์เร็วๆ ผมรับจ้างครับ
ถ้าอยากได้คำตอบคุณต้องเอาไปลอง เขียนดู ลองรันโปรแกรม มีเออเร่อร์ อะไรก็ เอาโค๊ดเอาเออเร่อร์มาถาม
เป็นขั้นตอนไป จะตอบให้ครับ
|
|
|
|
|
Date :
2018-11-21 14:40:51 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ทำได้แล้วนะครับ ขอบคุณสำหรับคำแนะนำครับ
|
|
|
|
|
Date :
2018-11-21 15:27:27 |
By :
toeyy8140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองใช้ substr_replace() ดูนะครับ
http://php.net/manual/en/function.substr-replace.php
|
|
|
|
|
Date :
2018-11-23 12:54:29 |
By :
{Cyberman} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?php
function idxxxx($tel) {
return(preg_replace('/(.+)([0-9]{4})$/','$1XXXX', $idcard));
}
$tel="08787878788";
echo idxxxx($tel);
|
|
|
|
|
Date :
2024-07-25 14:08:55 |
By :
xxxx |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|