001.
<?
002.
date_default_timezone_set(
"Asia/Bangkok"
);
003.
session_start();
004.
error_reporting
(E_ALL & ~E_NOTICE);
005.
include
(
"connect.php"
);
006.
if
( !function_exists(
'mobile_user_agent_switch'
) ){
007.
function
mobile_user_agent_switch(){
008.
$device
=
''
;
009.
010.
if
(
stristr
(
$_SERVER
[
'HTTP_USER_AGENT'
],
'ipad'
) ) {
011.
$device
=
"ipad"
;
012.
}
else
if
(
stristr
(
$_SERVER
[
'HTTP_USER_AGENT'
],
'iphone'
) ||
strstr
(
$_SERVER
[
'HTTP_USER_AGENT'
],
'iphone'
) ) {
013.
$device
=
"iphone"
;
014.
}
else
if
(
stristr
(
$_SERVER
[
'HTTP_USER_AGENT'
],
'blackberry'
) ) {
015.
$device
=
"blackberry"
;
016.
}
else
if
(
stristr
(
$_SERVER
[
'HTTP_USER_AGENT'
],
'android'
) ) {
017.
$device
=
"Mobile"
;
018.
}
019.
020.
if
(
$device
) {
021.
return
$device
;
022.
}
return
false; {
023.
return
false;
024.
}
025.
}
026.
}
027.
if
(
$_POST
[QRName]
and
$_POST
[QRMobile]){
028.
029.
$checker_date
=
date
(
"Y-m-d H:i:s"
);
030.
$query
= "UPDATE `qrcode`
031.
SET status = status + 1
032.
WHERE keyqr =
'".$_POST[keyqr]."'
";
033.
$result
= mysqli_query(
$db
,
$query
);
034.
035.
$query
= "INSERT INTO `checker` (`checker_id`, `key_qr`, `customer`, `mobile`, `checker_date`, checker_device)
036.
VALUES (NULL,
'".$_POST[keyqr]."'
,
'".$_POST[QRName]."'
,
'".$_POST[QRMobile]."'
,
'".$checker_date."'
,
'".mobile_user_agent_switch()."'
);";
037.
$result
= mysqli_query(
$db
,
$query
);
038.
}
039.
?>
040.
<!DOCTYPE html>
041.
<html>
042.
<head>
043.
<meta charset=
"utf-8"
/>
044.
<meta name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
045.
<link href=
"/Content/css?v=-ajo3J6QtgGZONnv3AZei244jm7A7pCtHShB7DstoFM1"
rel=
"stylesheet"
/>
046.
<script src=
"/bundles/modernizr?v=inCVuEFe6J4Q07A0AcRsbJic_UE5MwpRMNGcOtk94TE1"
></script>
047.
<script src=
"/Scripts/jquery-3.3.1.min.js"
></script>
048.
<script src=
"/bundles/jquery?v=2u0aRenDpYxArEyILB59ETSCA2cfQkSMlxb6jbMBqf81"
></script>
049.
<script src=
"/bundles/bootstrap?v=M4Nk6kIOwMFflsEKET0iPL9i5YBqbzMzvUOrd8gyCnw1"
></script>
050.
051.
<link rel=
"stylesheet"
href=
"/CustomFont/stylesheet.css"
>
052.
<style>
053.
* {
054.
font-family: Kanit;
055.
}
056.
.center {
057.
display: block;
058.
margin-left: auto;
059.
margin-right: auto;
060.
}
061.
.responsive {
062.
width: 100%;
063.
max-height: 350px;
064.
max-width: 400px;
065.
}
066.
.white-grad {
067.
background: linear-gradient(#ffffff,#ffffff) padding-box, linear-gradient(260deg,rgba(82, 48, 11), rgba(157, 110, 54)) border-box !important;
068.
color: #313149 !important;
069.
padding: 10px !important;
070.
border: 3px solid transparent !important;
071.
border-radius: 25px !important;
072.
}
073.
input:-webkit-autofill {
074.
-webkit-box-shadow: 0 0 0 1000px white inset !important;
075.
}
076.
@media (orientation:portrait) {
077.
#GoldenStrip {
078.
height: 4vh;
079.
}
080.
}
081.
@media (orientation:landscape) {
082.
#GoldenStrip {
083.
height: 4vh;
084.
}
085.
}
086.
.fade.in {
087.
opacity: 1;
088.
}
089.
.modal.in .modal-dialog {
090.
-webkit-transform: translate(0, 0);
091.
-o-transform: translate(0, 0);
092.
transform: translate(0, 0);
093.
}
094.
.modal-backdrop .fade .in {
095.
opacity: 0.5 !important;
096.
}
097.
.modal-backdrop.fade {
098.
opacity: 0.5 !important;
099.
}
100.
</style>
101.
</head>
102.
<body style=
"padding:0px;"
>
103.
<div style=
"background-image:url('/Resources/backgound.png');height:100vh;background-position:center;background-repeat:no-repeat;background-size:cover;overflow-x:hidden;overflow-y:hidden"
>
104.
<?
105.
$query
=
"SELECT * FROM `qrcode` WHERE keyqr = '"
.
$_GET
['s
']."'
";
106.
$result
= mysqli_query(
$db
,
$query
);
107.
while
(
$rs
=mysqli_fetch_array(
$result
)){
108.
?>
109.
<a
class
=
"btn btn-danger"
data-target=
"#modalCondition"
id=
"openCondition"
style=
"display:none"
>Open Modal</a>
110.
<div
class
=
"modal fade"
id=
"modalCondition"
>
111.
<div
class
=
"modal-dialog center"
>
112.
<div
class
=
"modal-content"
>
113.
<div
class
=
"modal-header"
>
114.
<button type=
"button"
class
=
"close"
data-dismiss=
"modal"
>×</button>
115.
<h4
class
=
"modal-title"
>เงื่อนไขการรับรางวัล</h4>
116.
</div>
117.
<div
class
=
"modal-body"
>
118.
<p>
119.
1) ผู้โชคดีที่ได้รับรางวัลมูลค่า 1,000 บาท ขึ้นไป จะต้องเสียภาษี ณ ที่จ่าย 5% ของมูลค่าของรางวัล<br>
120.
2) ผู้โชคดีที่ได้รับรางวัลจักรยานยนต์และรถยนต์ จะต้องจ่ายค่าใช้จ่ายในการโอนตามค่าใช้จ่ายที่เกิดขึ้นจริง<br>
121.
3) รางวัลที่ได้รับไม่สามารถเปลี่ยนเป็นเงินสดได้<br>
122.
เงื่อนไขเป็นไปตามข้อกำหนดของกรมสรรมพากร
123.
</p>
124.
</div>
125.
<div
class
=
"modal-footer"
>
126.
<button type=
"button"
class
=
"btn btn-info"
data-dismiss=
"modal"
>รับทราบ</button>
127.
</div>
128.
</div>
129.
</div>
130.
</div>
131.
132.
<script>
133.
function
allnumber(inputtxt){
134.
var
letters = /^[0-9]+$/;
135.
if
(String.fromCharCode(inputtxt.keyCode).match(letters)){
136.
return
true;
137.
}
else
{
138.
return
false;
139.
}
140.
}
141.
</script>
142.
143.
<img alt=
"WarrantyImg"
id=
"WarrantyImg"
style=
"height:22vh;width:auto;margin-top:3vh"
class
=
"center"
>
144.
<div
class
=
"row"
id=
"GoldenStrip"
style=
"background-image:url('/Resources/GoldenStrip.png');height:4vh;width:100%;margin:0px;"
>
145.
<img id=
"SloganStrip"
class
=
"center"
src=
"/Resources/Slogan.png"
style=
"height:3.5vh;"
>
146.
</div>
147.
<script>
148.
$(
"#WarrantyImg"
).attr(
"src"
,
'/Resources/AuthenPic.png'
);
149.
</script>
150.
<?
151.
if
(
$_POST
[keyqr]
and
$rs
[status]==1){
152.
?>
153.
<form method=
"post"
name=
"CheckQRCode"
action=
""
style=
"margin-top:2vh;margin-bottom:2vh"
>
154.
<div
class
=
"container-fluid"
>
155.
<div
class
=
"row center"
style=
"height:7vh;"
>
156.
<input name=
"QRName"
id=
"QRName"
required type=
"text"
class
=
"white-grad center"
style=
"border-radius:25px;width:100%;max-width:500px;height:5vh;max-height:55px"
placeholder=
"ชื่อ-นามสกุล : "
>
157.
</div>
158.
<div
class
=
"row center"
style=
"height:6vh"
>
159.
<input name=
"QRMobile"
id=
"QRMobile"
required type=
"text"
class
=
"white-grad center"
style=
"border-radius:25px;width:100%;max-width:500px;height:5vh;max-height:55px"
placeholder=
"เบอร์โทร : "
>
160.
</div>
161.
162.
<input type=
"hidden"
value=
"<?=$rs[keyqr]?>"
name=
"regisBarcode"
id=
"regisBarcode"
readonly=
""
class
=
"form-control"
>
163.
<input type=
"hidden"
value=
""
readonly=
""
class
=
"form-control"
>
164.
<input type=
"hidden"
value=
""
readonly=
""
class
=
"form-control"
>
165.
<input type=
"hidden"
value=
"<?=$rs[keyqr]?>"
name=
"keyqr"
class
=
"form-control"
>
166.
<input type=
"hidden"
value=
"CheckQR"
name=
"action2"
class
=
"form-control"
>
167.
<div
class
=
"row center"
style=
"height:4vh"
>
168.
<div
class
=
"container-fluid"
style=
"height:4vh;width:100%;max-width:500px;padding:0px;display:flex;justify-content:flex-end;flex-direction:row;flex-wrap:nowrap;align-content:flex-end"
>
169.
<button name=
"chk"
id=
"chk"
type=
"submit"
style=
"background-image:url('/Resources/btnRegis.png');height:5vh;width:100%;max-width:90px;background-repeat:no-repeat;background-size:contain;border:none;background-color:transparent;float:right"
></button>
170.
</div>
171.
</div>
172.
</div>
173.
<script>
174.
$(
'#QRName'
).val(
''
);
175.
$(
'#QRName'
).prop(
'readonly'
, false);
176.
$(
'#QRMobile'
).val(
''
);
177.
$(
'#QRMobile'
).prop(
'readonly'
, false);
178.
$(
'#chk'
).prop(
'disabled'
, false);
179.
$(
'#regisBarcode'
).val(
'<?=$rs[keyqr]?>'
);
180.
</script>
181.
</form>
182.
183.
<h4 style=
"color:rgb(74,46,24);text-align:center"
>ผู้โชคดีได้รับรางวัล</h4>
184.
<div
class
=
"row center"
style=
"height:3vh;border-radius:5px;width:100%;max-width:340px;background-color:white;padding-left:15px;padding-right:15px"
>
185.
<h5 id=
"labelPrice"
style=
"color:rgb(74,46,24);text-align:center;margin:0px;height:inherit;display:flex;align-items:center;justify-content:center"
></h5>
186.
</div>
187.
<script>
188.
$(
'#labelPrice'
).text(
'รอติดตามผลรางวัล'
);
189.
</script>
190.
<img alt=
"priceImg"
id=
"priceImg"
class
=
"responsive center"
style=
"margin-top:1vh"
>
191.
<script>
192.
$(
"#priceImg"
).attr(
"src"
,
'/Resources/bottomnew.png'
);
193.
</script>
194.
195.
<img src=
"../check.png"
border=
"0"
><br>
196.
<h1 align=
"center"
style=
"color:#0000ff"
>ขอบคุณที่ไว้วางใจ สินค้าชิ้นนี้เป็นของแท้ค่ะ</h1>
197.
<br><?=
$rs
[qrCode]?>
198.
<br><img src=
"../qr.png"
border=
"0"
height=
"80"
>
199.
<br><?=
$rs
[keyqr]?>
200.
<?
201.
}
else
if
(
$_POST
[keyqr]
and
$rs
[status]>1){
202.
?>
203.
<img src=
"../alert.png"
border=
"0"
><br>
204.
<h2 align=
"center"
style=
"color:#ff6600"
>คำเตือน พบการสแกนสินค้าชั้นนี้แล้ว!!!</h2>
205.
<br><?=
$rs
[qrCode]?>
206.
<br><img src=
"../qr.png"
border=
"0"
height=
"80"
>
207.
<br><?=
$rs
[keyqr]?>
208.
<div align=
"center"
style=
"color:red"
>การสแกนครั้งนี้เป็นครั้งที่ <?=
$rs
[status]?></div>
209.
<div align=
"center"
>สินค้าชิ้นนี้อาจเป็นสินค้าลอกเลียนแบบ</div>
210.
<div style=
"color:#b5b5b5"
>
211.
<?
212.
$query_check
=
"SELECT * FROM `checker` WHERE key_qr = '"
.
$rs
[keyqr].
"' ORDER BY checker_id"
;
213.
$result_check
= mysqli_query(
$db
,
$query_check
);
214.
while
(
$rs_check
=mysqli_fetch_array(
$result_check
)){
215.
$i
++;
216.
?>
217.
<?=
$i
?> : <?=
$rs_check
[checker_date]?> by <?=
$rs_check
[checker_device]?><br>
218.
<?
219.
}
220.
?>
221.
</div>
222.
<?
223.
}
else
{
224.
?>
225.
<?
226.
if
(
$_POST
[keyqr]
and
(
$_POST
[QRName] ==
""
or
$_POST
[QRMobile] ==
""
)){
227.
?>
228.
<p align=
"center"
><font color=
"#ff0000"
>โปรดระบุ <font color=
"*ff0000"
><br>*ชื่อ-นามสกุล</font> <font color=
"*ff0000"
>*เบอร์ติดต่อ</font></font></p>
229.
<?
230.
}
231.
?>
232.
233.
<form method=
"post"
name=
"CheckQRCode"
action=
""
style=
"margin-top:2vh;margin-bottom:2vh"
>
234.
<div
class
=
"container-fluid"
>
235.
<div
class
=
"row center"
style=
"height:7vh;"
>
236.
<input name=
"QRName"
id=
"QRName"
required type=
"text"
class
=
"white-grad center"
style=
"border-radius:25px;width:100%;max-width:500px;height:5vh;max-height:55px"
placeholder=
"ชื่อ-นามสกุล : "
>
237.
</div>
238.
<div
class
=
"row center"
style=
"height:6vh"
>
239.
<input name=
"QRMobile"
id=
"QRMobile"
required type=
"text"
class
=
"white-grad center"
style=
"border-radius:25px;width:100%;max-width:500px;height:5vh;max-height:55px"
placeholder=
"เบอร์โทร : "
value=
""
maxlength=
"15"
minlength=
"9"
numberonly=
""
onkeypress=
"return allnumber(event);"
>
240.
</div>
241.
242.
243.
<input type=
"hidden"
value=
"<?=$rs[keyqr]?>"
name=
"regisBarcode"
id=
"regisBarcode"
readonly=
""
class
=
"form-control"
>
244.
<input type=
"hidden"
value=
""
readonly=
""
class
=
"form-control"
>
245.
<input type=
"hidden"
value=
""
readonly=
""
class
=
"form-control"
>
246.
<input type=
"hidden"
value=
"<?=$rs[keyqr]?>"
name=
"keyqr"
class
=
"form-control"
>
247.
<input type=
"hidden"
value=
"CheckQR"
name=
"action2"
class
=
"form-control"
>
248.
<div
class
=
"row center"
style=
"height:4vh"
>
249.
<div
class
=
"container-fluid"
style=
"height:4vh;width:100%;max-width:500px;padding:0px;display:flex;justify-content:flex-end;flex-direction:row;flex-wrap:nowrap;align-content:flex-end"
>
250.
<button name=
"chk"
id=
"chk"
type=
"submit"
style=
"background-image:url('/Resources/btnRegis.png');height:5vh;width:100%;max-width:90px;background-repeat:no-repeat;background-size:contain;border:none;background-color:transparent;float:right"
></button>
251.
</div>
252.
</div>
253.
</div>
254.
<script>
255.
$(
'#QRName'
).val(
''
);
256.
$(
'#QRName'
).prop(
'readonly'
, false);
257.
$(
'#QRMobile'
).val(
''
);
258.
$(
'#QRMobile'
).prop(
'readonly'
, false);
259.
$(
'#chk'
).prop(
'disabled'
, false);
260.
$(
'#regisBarcode'
).val(
'<?=$rs[keyqr]?>'
);
261.
</script>
262.
</form>
263.
264.
<h4 style=
"color:rgb(74,46,24);text-align:center"
>ผู้โชคดีได้รับรางวัล</h4>
265.
<div
class
=
"row center"
style=
"height:3vh;border-radius:5px;width:100%;max-width:340px;background-color:white;padding-left:15px;padding-right:15px"
>
266.
<h5 id=
"labelPrice"
style=
"color:rgb(74,46,24);text-align:center;margin:0px;height:inherit;display:flex;align-items:center;justify-content:center"
></h5>
267.
</div>
268.
<script>
269.
$(
'#labelPrice'
).text(
''
);
270.
</script>
271.
<img alt=
"priceImg"
id=
"priceImg"
class
=
"responsive center"
style=
"margin-top:1vh"
>
272.
<script>
273.
$(
"#priceImg"
).attr(
"src"
,
'/Resources/bottomnew.png'
);
274.
</script>
275.
<?
276.
}
277.
?>
278.
<?
279.
}
280.
?>
281.
</div>
282.
</body>
283.
</html>