-
Notifications
You must be signed in to change notification settings - Fork 7
/
config_game.php
194 lines (183 loc) · 5.17 KB
/
config_game.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<?php
require_once 'api/config.php';
if(empty(get_session()))
{
echo "<SCRIPT LANGUAGE='JavaScript'>
window.location.href = './login';
</SCRIPT>";
exit();
}
else
{
// ===== get permission =====
if(get_admin("a_role") > 2)
{
echo "<SCRIPT LANGUAGE='JavaScript'>
window.location.href = './unauthorized';
</SCRIPT>";
exit;
}
// ===== get permission =====
}
$q_u = dd_q('SELECT * FROM website_tb WHERE (id = ?)', [1]);
$row_u = $q_u->fetch(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html>
<head>
<?php include("master/MasterPages.php"); ?>
<style type="text/css">
.style1 {
color: #007bff;
font-weight: bold;
font-size: 24px;
}
.style2 {color: #009900}
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
/* Rounded sliders */
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
}
</style>
</head>
<body class="hold-transition sidebar-mini layout-fixed layout-navbar-fixed text-sm">
<div class="wrapper">
<?php include ("partials/_navbar.php"); ?>
<?php include ("partials/_sidebar.php"); ?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<div class="content-wrapper">
<section class="content-header pt-4 pb-4">
<h1 style="font-size: 30px;">ตั้งค่าค่ายเกม</h1>
<?php
$q_1 = dd_q('SELECT * FROM game_tb');
while($row = $q_1->fetch(PDO::FETCH_ASSOC))
{
?>
<div class="card card-outline">
<div class="card-body box-profile">
<table width="753" border="0">
<tr>
<td><img style="border-radius:20px; width:150px;" src="https://aqua.paylegacy.com/<?php echo $row['g_img'] ?>"></td>
<td><?php echo $row['g_name'] ?></td>
<td>
<p>สถานะ ปกติ/ปรับปรุง</p>
<label class="switch">
<input class="checkboxclosegame" type="checkbox" b_id="<?php echo $row['g_id']; ?>" <?php if($row['g_closegame'] == 1) { echo "checked"; }?>>
<span class="slider round"></span>
</label>
</td>
<td>
<p>แสดงให้ลูกค้าเห็น</p>
<label class="switch">
<input class="checkboxshowgame" type="checkbox" b_id="<?php echo $row['g_id']; ?>" <?php if($row['g_status'] == 1) { echo "checked"; }?>>
<span class="slider round"></span>
</label>
</td>
</tr>
</table>
</div>
</div>
<?php
}
?>
<script>
$(document).ready(function(){
$(".checkboxclosegame").click(function () {
var b_id=$(this).attr("b_id");
var check = $(this).prop('checked') ? 1 : 0;
$.ajax({
type: "POST",
url: "api/edit_game.php",
data: "check=" + check + "&b_id=" + b_id,
success: function(data) {
swal("สำเร็จ", "บันทึกเรียบร้อย", {
icon : "success",
buttons: {
confirm: {
className : 'btn btn-danger'
}
},
});
}
});
});
});
$(document).ready(function(){
$(".checkboxshowgame").click(function () {
var b_id=$(this).attr("b_id");
var check = $(this).prop('checked') ? 1 : 0;
$.ajax({
type: "POST",
url: "api/edit_gamestatus.php",
data: "check=" + check + "&b_id=" + b_id,
success: function(data) {
swal("สำเร็จ", "บันทึกเรียบร้อย", {
icon : "success",
buttons: {
confirm: {
className : 'btn btn-danger'
}
},
});
}
});
});
});
</script>
</form>
</div>
</div>
</body>
</body>
<?php include('partials/_footer.php'); ?>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
</html>