-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSign.php
More file actions
55 lines (47 loc) · 1.37 KB
/
Sign.php
File metadata and controls
55 lines (47 loc) · 1.37 KB
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
<form accept-charset="utf-8" action="" method="get" name="person_info">
이름 : <input name="name" required="" type="text" />
<br>
<br>
이메일 : <input name="email" required="" type="text" />
<br>
<br>
생년월일 : <input name="birth_day" required="" type="text" />
<br>
<input type="submit" value="로그인"/>
</form>
<?php
$name = $_GET["name"];
$email = $_GET["email"];
$birthDay = $_GET["birth_day"];
if (strlen($name) < 2) {
echo "이름 길이는 최소 2자 이상이여야 합니다.";
return;
}
if (strpos($email, "@") === false) {
echo "이메일이 올바르지 않습니다.";
return;
}
if (!in_array(explode("@", $email)[1], ["naver.com", "gmail.com"])) {
echo "지원하지 않는 이메일 입니다.";
return;
}
$split = explode("-", $birthDay);
if (count($split) === 3) {
foreach ($split as $str) {
if (!is_numeric($str)) {
echo "생년월일은 숫자만 적어주세요.";
return;
}
}
} else {
echo "생년월일은 yyyy-mm-dd 형식으로 적어주세요.";
return;
}
foreach ([
"------- 회원가입 정보 ------",
" - 이름: " . $name,
" - 이메일: " . $email,
" - 생년월일: " . $birthDay
] as $str)
echo $str . PHP_EOL;
?>