-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshift_confirm.php
73 lines (52 loc) · 1.41 KB
/
shift_confirm.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
<?php
//データベースに接続
$dsn = 'mysql:dbname=xs443757_shift;host=localhost';
$user = '*******';
$password = '*******';
try{
$dbh = new PDO($dsn, $user, $password);
}catch (PDOException $e){
print('Error:'.$e->getMessage());
die();
}
//セッションスタート
session_start();
$id = $_SESSION['user_id'];
//ユーザー情報の取得
$sql ="
SELECT *
FROM login
WHERE id = :id
";
$stmt = $dbh->prepare($sql);
$stmt->bindValue("id", $id);
$stmt->execute();
$user = $stmt->fetch();
//リダイレクト処理
if (isset($_SESSION['user_id'])) {//ログインしているとき
if($user['status'] != 1){
//管理者か確認
printf("あなたは管理者ではありません。");
exit();
}
} else {//ログインしていない時
header('Location: ./login_form.php');
exit();
}
?>
<HTML>
<HEAD>
<TITLE>メニュー</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
</HEAD>
<BODY>
メニュー<BR>
<UL>
<LI><A HREF="employee_list.php">従業員の一覧表示</A>
<LI><A HREF="employee_add_form.php">従業員のデータ追加</A>
<LI><A HREF="employee_delete_form.php">従業員のデータ削除</A>
<LI><A HREF="employee_update_form1.php">従業員のデータ更新</A>
<LI><A HREF="employee_search_form.php">従業員の検索(部門名での検索)</A>
</UL>
</BODY>
</HTML>