回答編集履歴
1
修正
test
CHANGED
@@ -1,92 +1,88 @@
|
|
1
1
|
```html
|
2
|
+
|
3
|
+
<?php
|
4
|
+
|
5
|
+
try {
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
// $staff_code = $_POST['code'];
|
10
|
+
|
11
|
+
// $staff_name = $_POST['name'];
|
12
|
+
|
13
|
+
// $staff_pass = $_POST['pass'];
|
14
|
+
|
15
|
+
$staff_code = filter_input(INPUT_POST, 'code');
|
16
|
+
|
17
|
+
$staff_name = filter_input(INPUT_POST, 'name');
|
18
|
+
|
19
|
+
$staff_pass = filter_input(INPUT_POST, 'pass');
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
// $staff_name = htmlspecialchars($staff_name);
|
24
|
+
|
25
|
+
// $staff_pass = htmlspecialchars($staff_pass);
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
$dsn = 'mysql:dbname=shop;host=localhost;charset=utf8';
|
30
|
+
|
31
|
+
$user = 'root';
|
32
|
+
|
33
|
+
$password = '';
|
34
|
+
|
35
|
+
$dbh = new PDO($dsn, $user, $password);
|
36
|
+
|
37
|
+
// $dbh->query('SET NAMES utf8');
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
$sql = 'UPDATE mst_staff SET name=?,password=? WHERE code=?';
|
42
|
+
|
43
|
+
$stmt = $dbh->prepare($sql);
|
44
|
+
|
45
|
+
$data[] = $staff_name;
|
46
|
+
|
47
|
+
$data[] = $staff_pass;
|
48
|
+
|
49
|
+
$data[] = $staff_code;
|
50
|
+
|
51
|
+
$stmt->execute($data);
|
52
|
+
|
53
|
+
$msg = "修正しました。";
|
54
|
+
|
55
|
+
} catch (Exception $e) {
|
56
|
+
|
57
|
+
$msg = 'ただいま障害により大変ご迷惑をおかけしています。';
|
58
|
+
|
59
|
+
}
|
60
|
+
|
61
|
+
?>
|
2
62
|
|
3
63
|
<!DOCTYPE html>
|
4
64
|
|
5
65
|
<html>
|
6
66
|
|
7
|
-
|
67
|
+
<head>
|
8
68
|
|
9
|
-
|
69
|
+
<meta charset="UTF-8">
|
10
70
|
|
11
|
-
|
71
|
+
<title>ろくまる農園</title>
|
12
72
|
|
13
|
-
|
73
|
+
</head>
|
14
74
|
|
15
75
|
|
16
76
|
|
17
|
-
|
77
|
+
<body>
|
18
78
|
|
19
|
-
<?php
|
79
|
+
<?php echo $msg; ?><br>
|
20
80
|
|
21
|
-
|
81
|
+
<br>
|
22
82
|
|
83
|
+
<a href="staff_list.php">戻る</a>
|
23
84
|
|
24
|
-
|
25
|
-
// $staff_code = $_POST['code'];
|
26
|
-
|
27
|
-
// $staff_name = $_POST['name'];
|
28
|
-
|
29
|
-
// $staff_pass = $_POST['pass'];
|
30
|
-
|
31
|
-
$staff_code = filter_input(INPUT_POST, 'code');
|
32
|
-
|
33
|
-
$staff_name = filter_input(INPUT_POST, 'name');
|
34
|
-
|
35
|
-
$staff_pass = filter_input(INPUT_POST, 'pass');
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
// $staff_name = htmlspecialchars($staff_name);
|
40
|
-
|
41
|
-
// $staff_pass = htmlspecialchars($staff_pass);
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
$dsn = 'mysql:dbname=shop;host=localhost;charset=utf8';
|
46
|
-
|
47
|
-
$user = 'root';
|
48
|
-
|
49
|
-
$password = '';
|
50
|
-
|
51
|
-
$dbh = new PDO($dsn, $user, $password);
|
52
|
-
|
53
|
-
// $dbh->query('SET NAMES utf8');
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
$sql = 'UPDATE mst_staff SET name=?,password=? WHERE code=?';
|
58
|
-
|
59
|
-
$stmt = $dbh->prepare($sql);
|
60
|
-
|
61
|
-
$data[] = $staff_name;
|
62
|
-
|
63
|
-
$data[] = $staff_pass;
|
64
|
-
|
65
|
-
$data[] = $staff_code;
|
66
|
-
|
67
|
-
$stmt->execute($data);
|
68
|
-
|
69
|
-
} catch (Exception $e) {
|
70
|
-
|
71
|
-
print'ただいま障害により大変ご迷惑をおかけしています。';
|
72
|
-
|
73
|
-
exit();
|
74
|
-
|
75
|
-
}
|
76
|
-
|
77
|
-
?>
|
78
|
-
|
79
|
-
修正しました。<br>
|
80
|
-
|
81
|
-
<br>
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
<a href="staff_list.php">戻る</a>
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
85
|
+
</body>
|
90
86
|
|
91
87
|
</html>
|
92
88
|
|