-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsignUp_check.php
45 lines (40 loc) · 1.38 KB
/
signUp_check.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
<?php
include "../password.php";
$id=$_POST['id'];
$pw=$_POST['pw'];
$pwc=$_POST['pwc'];
$booth=$_POST['booth'];
$userpw = password_hash($_POST['pw'], PASSWORD_DEFAULT);
if($pw!=$pwc)
{
echo "비밀번호와 비밀번호 확인이 다릅니다.";
echo "<button onclick=\"location.href='signUp.html'\"> 돌아가기 </button>";
exit();
}
if($id==NULL || $pw==NULL || $booth==NULL)
{
echo "빈칸을 모두 채워주세요";
echo "<button onclick=\"location.href='signUp.html'\"> 돌아가기 </button>";
exit();
}
require('db.php');
$check="SELECT *from user_info WHERE userid='$id'";
$result=$mysqli->query($check);
if($result->num_rows==1)
{
echo "중복된 아이디입니다.";
echo "<button onclick=\"location.href='signUp.html'\"> 돌아가기 </button>";
exit();
}
$signup=mysqli_query($mysqli,"INSERT INTO user_info (userid,userpw,boothname) VALUES ('$id','$userpw','$booth')");
if($signup)
{
?>
<meta charset="utf-8" />
<script type="text/javascript">alert('회원가입이 완료되었습니다.');</script>
<meta http-equiv="refresh" content="0 url=/">
<?php
}
else
echo "<button onclick=\"location.href='signUp.html'\"> 회원가입 실패, 돌아가기 </button>";
?>