質問編集履歴
1
変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
|
22
22
|
|
23
|
-
public static function check_input($colName
|
23
|
+
public static function check_input($value,$colName)
|
24
24
|
|
25
25
|
{
|
26
26
|
|
@@ -38,15 +38,41 @@
|
|
38
38
|
|
39
39
|
|
40
40
|
|
41
|
-
public static function check_ma
|
41
|
+
public static function check_name($value,$colName,$length)
|
42
|
-
|
42
|
+
|
43
|
-
{
|
43
|
+
{
|
44
|
-
|
44
|
+
|
45
|
-
$error = [];
|
45
|
+
$error = [];
|
46
|
-
|
46
|
+
|
47
|
-
self::check_input($colName
|
47
|
+
self::check_input($value,$colName);
|
48
|
+
|
48
|
-
|
49
|
+
$name = filter_input(INPUT_POST, $value);
|
50
|
+
|
51
|
+
$name_length = mb_strlen($name,"UTF-8");
|
52
|
+
|
53
|
+
if($name_length > $length){
|
54
|
+
|
55
|
+
$error[] = $colName . 'は'. $length . '文字以下で入力してください。';
|
56
|
+
|
57
|
+
}
|
58
|
+
|
59
|
+
return $error;
|
60
|
+
|
61
|
+
}
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
public static function check_mail($value,$colName)
|
66
|
+
|
67
|
+
{
|
68
|
+
|
69
|
+
$error = [];
|
70
|
+
|
71
|
+
self::check_input($value,$colName);
|
72
|
+
|
73
|
+
$mail = filter_input(INPUT_POST, $value);
|
74
|
+
|
49
|
-
if(filter_var($
|
75
|
+
if(filter_var($mail,FILTER_VALIDATE_EMAIL) === false){
|
50
76
|
|
51
77
|
$error[] = $colName . 'を正しい形式で入力してください。';
|
52
78
|
|
@@ -58,19 +84,19 @@
|
|
58
84
|
|
59
85
|
|
60
86
|
|
61
|
-
public static function check_
|
87
|
+
public static function check_pass($value,$colName)
|
62
|
-
|
88
|
+
|
63
|
-
{
|
89
|
+
{
|
64
|
-
|
90
|
+
|
65
|
-
$error = [];
|
91
|
+
$error = [];
|
66
|
-
|
92
|
+
|
67
|
-
self::check_input($colName
|
93
|
+
self::check_input($value,$colName);
|
68
|
-
|
94
|
+
|
69
|
-
$
|
95
|
+
$pass = filter_input(INPUT_POST, $value);
|
70
|
-
|
96
|
+
|
71
|
-
if(
|
97
|
+
if(preg_match('/\A(?=.*?[a-z])(?=.*?\d)[a-z\d]{6,10}+\z/i',$pass)){
|
72
|
-
|
98
|
+
|
73
|
-
$error[] = $colName . 'は
|
99
|
+
$error[] = $colName . 'は半角英数字をそれぞれ1種類以上含む6文字以上10文字以下で入力してください。';
|
74
100
|
|
75
101
|
}
|
76
102
|
|
@@ -78,26 +104,6 @@
|
|
78
104
|
|
79
105
|
}
|
80
106
|
|
81
|
-
|
82
|
-
|
83
|
-
public static function check_pass($colName,$value)
|
84
|
-
|
85
|
-
{
|
86
|
-
|
87
|
-
$error = [];
|
88
|
-
|
89
|
-
self::check_input($colName,$value);
|
90
|
-
|
91
|
-
if(preg_match('/\A(?=.*?[a-z])(?=.*?\d)[a-z\d]{6,10}+\z/i',$value)){
|
92
|
-
|
93
|
-
$error[] = $colName . 'は半角英数字をそれぞれ1種類以上含む6文字以上10文字以下で入力してください。';
|
94
|
-
|
95
|
-
}
|
96
|
-
|
97
|
-
return $error;
|
98
|
-
|
99
|
-
}
|
100
|
-
|
101
107
|
}
|
102
108
|
|
103
109
|
|
@@ -118,22 +124,18 @@
|
|
118
124
|
|
119
125
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
120
126
|
|
121
|
-
|
127
|
+
ValidateForm::check_name($_POST['name'],'名前',6);
|
122
|
-
|
128
|
+
|
123
|
-
|
129
|
+
ValidateForm::check_mail($_POST['mail'],'メール');
|
124
|
-
|
130
|
+
|
125
|
-
|
131
|
+
ValidateForm::check_pass($_POST['pass'],'パスワード');
|
126
132
|
|
127
133
|
}
|
128
134
|
|
129
|
-
ValidateForm::check_name('名前',$name,6);
|
130
|
-
|
131
|
-
ValidateForm::check_mail('メール',$mail);
|
132
|
-
|
133
|
-
ValidateForm::check_pass('パスワード',$pass);
|
134
|
-
|
135
135
|
?>
|
136
136
|
|
137
|
+
|
138
|
+
|
137
139
|
<!DOCTYPE html>
|
138
140
|
|
139
141
|
<html lang="ja" dir="ltr">
|