-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhistoire_ajout.php
61 lines (53 loc) · 2.92 KB
/
histoire_ajout.php
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
57
58
59
60
61
<?php include("entete.php") ?>
<?php
if (isset($_SESSION["doublon_histoire"])){
if ($_SESSION["doublon_histoire"]) { ?>
<div class="alert alert-danger text-center"><span style="font-weight: bold">Erreur ! </span>L'histoire existe déjà ou le titre correspond à une histoire déjà existante.</div><br>
<?php
$_SESSION["doublon_histoire"] = false;
}
}
if($_SESSION["connected"]){
?>
<!-- Si il n'est pas connecté, il ne peut accéder a cette page-->
<div class="text-center"><h2>Ajout d'une histoire :</h2></div>
<br>
<div class="container mx-auto" id="containerConnexion" style="width:30%;">
<fieldset class="border border-light border-2 rounded" style="font-weight: bold;">
<form role="form" class="px-4 py-3" method="POST" enctype="multipart/form-data" action="scripts/script_ajoutHistoire.php">
<div class="mb-3">
<label for="FormTitre" class="form-label">Titre</label>
<input type="text" name="titre" class="form-control" id="FormTitre" placeholder="Titre" required>
</div>
<div class="mb-3 form-group">
<label for="choixCategories" class="form-label">Catégorie de l'histoire</label>
<select name="categorie" id="choixCategories" class="form-select text-dark" style="color: black !important;">
<option value="horreur">Horreur</option>
<option value="romantique">Romantique</option>
<option value="action">Action</option>
</select>
</div>
<div class="mb-3">
<label for="TextAuteur" class="form-label">Auteur</label>
<input type="text" name="auteur" class="form-control" id="TextAuteur" placeholder="Auteur" value="<?=$_SESSION["nomUtilisateur"]?>">
</div>
<div class="mb-3">
<label for="TextAnnee" class="form-label">Année de parution</label>
<input type="number" name="annee" class="form-control" id="TextAnnee" placeholder="Annee" value="<?php $year = date("Y"); echo $year?>" required>
</div>
<div class="mb-3">
<label for="TextDescription" class="form-label">Description</label>
<textarea type="text" name="description" class="form-control" id="TextDescription" required></textarea>
</div>
<div class="mb-3 ">
<label for="TextImage" class="form-label custom-file-label">Image <small>(facultative)</small></label>
<input type="file" name="fileToUpload" class="form-control custom-file-input" id="TextImage">
</div>
<div class="dropdown-divider bg-light mb-3"></div>
<button type="submit" style="font-weight: bold;" class="btn text-black button" aria-describedby="poursuivre">Ajout de l'histoire</button><br>
</form>
</fieldset>
</div>
<?php
} ?>
<?php include("footer.php")?>