-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup_validation.php
executable file
·79 lines (70 loc) · 2.14 KB
/
signup_validation.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
74
75
76
77
78
79
<?session_start()?>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
<?php
$_SESSION['login'] = 'NO';
$_SESSION['id'] = 'NO';
#$myhost = '31.170.164.40';
$myhost = 'mysql.hostinger.kr';
$myid = 'u729743068_37';
$mypw = '123456';
$con = mysql_connect($myhost, $myid, $mypw);
$db = mysql_select_db("u729743068_37");
mysql_query("SET NAMES utf8"); //한글처리
$id = $_POST['ID'];
$pw = $_POST['PW'];
$pw_check = $_POST['PW_check'];
$usertype = $_POST['usertype'];
$name = $_POST['Name'];
$gender = $_POST['Gender'];
$birth = $_POST['Birth'];
$email = $_POST['Email'];
$phone = $_POST['Phone'];
$query = "select count(*) from Administrator where ID='$id'";
$result = mysql_query($query,$con);
if(!$result){
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
$r1 = mysql_fetch_row($result);
$query = "select count(*) from Submitter where ID='$id'";
$result = mysql_query($query,$con);
if(!$result){
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
$r2 = mysql_fetch_row($result);
$query = "select count(*) from Evaluator where ID='$id'";
$result = mysql_query($query,$con);
if(!$result){
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
$r3 = mysql_fetch_row($result);
$reg_num = $r1[0] + $r2[0] + $r3[0];
//echo "$id $pw $pw_check $usertype $name $gender $birth $email $phone";
if($reg_num>0){
echo "<script>alert('중복된아이디입니다.');history.back();</script>";
}
else{
$query = "insert into $usertype (ID, PW, Name, Gender, Email, Birth, Phone) ";
$query.= "values ('$id','$pw','$name','$gender','$email','$birth','$phone')";
$result = mysql_query($query, $con);
if(!$result){
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
else{
echo "<script>alert('회원가입 성공!');
location.replace('login.php');
</script>";
}
}
?>
</body>
</html>