質問編集履歴

1

ソースコードを全文のせました

2017/02/20 13:36

投稿

maguko
maguko

スコア7

test CHANGED
File without changes
test CHANGED
@@ -8,21 +8,131 @@
8
8
 
9
9
  ###該当のソースコード
10
10
 
11
- $staff_pass=md5($staff_pass);
11
+ <!DOCTYPE html>
12
12
 
13
- print '<form method="post" action="staff_add_done.php">';
13
+ <html>
14
14
 
15
- print '<input type="hidden" name="name" value="'.$staff_name.'">';
15
+ <head>
16
16
 
17
- print '<input type="hidden" name="pass" value="'.$staff_pass.'">';
17
+ <meta charset="UTF-8">
18
18
 
19
- print '<br />';
19
+ <title>みつる農園</title>
20
20
 
21
- print '<input type="button" onclick="history.back()" value="戻る">';
21
+ </head>
22
22
 
23
- print '<input type="submit" value="OK">';
23
+ <body>
24
24
 
25
+
26
+
27
+ <?php
28
+
29
+
30
+
31
+ $staff_name=$_POST['name'];
32
+
33
+ $staff_pass=$_POST['pass'];
34
+
35
+ $staff_pass2=$_POST['pass2'];
36
+
37
+
38
+
39
+ $staff_name=htmlspecialchars($staff_name,ENT_QUOTES,'UTF-8');
40
+
41
+ $staff_pass=htmlspecialchars($staff_pass,ENT_QUOTES,'UTF-8');
42
+
43
+ $staff_pass2=htmlspecialchars($staff_pass2,ENT_QUOTES,'UTF-8');
44
+
45
+
46
+
47
+ if($staff_name=='')
48
+
49
+ {
50
+
51
+ print 'スタッフ名が入力されていません。<br />';
52
+
53
+ }
54
+
55
+ else
56
+
57
+ {
58
+
59
+ print 'スタッフ名:';
60
+
61
+ print $staff_name;
62
+
63
+ print '<br />';
64
+
65
+ }
66
+
67
+
68
+
69
+ if($staff_pass=='')
70
+
71
+ {
72
+
73
+ print 'パスワードが入力されていません。<br />';
74
+
75
+ }
76
+
77
+
78
+
79
+ if($staff_pass!=$staff_pass2)
80
+
81
+ {
82
+
83
+ print 'パスワードが一致しません。<br />';
84
+
85
+ }
86
+
87
+
88
+
89
+ if($staff_name='' || $staff_pass='' || $staff_pass!=$staff_pass2)
90
+
91
+ {
92
+
93
+ print '<form>';
94
+
95
+ print '<input type="button" onclick="history.back()" value="戻る">';
96
+
25
- print '</form>';
97
+ print '</form>';
98
+
99
+ }
100
+
101
+ else
102
+
103
+ {
104
+
105
+
106
+
107
+ $staff_pass=md5($staff_pass);
108
+
109
+ print '<form method="post" action="staff_add_done.php">';
110
+
111
+ print '<input type="hidden" name="name" value="'.$staff_name.'">';
112
+
113
+ print '<input type="hidden" name="pass" value="'.$staff_pass.'">';
114
+
115
+ print '<br />';
116
+
117
+ print '<input type="button" onclick="history.back()" value="戻る">';
118
+
119
+ print '<input type="submit" value="OK">';
120
+
121
+ print '</form>';
122
+
123
+ }
124
+
125
+
126
+
127
+ ?>
128
+
129
+
130
+
131
+ </body>
132
+
133
+ </html>
134
+
135
+
26
136
 
27
137
  ###試したこと
28
138