-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsignup.php
More file actions
160 lines (133 loc) · 4.38 KB
/
signup.php
File metadata and controls
160 lines (133 loc) · 4.38 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
include "common.php";
@extract($_REQUEST);
//회원가입
if($mode == "signup") {
if($name == "") {
alert_redir("이름을 입력해주세요.", "");
exit;
}
if($id == "") {
alert_redir("아이디를 입력해주세요.", "");
exit;
}
if($pw == "") {
alert_redir("비밀번호를 입력해주세요.", "");
exit;
}
//아이디 중복검사
$sql = "select count(*) from member where id='$id'";
$row = dbqueryfetch($sql);
$dup = $row[0];
if($dup) {//아이디 중복 시
alert_redir("이미 사용 중인 아이디 입니다.\n다른 아이디를 입력해주세요.", "");
exit;
}
//데이터 입력
$enc_pw = sha1($pw);
$sql = "insert into member (id, pw, name, insdt) values ('$id', '$enc_pw', '$name', now())";
$ret = dbquery($sql);
if($ret) {
alert_redir("회원가입 완료", "signin.php");
} else {
alert_redir("회원가입 실패", "");
}
exit;
}
?>
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="M">
<meta name="generator" content="">
<title>회원가입</title>
<!-- Bootstrap core CSS -->
<link href="./css/bootstrap.min.css" rel="stylesheet">
<style>
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
</style>
<!-- Custom styles for this template -->
<link href="signup.css" rel="stylesheet">
</head>
<body class="text-center">
<main class="form-signin">
<form name="signup_form" method="post">
<input type="hidden" name="mode" value="signup">
<h1 class="h3 mb-3 fw-normal">뮤직박스</h1>
<div class="form-floating">
<input type="text" class="form-control" name="name" id="floatingName" placeholder="이름">
<label for="floatingName">이름</label>
</div>
<div class="form-floating">
<input type="text" class="form-control" name="id" id="floatingId" placeholder="아이디">
<label for="floatingId">아이디</label>
</div>
<div class="form-floating">
<input type="password" class="form-control" name="pw" id="floatingPassword" placeholder="비밀번호">
<label for="floatingPassword">비밀번호</label>
</div>
<div class="form-floating">
<input type="password" class="form-control" name="pw2" id="floatingPassword2" placeholder="비밀번호 확인">
<label for="floatingPassword2">비밀번호 확인</label>
</div>
<div class="checkbox mb-3">
</div>
<button class="w-100 btn btn-lg btn-primary" type="button" onClick="form_check()">회원가입</button>
<p class="mt-5 mb-3 text-muted">© 2021</p>
</form>
</main>
<script src="./js/jquery.min.js"></script>
</body>
</html>
<script>
function form_check() {
form = document.signup_form;
var name = $("#floatingName").val();
var id = $("#floatingId").val();
var pw = $("#floatingPassword").val();
var pw2 = $("#floatingPassword2").val();
if(name == "") {
alert('이름을 입력해주세요.');
form.name.focus();
return false;
}
if(id == "") {
alert('아이디를 입력해주세요.');
form.id.focus();
return false;
}
if(pw == "") {
alert('비밀번호를 입력해주세요.');
form.pw.focus();
return false;
}
if(pw2 == "") {
alert('확인용 비밀번호를 입력해주세요.');
form.pw2.focus();
return false;
}
if(pw != pw2) {
alert('비밀번호가 일치하지 않습니다. 다시 입력해주세요');
form.pw.value = '';
form.pw2.value = '';
form.pw.focus();
return false;
}
if(!confirm('회원가입 정보를 전송하시겠습니까?')) return;
form.submit();
}
</script>