001.
<strong>Code (PHP)</strong>
002.
[php]<!doctype html>
003.
004.
<?php
005.
session_start();
006.
if
(
$_SESSION
[
'UserID'
] ==
""
)
007.
{
008.
header(
"location:login.php"
);
009.
010.
exit
();
011.
}
012.
013.
if
(
$_SESSION
[
'Status'
] !=
"ADMIN"
)
014.
{
015.
echo
"This page for Admin only!"
;
016.
exit
();
017.
}
018.
019.
mysql_connect(
"localhost"
,
"root"
,
"12341234"
);
020.
mysql_select_db(
"nurising room"
);
021.
$strSQL
=
"SELECT * FROM member WHERE UserID = '"
.
$_SESSION
['UserID
']."'
";
022.
$objQuery
= mysql_query(
$strSQL
);
023.
$objResult
= mysql_fetch_array(
$objQuery
);
024.
?>
025.
<html>
026.
027.
<head>
028.
<script type=
"text/javascript"
>
029.
function
login() {
030.
031.
032.
$.ajax( {
033.
type:
'POST'
,
034.
url:
"loginstudent.php"
,
035.
data: {
036.
Id_collegian: $(
'#Id_collegian'
).val()
037.
},
038.
dataType:
'json'
,
039.
success:
function
( result ) {
040.
if
(result ==
'0'
){
041.
alert(
"ไม่พบรหัส"
);
042.
}
else
{
043.
window.location =
'admin_page_studen.php?Id_collegian='
+ $(
'#Id_collegian'
).val();
044.
045.
}
046.
}
047.
} );
048.
}
049.
</script>
050.
051.
<link rel=
"stylesheet"
media=
"all"
type=
"text/css"
href=
"jquery-ui.css"
/>
052.
<link rel=
"stylesheet"
media=
"all"
type=
"text/css"
href=
"jquery-ui-timepicker-addon.css"
/>
053.
054.
<script type=
"text/javascript"
src=
"jquery-1.10.2.min.js"
></script>
055.
<script src=
"jquery-2.1.1.min.js"
> </script>
056.
058.
059.
<title> User </title>
060.
</head>
061.
062.
<body background=../image/clound3.jpg marginwidth=
"100%"
>
063.
<form>
064.
<form>
065.
<table width=
"100%"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
background=
"../image/clound3.jpg"
>
066.
<tbody>
067.
<tr><th> </th></tr>
068.
<tr>
069.
<th scope=
"row"
align=
"left"
><img src=
"../image/Nurising1.png"
width=
"50%"
align=
"left"
> </th>
070.
<th scope=
"row"
align=
"right"
><img src=
"../image/band1.png"
width=
"50%"
align=
"right"
></th>
071.
</tr>
072.
<tr><th> </th></tr>
073.
</tbody>
074.
</table>
075.
</form>
076.
<table width=
"100%"
border=
"0"
cellspacing=
"3"
cellpadding=
"3"
>
077.
<tbody>
078.
<tr>
079.
<th height=
"37"
align=
"center"
bgcolor=
"#4682B4"
scope=
"row"
style=
"color:white;"
>
080.
<p
class
=
"text-right"
>ยินดีต้อนรับสู่เว็บไซต์ระบบจัดการงานห้องพยาบาล รหัส
081.
<?php
echo
$objResult
[
"Username"
];?> ชื่อ
082.
<?php
echo
$objResult
[
"Name"
];?> <a href=
"edit_profile.php"
>Edit</a> <a href=
"logout.php"
>Logout</a>
083.
</p>
084.
</th>
085.
</tr>
086.
</tbody>
087.
</table>
088.
<table width=
"100%"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
bgcolor=
"#FFFFFF"
>
089.
<tbody>
090.
<tr>
091.
<td><ul
class
=
"nav nav-tabs"
>
092.
<li
class
=
"nav-item"
>
093.
<a
class
=
"nav-link"
href=
"admin_page.php"
>หน้าหลัก</a>
094.
</li>
095.
<li
class
=
"nav-item dropdown"
>
096.
<a
class
=
"nav-link dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
role=
"button"
aria-haspopup=
"true"
aria-expanded=
"false"
>บันทึกการเข้าใช้บริการ</a>
097.
<div
class
=
"dropdown-menu"
>
098.
<a
class
=
"dropdown-item"
href=
"admin_page_search_student.php"
>นักศึกษา</a>
099.
<a
class
=
"dropdown-item"
href=
"admin_page_search_personnel.php"
>บุคลากร</a>
100.
<a
class
=
"dropdown-item"
href=
"admin_page_search_aidbox.php"
>เบิกกล่องปฐมพยาบาล</a>
101.
</div>
102.
</li>
103.
<li
class
=
"nav-item dropdown"
>
104.
<a
class
=
"nav-link dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
role=
"button"
aria-haspopup=
"true"
aria-expanded=
"false"
>ฐานข้อมูลยา</a>
105.
<div
class
=
"dropdown-menu"
>
106.
<a
class
=
"dropdown-item"
href=
"admin_page_stock_drug.php"
>คลังยา</a>
107.
<a
class
=
"dropdown-item"
href=
"admin_page_stock_aidbox.php"
>ชุดกล่องปฐมพยาบาล</a>
108.
</div>
109.
</li>
110.
<li
class
=
"nav-item dropdown"
>
111.
<a
class
=
"nav-link dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
role=
"button"
aria-haspopup=
"true"
aria-expanded=
"false"
>ประวัติ</a>
112.
<div
class
=
"dropdown-menu"
>
113.
<a
class
=
"dropdown-item"
href=
"admin_page_history_service.php"
>ประวัติการเข้าใช้บริการ</a>
114.
<a
class
=
"dropdown-item"
href=
"admin_page_history_drug.php"
>ประวัติการเบิกจ่ายยา</a>
115.
<a
class
=
"dropdown-item"
href=
"admin_page_history_aidbox.php"
>ประวัติการยืมคืนชุดกล่องปฐมพยาบาล</a>
116.
</div>
117.
</li>
118.
</ul></td>
119.
</tr>
120.
</tbody>
121.
</table>
122.
123.
<table width=
"100%"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
bgcolor=
"#FFFFFF"
>
124.
<tbody>
125.
<tr>
126.
<td colspan=
"5"
>
127.
<center><b> </b>
128.
</center>
129.
</td>
130.
</tr>
131.
<tr>
132.
<td colspan=
"5"
>
133.
<center>
134.
<h3><b>เพิ่มข้อมูลนักศึกษา</b>
135.
</h3>
136.
</center>
137.
</td>
138.
</tr>
139.
140.
141.
142.
<tr>
143.
<td colspan=
"5"
align=
"center"
>
144.
145.
146.
147.
148.
<?php
149.
$host
=
"localhost"
;
150.
$username
=
"root"
;
151.
$pass
=
"12341234"
;
152.
$db
=
"nurising room"
;
153.
$connect
=mysqli_connect(
$host
,
$username
,
$pass
,
$db
);
154.
155.
$Id_collegian
=trim(
$_POST
[Id_collegian]);
156.
$First_collegian
=trim(
$_POST
[First_collegian]);
157.
$Last_collegian
=trim(
$_POST
[Last_collegian]);
158.
$Gender_collegian
=trim(
$_POST
[Gender_collegian]);
159.
$Faculty_collegian
=trim(
$_POST
[Faculty_collegian]);
160.
$Major_collegian
=trim(
$_POST
[Major_collegian]);
161.
$Congenital_collegian
=trim(
$_POST
[Congenital_collegian]);
162.
$Allergy_collegian
=trim(
$_POST
[Allergy_collegian]);
163.
$Email_collegian
=trim(
$_POST
[Email_collegian]);
164.
$Tel_collegian
=trim(
$_POST
[Tel_collegian]);
165.
$Parent_collegian
=trim(
$_POST
[Parent_collegian]);
166.
$TelParent_collegian
=trim(
$_POST
[TelParent_collegian]);
167.
$Parent_collegian2
=trim(
$_POST
[Parent2_collegian]);
168.
$TelParent2_collegian
=trim(
$_POST
[TelParent2_collegian]);
169.
$Parent3_collegian
=trim(
$_POST
[Parent3_collegian]);
170.
$TelParent3_collegian
=trim(
$_POST
[TelParent3_collegian]);
171.
$Parent4_collegian
=trim(
$_POST
[Parent4_collegian]);
172.
$TelParent4_collegian
=trim(
$_POST
[TelParent4_collegian]);
173.
$Teacher_collegian
=trim(
$_POST
[Teacher_collegian]);
174.
$TelTeacher_collegian
=trim(
$_POST
[TelTeacher_collegian]);
175.
if
(
$Id_collegian
!=
""
){
176.
177.
178.
$sql
="insert into collegian set
179.
Id_collegian=
'$Id_collegian'
,
180.
First_collegian=
'$First_collegian'
,
181.
Last_collegian=
'$Last_collegian'
,
182.
Gender_collegian=
'$Gender_collegian'
,
183.
Faculty_collegian=
'$Faculty_collegian'
,
184.
Major_collegian=
'$Major_collegian'
,
185.
Congenital_collegian
'$Congenital_collegian'
,
186.
Allergy_collegian
'$Allergy_collegian'
,
187.
Email_collegian
'$Email_collegian'
,
188.
Tel_collegian
'$Tel_collegian'
,
189.
Parent_collegia
'$Parent_collegian'
,
190.
TelParent_collegian
'$TelParent_collegian'
,
191.
Parent_collegian2
'$Parent_collegian2'
,
192.
TelParent2_collegian
'$TelParent2_collegian'
,
193.
Parent3_collegian
'$Parent3_collegian'
,
194.
TelParent3_collegian
'$TelParent3_collegian'
,
195.
Parent4_collegian
'$Parent4_collegian'
,
196.
TelParent4_collegian
'$TelParent4_collegian'
,
197.
Teacher_collegian
''
$Teacher_collegian
',
198.
TelTeacher_collegian
'$TelTeacher_collegian'
";
199.
200.
$result
=mysqli_query(
$connect
,
$sql
);
201.
$id
=mysqli_insert_id(
$connect
);
202.
203.
exit
("<script>
204.
alert(
'save data'
);
205.
window.location=
'admin_page_search_student.php'
;
206.
</script>");}
207.
208.
?>
209.
210.
<form form name=
"form1"
id=
"form1"
method=
"post"
enctype=
"multipart/form-data"
>
211.
212.
<table width=
"100%"
class
=
"table"
>
213.
<tr><th colspan=
"6"
><h5><b>ประวัติส่วนตัว</b></h5></th></tr>
214.
<tr>
215.
<th width=
"10%"
> รหัสนักศึกษา :</th>
216.
<td colspan=
"5"
><input type=
"text"
name=
"Id_collegian"
id=
"Id_collegian"
width=
"100%"
></td>
217.
</tr>
218.
<tr>
219.
<th width=
"10%"
> ชื่อ :</th>
220.
<td width=
"15%"
><input type=
"text"
name=
"First_collegian"
id=
"First_collegian"
width=
"100%"
></td>
221.
<th width=
"10%"
>นามสกุล :</th>
222.
<td width=
"15%"
><input type=
"text"
name=
"Last_collegian"
id=
"Last_collegian"
></td>
223.
<th width=
"10%"
>เพศ :</th>
224.
<td width=
"15%"
><input type=
"text"
name=
"Gender_collegian"
id=
"Gender_collegian"
></td>
225.
</tr>
226.
<tr>
227.
228.
</tr>
229.
<tr>
230.
<th width=
"10%"
> คณะ :</th>
231.
<td><input type=
"text"
name=
"Faculty_collegian"
id=
"Faculty_collegian"
></td>
232.
<th width=
"10%"
>สาขา :</th>
233.
<td><input type=
"text"
name=
"Major_collegian"
id=
"Major_collegian"
></td>
234.
<th width=
"10%"
>ชั้นปีที่ :</th>
235.
<td> <select name=
"class_collegian"
id=
"class_collegian"
>
236.
<option disabled selected>- - - เลือก - - -</option>
237.
<option value=
"1"
>1</option>
238.
<option value=
"2"
>2</option>
239.
<option value=
"3"
>3</option>
240.
<option value=
"4"
>4</option>
241.
<option value=
"5"
>5</option>
242.
</select></td>
243.
244.
</tr>
245.
<tr>
246.
<th width=
"10%"
> โรคประจำตัว :</th>
247.
<td><input type=
"text"
name=
"Congenital_collegian"
id=
"Congenital_collegian"
></td>
248.
<th width=
"10%"
>ยาที่เเพ้ :</th>
249.
<td colspan=
"5"
><input type=
"text"
name=
"Allergy_collegian"
id=
"Allergy_collegian"
></td>
250.
</tr>
251.
<tr>
252.
<th width=
"10%"
> อีเมล์ :</th>
253.
<td><input type=
"text"
name=
"Email_collegian"
id=
"Email_collegian"
></td>
254.
<th width=
"10%"
>เบอร์โทรศัพท์ :</th>
255.
<td colspan=
"5"
><input type=
"text"
name=
"Tel_collegian"
id=
"Tel_collegian"
></td>
256.
</tr>
257.
<tr>
258.
<tr><th colspan=
"6"
><h5><b>ผู้ที่สามารถติดต่อได้</b></h5></th></tr>
259.
<tr>
260.
<th width=
"10%"
> 1. ชื่อ-นามสกุล :</th>
261.
<td><input type=
"text"
name=
"Parent_collegian"
id=
"Parent_collegian"
></td>
262.
<th width=
"10%"
>เบอร์โทรศัพท์ :</th>
263.
<td colspan=
"5"
><input type=
"text"
name=
"TelParent_collegian"
id=
"TelParent_collegian"
></td>
264.
</tr>
265.
<tr>
266.
<th width=
"10%"
> 2. ชื่อ-นามสกุล :</th>
267.
<td><input type=
"text"
name=
"Parent2_collegian"
id=
"Parent2_collegian"
></td>
268.
<th width=
"10%"
>เบอร์โทรศัพท์ :</th>
269.
<td colspan=
"5"
><input type=
"text"
name=
"TelParent2_collegian"
id=
"TelParent2_collegian"
></td>
270.
</tr>
271.
<tr>
272.
<th width=
"10%"
> 3. ชื่อ-นามสกุล :</th>
273.
<td><input type=
"text"
name=
"Parent3_collegian"
id=
"Parent3_collegian"
></td>
274.
<th width=
"10%"
>เบอร์โทรศัพท์ :</th>
275.
<td colspan=
"5"
><input type=
"text"
name=
"TelParent3_collegian"
id=
"TelParent3_collegian"
></td>
276.
</tr>
277.
<tr>
278.
<th width=
"10%"
> 4. ชื่อ-นามสกุล :</th>
279.
<td><input type=
"text"
name=
"Parent4_collegian"
id=
"Parent4_collegian"
></td>
280.
<th width=
"10%"
>เบอร์โทรศัพท์ :</th>
281.
<td colspan=
"5"
><input type=
"text"
name=
"TelParent4_collegian"
id=
"TelParent4_collegian"
></td>
282.
</tr>
283.
<tr><th colspan=
"6"
><h5><b>อาจารย์ที่ปรึกษา</b></h5></th></tr>
284.
<tr>
285.
<th width=
"10%"
> ชื่อ-นามสกุล :</th>
286.
<td><input type=
"text"
name=
"Teacher_collegian"
id=
"Teacher_collegian"
></td>
287.
<th width=
"10%"
class
=
"align-content-md-end"
>เบอร์โทรศัพท์ :</th>
288.
<td colspan=
"5"
><input type=
"text"
name=
"TelTeacher_collegian"
id=
"TelTeacher_collegian"
></td>
289.
</tr>
290.
<tr>
291.
<th colspan=
"6"
><p> </p></th></tr>
292.
</table>
293.
<input type=
"submit"
name=
"submit"
value=
"ตกลง"
href=
"admin_page.php"
> <input type=
"reset"
value=
"ยกเลิก"
>
294.
</form>
295.
<table width=
"100%"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
>
296.
<tbody>
297.
<tr>
298.
<td width=
"20%"
align=
"center"
><a href=
"admin_page.php"
>
299.
<button type=
"button"
class
=
"btn btn-outline-primary"
href=
"admin_page"
>← หน้าหลัก</button>
300.
</a>
301.
<p> </p>
302.
<p><a href=
"admin_page.php"
> </a></p></td>
303.
<td> </td>
304.
</tr>
305.
</tbody>
306.
</table>
307.
</td>
308.
</tr>
309.
310.
</tbody>
311.
</table>
312.
313.
<table width=
"100%"
border=
"0"
cellspacing=
"3"
cellpadding=
"3"
>
314.
<tbody>
315.
<tr>
316.
<th scope=
"row"
align=
"center"
bgcolor=
"#4682B4"
style=
"color:white;"
>
317.
<div>
318.
<center> Copyright © 2018 มหาวิทยาลัยสวนดุสิต Suan Dusit University. All Rights Reserved </center>
319.
</div>
320.
</th>
321.
</tr>
322.
</tbody>
323.
</table>
324.
325.
329.
</body>
330.
331.
</html>