// ══════════════════════════════════════════════════
// ROLE DETECTION — single source of truth
// If f_user_email is set → franchisee panel
// If user_email is set → customer panel
// Neither → redirect to login
// ══════════════════════════════════════════════════
$is_franchisee = isset($_SESSION['f_user_email']) && !empty($_SESSION['f_user_email']);
$is_user = isset($_SESSION['user_email']) && !empty($_SESSION['user_email']);
if (!$is_franchisee && !$is_user) {
header('Location: login.php');
exit;
}
// Whichever panel this is, load the matching header
require($is_franchisee ? 'f_header.php' : 'header.php');
// ── Correct email to filter digi_card rows ──
// Franchisee → f_user_email column
// User → user_email column
if ($is_franchisee) {
$session_email = mysqli_real_escape_string($connect, $_SESSION['f_user_email']);
$email_column = 'f_user_email'; // column in digi_card that stores franchisee email
$panel_label = 'Franchisee';
} else {
$session_email = mysqli_real_escape_string($connect, $_SESSION['user_email']);
$email_column = 'user_email'; // column in digi_card that stores customer email
$panel_label = 'Customer';
}
?>
ID
Company Name
🔗
Pay Status
Card Status
Date
Share
Edit
Payment
🪪
No cards yet. Create your first digital card!