Added UI and functionality for profiles
This commit is contained in:
18
get_profiles.php
Normal file
18
get_profiles.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
require 'db.php';
|
||||
require 'auth.php';
|
||||
|
||||
header('Content-Type: application/json');
|
||||
require_login();
|
||||
|
||||
$user_id = current_user_id();
|
||||
|
||||
$stmt = $pdo->prepare("SELECT id, name, is_default FROM profiles WHERE user_id = ? ORDER BY is_default DESC, name ASC");
|
||||
$stmt->execute([$user_id]);
|
||||
$profiles = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'active_profile_id' => $_SESSION['active_profile_id'] ?? null,
|
||||
'profiles' => $profiles
|
||||
]);
|
||||
Reference in New Issue
Block a user