<?php
include "db.php";

if (!isset($_GET['mid'])) {
    die("Invalid profile link.");
}

$mid = $_GET['mid'];
$user = $conn->query("SELECT * FROM users WHERE membership_id='$mid' AND is_active=1")->fetch_assoc();

if (!$user) {
    die("Profile not found.");
}
?>
<html>
    <head>
        <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
    </head>
<body>
<div class="container mt-5">
  <div class="card shadow-lg p-4 rounded-4">
    <h2 class="text-success"><?php echo $user['first_name']." ".$user['last_name']; ?> - Public Profile</h2>
    <ul class="list-group list-group-flush">
      <li class="list-group-item"><b>Email:</b> <?php echo $user['email']; ?></li>
      <li class="list-group-item"><b>Qualification:</b> <?php echo $user['highest_qualification']; ?></li>
      <li class="list-group-item"><b>Mobile:</b> <?php echo $user['mobile_number']; ?></li>
      <li class="list-group-item"><b>Address:</b> <?php echo $user['address']; ?></li>
    </ul>
    <?php if($user['resume']){ ?>
      <a href="<?php echo $user['resume']; ?>" class="btn btn-outline-success mt-3" download>Download Resume</a>
    <?php } ?>
  </div>
</div>
<button onclick="window.location.href='dashboard.php'">Back to Dashboard</button>


</body>
</html>