-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a62a77c
commit 3423eb4
Showing
25 changed files
with
1,673 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
* { | ||
box-sizing: border-box; | ||
margin: 0; | ||
font-family: 'Roboto Slab', serif; | ||
} | ||
|
||
body { | ||
height: 100vh; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
background-image: url(./background.jpg); | ||
} | ||
|
||
|
||
.card { | ||
height: 600px; | ||
width: 340px; | ||
background-color: rgba(55, 26, 27, 0.9); | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: space-between; | ||
padding: 32px; | ||
border-radius: 15px; | ||
box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px; | ||
} | ||
|
||
.title{ | ||
font-weight: 800; | ||
font-size: 1.5rem; | ||
color: #fff; | ||
} | ||
|
||
form { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
flex-direction: column; | ||
gap: 16px | ||
} | ||
|
||
input { | ||
width: 100%; | ||
height: 24px; | ||
border-radius: 5px; | ||
border: solid black 1px; | ||
background-color: #8a9361; | ||
color: black; | ||
|
||
} | ||
|
||
::placeholder{ | ||
color:darkslategray; | ||
} | ||
|
||
button { | ||
width: 200px; | ||
height: 35px; | ||
border-radius: 5px; | ||
border: none; | ||
background-color: rgba(138, 147, 97, 0.9); | ||
font-weight: 900; | ||
font-size: 1.1rem; | ||
color: black; | ||
} | ||
|
||
button:hover{ | ||
background-color: rgba(138, 147, 97, 1); | ||
cursor: pointer; | ||
} | ||
|
||
.spaceButton { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 8px; | ||
} | ||
|
||
.joconde { | ||
object-fit: contain; | ||
max-width: 70%; | ||
border-radius: 5px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
<?php session_start(); | ||
|
||
if (!isset($_SESSION["loggedUser"])) { | ||
header("Location: index.php"); | ||
} | ||
|
||
|
||
$dateEmprunt = date('Y-m-d H:i:s'); | ||
|
||
try { | ||
$mysqlClient = new PDO('mysql:host=localhost;dbname=oeuvredart;charset=utf8', 'root', ''); | ||
} catch (Exception $e) { | ||
die('Erreur : ' . $e->getMessage()); | ||
} | ||
|
||
$query5 = "SELECT * FROM Emprunt WHERE `utilisateurId` = :idUser AND `dateRetour` IS NULL;"; | ||
$pdoStat = $mysqlClient->prepare($query5); | ||
$executeIsOk = $pdoStat->execute([ | ||
'idUser' => $_SESSION['idUser'] | ||
]) or die(print_r($mysqlClient->errorInfo())); | ||
$alert = $pdoStat->fetchAll(); | ||
|
||
|
||
if (isset($_POST["emprunt"])) { | ||
if (count($alert) >= 3) { | ||
header("location: alert.php"); | ||
} else { | ||
$query2 = "UPDATE oeuvre SET disponible = 0 WHERE idOeuvre = :idOeuvre"; | ||
$pdoStat = $mysqlClient->prepare($query2); | ||
$executeIsOk = $pdoStat->execute([ | ||
'idOeuvre' => $_POST["emprunt"] | ||
]) or die(print_r($mysqlClient->errorInfo())); | ||
|
||
$query3 = 'INSERT INTO emprunt(utilisateurId, oeuvreId, dateEmprunt) values ( :utilisateurId, :oeuvreId, :dateEmprunt)'; | ||
$pdoStat = $mysqlClient->prepare($query3); | ||
$executeIsOk = $pdoStat->execute([ | ||
'utilisateurId' => $_SESSION["idUser"], | ||
'oeuvreId' => $_POST["emprunt"], | ||
'dateEmprunt' => $dateEmprunt | ||
]) or die(print_r($mysqlClient->errorInfo())); | ||
header("Location: empruntConfirmation.php?idOeuvre=" . $_POST["emprunt"]); | ||
exit(); | ||
} | ||
} | ||
|
||
if (isset($_POST["oeuvreDelete"])) { | ||
$query5 = "DELETE FROM emprunt WHERE oeuvreId = :idOeuvre;"; | ||
$pdoStat = $mysqlClient->prepare($query5); | ||
$executeIsOk = $pdoStat->execute([ | ||
'idOeuvre' => $_POST["oeuvreDelete"] | ||
]) or die(print_r($mysqlClient->errorInfo())); | ||
|
||
$query6 = "DELETE FROM oeuvre WHERE idOeuvre = :idOeuvre"; | ||
$pdoStat2 = $mysqlClient->prepare($query6); | ||
$executeIsOk2 = $pdoStat2->execute([ | ||
"idOeuvre" => $_POST["oeuvreDelete"] | ||
]) or die(print_r($mysqlClient->errorInfo())); | ||
} | ||
|
||
?> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Accueil</title> | ||
<link rel="stylesheet" href="accueilStyle.css" type="text/css"/> | ||
<link rel="preconnect" href="https://fonts.googleapis.com"> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
<link href="https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@300;400;500;600;700;800;900&display=swap" | ||
rel="stylesheet"> | ||
<link rel="icon" type="image/png" href="./artRental.png"/> | ||
</head> | ||
|
||
<body> | ||
<nav> | ||
<div class="user"><?php echo "Bonjour " . $_SESSION["prenom"] ?></div> | ||
<?php if ($_SESSION["idUser"] == 1) { | ||
echo "<a href='ajout.php' class='admin'>Page admin</a>"; | ||
} | ||
?> | ||
<a href="emprunt.php" class="panier">VOS EMPRUNTS</a> | ||
<form method="post" action="deconnexion.php"> | ||
<button class="deconnexion" type="submit">DECONNEXION</button> | ||
</form> | ||
</div> | ||
</nav> | ||
|
||
<div class="grid"> | ||
|
||
<?php | ||
|
||
$sqlQuery = 'SELECT * | ||
FROM oeuvre | ||
INNER JOIN technique | ||
ON techniqueId = idTechnique | ||
INNER JOIN artiste | ||
ON artisteId = idArtiste;'; | ||
$oeuvresStatement = $mysqlClient->prepare($sqlQuery); | ||
$oeuvresStatement->execute(); | ||
$oeuvres = $oeuvresStatement->fetchAll(); | ||
|
||
foreach ($oeuvres as $oeuvre) { | ||
?> | ||
<div class="oeuvre"> | ||
<p class="titre"><?php echo $oeuvre['titre']; ?></p> | ||
<p><?php echo $oeuvre['nomArtiste']; ?></p> | ||
<p> <?php echo $oeuvre['prenomArtiste']; ?></p> | ||
<p><?php echo $oeuvre['anneeCreation']; ?></p> | ||
<p><?php echo $oeuvre['nomTechnique']; ?></p> | ||
<?php if ($oeuvre['disponible'] == 1) { ?> | ||
<form method="post" action=""> | ||
<input type="hidden" name="emprunt" id="emprunt" value="<?php echo $oeuvre['idOeuvre'] ?>"> | ||
<button>EMPRUNTER</button> | ||
</form> | ||
<?php } else { ?> | ||
<p style="color: red">INDISPONIBLE</p> | ||
<?php } ?> | ||
<?php if ($_SESSION["idUser"] == 1 && $oeuvre['disponible'] == 1) { ?> | ||
<form method="post" action=""> | ||
<input type="hidden" name="oeuvreDelete" id="oeuvreDelete" | ||
value="<?php echo $oeuvre['idOeuvre'] ?>"> | ||
<button class="delete">X</button> | ||
</form> | ||
<?php } ?> | ||
</div> | ||
|
||
<?php | ||
} | ||
?> | ||
|
||
</div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
* { | ||
font-family: 'Roboto Slab', serif; | ||
box-sizing: border-box; | ||
margin: 0; | ||
|
||
} | ||
|
||
body { | ||
margin: 0; | ||
background-image: url(./background.jpg); | ||
} | ||
|
||
nav { | ||
height: 150px; | ||
width: 100%; | ||
background-color: rgba(55, 26, 27, 0.9); | ||
display: flex; | ||
align-items: center; | ||
margin-bottom: 20px; | ||
justify-content: space-around; | ||
gap: 15px; | ||
} | ||
|
||
.logo { | ||
object-fit: contain; | ||
height: 120px; | ||
margin-left: 40px; | ||
} | ||
|
||
.user { | ||
font-size: 1.5rem; | ||
font-weight: 500; | ||
color: #fff; | ||
} | ||
|
||
.panier { | ||
font-size: 1.5rem; | ||
color: rgba(138, 147, 97, 0.9); | ||
text-decoration: underline; | ||
} | ||
.panier:hover { | ||
color: rgba(138, 147, 97, 1); | ||
cursor: pointer; | ||
} | ||
|
||
.admin { | ||
font-size: 1.5rem; | ||
color: red; | ||
text-decoration: underline; | ||
} | ||
|
||
.grid { | ||
display: flex; | ||
gap: 15px; | ||
flex-wrap: wrap; | ||
justify-content: center; | ||
} | ||
|
||
.oeuvre { | ||
height: 300px; | ||
width: 300px; | ||
background-color: rgba(55, 26, 27, 0.9); | ||
border-radius: 15px; | ||
box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-around; | ||
align-items: center; | ||
text-align: center; | ||
position: relative; | ||
|
||
} | ||
|
||
.titre{ | ||
font-size: 2rem; | ||
font-weight: 600; | ||
color: #ADD8E6; | ||
} | ||
|
||
button { | ||
width: 200px; | ||
height: 35px; | ||
border-radius: 5px; | ||
border: none; | ||
background-color: rgba(138, 147, 97, 0.9); | ||
font-weight: 900; | ||
font-size: 1.1rem; | ||
color: black; | ||
} | ||
|
||
button:hover { | ||
background-color: rgba(138, 147, 97, 1); | ||
cursor: pointer; | ||
} | ||
|
||
.delete{ | ||
width: 40px; | ||
height: 40px; | ||
background-color: red; | ||
color: black; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
position: absolute; | ||
right: -15px; | ||
top: -15px; | ||
opacity: 0.75; | ||
} | ||
.delete:hover{ | ||
background-color: red; | ||
opacity: 1; | ||
} | ||
|
||
p { | ||
font-size: 1.4rem; | ||
font-weight: 500; | ||
color: #fff; | ||
} | ||
|
||
@media screen and (max-width: 613px) { | ||
nav { | ||
height: 200px; | ||
flex-direction: column; | ||
} | ||
} |
Oops, something went wrong.