connect_error) { die("Connection failed: " . $conn->connect_error); } // SQL 쿼리 실행 $sql = "SELECT * FROM users WHERE username='$username' AND password='$password'"; $result = $conn->query($sql); if ($result->num_rows > 0) { // 로그인 성공 $_SESSION['username'] = $username; header('Location: dashboard.php'); } else { // 로그인 실패 echo "Invalid username or password"; } $conn->close(); ?>