ÀÎÁõ Åë°ú 800 -> ÀÎÁõŰ ¾øÀÌ È£ÃâµÊ 801 -> ÀÎÁõŰ Á¸ÀçÇÏÁö ¾ÊÀ½ 802 -> ÀÎÁõ±â°£ ¸¸·á */ if($_GET['key'] == "" || $_GET['key'] == null) { header("HTTP/1.1 800 Empty Key"); exit; } $result = GetKeyInfo($_GET['key']); if($result == null) { header("HTTP/1.1 801 No Key"); exit; } else { if(date("Y-m-d H:i:s") < date($result['expiration_at'])) { header("HTTP/1.1 200 OK"); exit; } else { header("HTTP/1.1 802 Authentication expired"); exit; } } function ConnectDB() { $user = 'dbnt0928'; $password = 'dbnt060928!'; $host = 'localhost'; $schema = 'dbnt0928'; $conn = new mysqli($host, $user, $password, $schema); if ($conn->connect_error) { die($conn->connect_error); } return $conn; } function DisconnsctDB($conn) { mysqli_close($conn); } function GetKeyInfo($key) { $conn = ConnectDB(); $query = "select * from authkey where name='$key'"; $result = mysqli_query($conn, $query); if (mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { return array( "name" => $row["name"], "company" => $row["company"], "descripyion" => $row["descripyion"], "created_at" => $row["created_at"], "expiration_at" => $row["expiration_at"]); } } else { return null; } } ?>