-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomponent_sheet_debug.php
More file actions
56 lines (50 loc) · 1.86 KB
/
component_sheet_debug.php
File metadata and controls
56 lines (50 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
session_start();
// Vérification simple de session
if (!isset($_SESSION['user_id'])) {
header('Location: login.php');
exit();
}
// Connexion directe à la base de données
try {
$pdo = new PDO('mysql:host=localhost;dbname=composants_db;charset=utf8', 'root', '');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
die('Erreur de connexion : ' . $e->getMessage());
}
// Récupération de l'ID
$id = $_GET['id'] ?? null;
if (!$id) {
die('ID manquant');
}
// Récupération du composant
try {
$stmt = $pdo->prepare('SELECT * FROM components WHERE id = ?');
$stmt->execute([$id]);
$component = $stmt->fetch(PDO::FETCH_ASSOC);
if (!$component) {
die('Composant non trouvé');
}
} catch (PDOException $e) {
die('Erreur de requête : ' . $e->getMessage());
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Debug Fiche - <?php echo htmlspecialchars($component['name']); ?></title>
<meta charset="UTF-8">
</head>
<body>
<h1>Debug Fiche Produit</h1>
<p><strong>ID:</strong> <?php echo htmlspecialchars($component['id']); ?></p>
<p><strong>Nom:</strong> <?php echo htmlspecialchars($component['name']); ?></p>
<p><strong>Catégorie:</strong> <?php echo htmlspecialchars($component['category']); ?></p>
<p><strong>Quantité:</strong> <?php echo htmlspecialchars($component['quantity']); ?></p>
<p><strong>Prix:</strong> <?php echo htmlspecialchars($component['price']); ?> €</p>
<p><a href="components.php">Retour</a></p>
<footer style="margin-top: 2rem; padding: 1rem; text-align: center; border-top: 1px solid #ddd; background-color: #f8f9fa; color: #666; font-size: 0.9em;">
Créé par Jérémy Leroy - Version 1.0 - Copyright © 2025 - Tous droits réservés selon les termes de la licence Creative Commons CC BY-NC-SA 3.0
</footer>
</body>
</html>