-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser.php
245 lines (228 loc) · 11.7 KB
/
user.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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
<?php
require_once("pdo-connect.php"); //連線到遠端資料庫
$id=$_GET["id"];
$sqlUser="SELECT * FROM users WHERE id=?";
$stmtUser=$db_host->prepare($sqlUser);
try{
$stmtUser->execute([$id]);
$rowUser=$stmtUser->fetch();
}catch(PDOException $e){
echo $e->getMessage();
}
$sqlTotalPet="SELECT pets.id, pets.name, pets.img FROM pets WHERE user_id=? AND valid=1";
$stmtTotalPet=$db_host->prepare($sqlTotalPet);
try{
$stmtTotalPet->execute([$id]);
$rowTotalPet=$stmtTotalPet->fetchAll(PDO::FETCH_ASSOC);
}catch(PDOException $e){
echo $e->getMessage();
}
$petTotalCount=$stmtTotalPet->rowCount();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<meta name="Description" content="MaoBook小組專題報告"/>
<meta name="Content-Language" content="zh-TW">
<meta name="author" content="Team MaoBook"/>
<!-- 網站圖示 -->
<link rel="apple-touch-icon" type="image/png" href="images/logo-nbg.png"/>
<link rel="shortcut icon" type="image/png" href="images/logo-nbg.png"/>
<link rel="mask-icon" type="image/png" href="images/logo-nbg.png"/>
<title><?=$rowUser["name"]?>的個人資料</title>
<!-- 板模的css、BS5、fontawesome -->
<?php require_once("style.php"); ?>
<!-- 板模end -->
<!-- 此處新增css檔 -->
<link rel="stylesheet" href="css/ou-style.css?time=<?=time()?>">
<!-- Css檔 end -->
</head>
<body class="sb-nav-fixed">
<?php require_once("main-nav.php"); ?>
<!-- 主要內容 -->
<div id="layoutSidenav_content">
<div class="container px-0">
<main class="main px-5">
<div class="container-fluid px-4">
<h1 class="mt-4"><?=$rowUser["name"]?>的個人資料</h1>
<ol class="breadcrumb mb-4">
<li class="breadcrumb-item"><a href="home.php">首頁</a></li>
<li class="breadcrumb-item"><a href="user-list.php">會員列表</a></li>
<li class="breadcrumb-item active">會員資料</li>
</ol>
</div>
<!-- 本頁 內容 -->
<div class="row">
<div class="col-7">
<table class="table table-bordered table-sm user-table">
<tr>
<th>奴才帳號</th>
<td><?=$rowUser["account"]?></td>
</tr>
<tr>
<th>奴才email</th>
<td><?=$rowUser["email"]?></td>
</tr>
<tr>
<th>奴才姓名</th>
<td><?=$rowUser["name"]?></td>
</tr>
<tr>
<th>奴才性別</th>
<td class="d-flex">
<?php if(isset($rowUser["gender"])): ?>
<div class="form-check me-3">
<input class="form-check-input" type="radio" name="flexRadioDisabled" id="flexRadioDisabled" disabled
<?php if($rowUser["gender"]==1):
echo "checked";
endif; ?>>
<label class="form-check-label" for="flexRadioDisabled">男孩</label>
</div>
<div class="form-check me-3">
<input class="form-check-input" type="radio" name="flexRadioDisabled" id="flexRadioDisabled" disabled
<?php if ($rowUser["gender"]==2):
echo "checked";
endif; ?>>
<label class="form-check-label" for="flexRadioDisabled">女孩</label>
</div>
<div class="form-check me-3">
<input class="form-check-input" type="radio" name="flexRadioDisabled" id="flexRadioDisabled" disabled
<?php if ($rowUser["gender"]==9):
echo "checked";
endif; ?>>
<label class="form-check-label" for="flexRadioDisabled">不透漏</label>
</div>
<?php else: ?>
<div class="text-secondary">尚未提供</div>
<?php endif; ?>
</td>
</tr>
<tr>
<th>奴才生日</th>
<td><?php if(isset($rowUser["birthday"])):?>
<?=$rowUser["birthday"];?>
<?php else: ?>
<div class="text-secondary d-inline-block me-2">尚未提供</div>
<?php endif; ?>
<?php if(isset($rowUser["birthday"])):?>
<?php $now=date("Y-m-d");
$userBirth=$rowUser["birthday"];
$age=date_diff(date_create($now), date_create($userBirth)); ?>
<div class="data-time d-inline-block ms-3">
<?=$age->format('%y');?> 歲
</div>
<?php endif; ?>
</td>
</tr>
<tr>
<th>奴才手機</th>
<td><?=$rowUser["mobile"]?></td>
</tr>
<tr>
<th rowspan="2">奴才地址</th>
<td>
<span class="add-tag">郵遞區號</span>
<?php if(isset($rowUser["zip_code"])):?>
<?=$rowUser["zip_code"];?>
<?php else: ?>
<div class="text-secondary d-inline-block me-2">尚未提供</div>
<?php endif; ?>
<span class="add-tag">縣市</span>
<?php if(isset($rowUser["county"])):?>
<?=$rowUser["county"];?>
<?php else: ?>
<div class="text-secondary d-inline-block me-2">尚未提供</div>
<?php endif; ?>
</td>
</tr>
<tr>
<td>
<span class="add-tag">詳細地址</span>
<?php if(isset($rowUser["address"])):?>
<?=$rowUser["address"];?>
<?php else: ?>
<div class="text-secondary d-inline-block me-2">尚未提供</div>
<?php endif; ?>
</td>
</tr>
<tr>
<th>使用者權限</th>
<td class="d-flex">
<div class="form-check me-3">
<input class="form-check-input" type="radio" name="flexRadioDisabled2" id="flexRadioDisabled" disabled
<?php if ($rowUser["valid"]==1):
echo "checked";
endif; ?>>
<label class="form-check-label" for="flexRadioDisabled2">一般</label>
</div>
<div class="form-check me-3">
<input class="form-check-input" type="radio" name="flexRadioDisabled2" id="flexRadioDisabled" disabled
<?php if ($rowUser["valid"]==0):
echo "checked";
endif; ?>>
<label class="form-check-label" for="flexRadioDisabled2">封鎖中</label>
</div>
</td>
</tr>
</table>
<div class="text-end">
<a class="btn btn-danger" href="user-doDelete.php?id=<?=$rowUser["id"]?>"
onClick="return checkDel()">刪除會員</a>
<a class="btn btn-mao-primary" href="user-edit.php?id=<?=$rowUser["id"]?>">編輯會員資料</a>
</div>
</div>
<div class="avatar col-5">
<div>
<h4><?=$rowUser["name"]?>的大頭照</h4>
<figure class="main-pet ratio ratio-1x1">
<?php if(isset($rowUser["image"])): ?>
<img class="cover-fit" src="images/<?=$rowUser["image"]?>" alt="">
<?php else: ?>
<img class="cover-fit" src="images/avatar_user.png" alt="">
<?php endif; ?>
</figure>
</div>
<div>
<h4>目前服侍毛孩</h4>
<?php if($petTotalCount==0): ?>
<p class="text-secondary">尚無服侍毛孩</p>
<?php elseif($petTotalCount>0): ?>
<div class="d-flex flex-wrap">
<?php foreach($rowTotalPet as $eachPet): ?>
<div class="me-3">
<figure class="sub-pet ratio ratio-1x1">
<a href="pet-info.php?id=<?=$eachPet["id"]?>">
<?php if($eachPet["img"]!==""): ?>
<img class="cover-fit" src="images/<?=$eachPet["img"]?>"
alt="">
<?php else: ?>
<img class="cover-fit" src="images/avatar_pet.png" alt="">
<?php endif; ?>
</a>
</figure>
<p class="text-center"><?=$eachPet["name"]?></p>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
<!-- 本頁內容 end -->
</main><!-- 主要內容end -->
</div>
<!-- --><?php //require_once("footer.php"); ?>
</div>
<?php require_once("JS.php"); ?>
<script>
function checkDel(){
if(!confirm('確認刪除 <?=$rowUser["name"]?> 的會員資料?')){
return false;
}
}
</script>
</body>
</html>