-
Notifications
You must be signed in to change notification settings - Fork 0
/
join_result.php
53 lines (43 loc) · 1.15 KB
/
join_result.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
<?php
include 'inc_head.php';
?>
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<title>PHP</title>
</head>
<body>
<?php
// $host = "sql101.infinityfree.com";
// $user = "if0_34463025";
// $pw = "fdBe0YiPtB0";
// $dbName = "if0_34463025_spongenglish";
$host = "127.0.0.1";
$user = "root";
$pw = "password";
$dbName = "spengo";
$conn = new mysqli($host, $user, $pw, $dbName);
/* DB 연결 확인 */
if($conn){
}
else{ die( 'Could not connect: ' . mysqli_error($conn) ); }
$username = $_POST[ 'username' ];
$password = $_POST[ 'password' ];
$email = $_POST[ 'email' ];
$q = "SELECT * FROM account WHERE id = '$username'";
$result = mysqli_query($conn, $q);
$row = mysqli_fetch_array($result);
if ($row !=null) {
$code = 0;
include 'alert.php';
} else {
$q = "INSERT INTO account VALUES(NULL,'$username','$password','$email',0)";
mysqli_query($conn, $q);
$code = 2;
include 'alert.php';
}
mysqli_close($conn);
?>
</body>
</html>