33 lines
649 B
PHP
33 lines
649 B
PHP
<?php
|
|
|
|
session_start();
|
|
|
|
$id = isset($_POST['id']) ? $_POST['id'] : '';
|
|
$pw = isset($_POST['pw']) ? $_POST['pw'] : '';
|
|
|
|
if ($id == '') {
|
|
die(json_encode(['result' => 'empty_id']));
|
|
}
|
|
|
|
if ($pw == '') {
|
|
die(json_encode(['result' => 'empty_pw']));
|
|
}
|
|
|
|
include '../config/dbconfig.php';
|
|
include '../config/member.php';
|
|
|
|
$mem = new Member($db);
|
|
|
|
if ($mem->login($id, $pw)) {
|
|
session_start();
|
|
$_SESSION['ses_id'] = $id;
|
|
$arr = ['result' => 'login_success'];
|
|
} else {
|
|
$arr = ['result' => 'login_fail'];
|
|
}
|
|
|
|
// ★★★ 반드시 필요 ★★★
|
|
header("Content-Type: application/json; charset=utf-8");
|
|
echo json_encode($arr);
|
|
exit;
|