-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcheck_signup.php
More file actions
38 lines (32 loc) · 1.34 KB
/
check_signup.php
File metadata and controls
38 lines (32 loc) · 1.34 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
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
session_start();
include_once 'dbconfig.php';
$db_name = 'keeping';
mysqli_select_db($conn, $db_name);
$signup_id = $_POST['id'];
$signup_pass = $_POST['pw'];
$signup_nickname = $_POST['nickname'];
$signup_email = $_POST['email'];
// 아이디 중복 체크
$check_duplicate_sql = "SELECT * FROM user WHERE user_id = '$signup_id'";
$check_duplicate_result = mysqli_query($conn, $check_duplicate_sql);
if (mysqli_num_rows($check_duplicate_result) > 0) {
echo '<script>alert("ID is already in use. Please select another ID.");</script>';
echo '<script>history.back();</script>';
} else {
// 아이디 중복이 아니면 회원가입 진행
$sql = "INSERT INTO user VALUES ('$signup_id', '$signup_pass', '$signup_nickname')";
if ($signup_id == "" || $signup_nickname == "" || $signup_pass == "") {
echo '<script>alert("There is an empty item.");</script>';
echo '<script>history.back();</script>';
} else {
mysqli_query($conn, $sql);
$insert_email_sql = "INSERT INTO user_email (e_user_id, email) VALUES ('$signup_id', '$signup_email')";
mysqli_query($conn, $insert_email_sql);
echo '<script>alert("Membership registration has been completed.");</script>';
echo "<script>location.replace('login.php');</script>";
}
}
?>