-
Notifications
You must be signed in to change notification settings - Fork 0
/
login_result.php
47 lines (40 loc) · 1.06 KB
/
login_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
<?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' ];
$q = "SELECT * FROM account WHERE id = '$username'";
$result = mysqli_query($conn, $q);
$row = mysqli_fetch_array($result);
if ($row !=null and $password == $row['password']) {
$_SESSION[ 'username' ] = $username;
Header("Location:index.php");
} else {
$code = 1;
include 'alert.php';
}
mysqli_close($conn);
?>
</body>
</html>