-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.php
73 lines (65 loc) · 1.73 KB
/
signup.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
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>회원가입중</title>
</head>
<body>
<?php
if($_SERVER['REQUEST_METHOD'] === 'POST')
{
$name = $_POST['userName'];
$id = $_POST['userId'];
$password = $_POST['userPassword'];
$password_again = $_POST['userPasswordAgain'];
$conn = mysqli_connect('localhost', 'TeamA', 'TeamA1234567@', 'test');
$sql_id_find = "SELECT * FROM user_login WHERE login_id='$id'";
if($result = mysqli_fetch_array(mysqli_query($conn, $sql_id_find)))
{
$heredoc = <<< HERE
<span>이미 존재하는 아이디입니다.</span>
<button onclick="history.back()">돌아가기</button>
HERE;
echo $heredoc;
}
else if(strcmp($password, $password_again) != 0)
{
$heredoc = <<< HERE
<span>비밀번호가 다릅니다.</span>
<button onclick="history.back()">돌아가기</button>
HERE;
echo $heredoc;
}
else
{
$sql = "INSERT INTO user_login(login_id, login_pw, created, user_name) VALUES ('$id', '$password', now(), '$name')";
if($result = mysqli_query($conn, $sql))
{
$heredoc = <<< HERE
<span>계정 생성에 성공했습니다.</span>
<button onclick="location.href='/'">로그인으로 돌아가기</button>
HERE;
echo $heredoc;
}
else
{
$heredoc = <<< HERE
<span>계정 생성에 실패했습니다.</span>
<button onclick="history.back()">돌아가기</button>
HERE;
echo $heredoc;
}
}
}
else
{
$heredoc = <<< HERE
<span>잘못된 접근입니다.</span>
HERE;
echo $heredoc;
}
?>
</body>
</html>