Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
AmandineFORTIER committed Sep 2, 2020
1 parent e24a247 commit 1f1c9ec
Show file tree
Hide file tree
Showing 26 changed files with 480 additions and 2 deletions.
Binary file added articles/1594732911.pdf
Binary file not shown.
Binary file added articles/1594736929.pdf
Binary file not shown.
Binary file added articles/1594739951.pdf
Binary file not shown.
Binary file added articles/1594740661.pdf
Binary file not shown.
Binary file added articles/1594741288.pdf
Binary file not shown.
Binary file added articles/1594741344.pdf
Binary file not shown.
Binary file added articles/1594741472.pdf
Binary file not shown.
15 changes: 14 additions & 1 deletion assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -2089,6 +2089,7 @@
padding: 0 1rem;
text-decoration: none;
width: 100%;
resize: none;
}

input[type="text"]:invalid,
Expand Down Expand Up @@ -4023,4 +4024,16 @@
padding: 3rem 0 1rem 0 ;
}

}
}

#titleForm {
font-size: 2rem;
}

#form {
border-radius: 1em;
border-width: 2mm;
background-color: rgb(214, 214, 214);
padding: 1em;
padding-bottom: 0.2em;
}
277 changes: 277 additions & 0 deletions datas.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@
<!DOCTYPE HTML>
<!--
Hielo by TEMPLATED
templated.co @templatedco
Released for free under the Creative Commons Attribution 3.0 license (templated.co/license)
-->
<?php
$servername = "127.0.0.1";
$username = "root";
$password = "amandine";
$dbname = "articles";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>

<html>
<head>
<title>Blog Amanidne</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="assets/css/main.css" />
</head>
<body>

<!-- Header -->
<header id="header" class="alt">
<!-- Nav -->
<div id="menu">
<nav id = "sidebar">
<ul id="links">
<li><a href="index.php">Acceuil</a></li>
<li><a href="#">Sujets</a></li>
<li><a href="#">Recherche approfondie</a></li>
<li><a href="#" class="active">Gestion des données</a></li>
<li><a href="elements.html">Elements</a></li>
</ul>
</nav>
</div>
</header>

<!-- Banner -->
<section class="banner full">
<article>
<img src="images/bg.jpg" alt="" />
<div class="inner">
<header>
<p>A free responsive web site template by <a href="https://templated.co">TEMPLATED</a></p>
<h2>Hielo</h2>
</header>
</div>
</article>
</section>
<!-- One -->
<section id="one" class="wrapper style2">
<div class="inner">
<div class="grid-style">
<div>
<div id="form">
<h1 id="titleForm">Création d'un libellé</h1>
<form id = "subform" name = "subform" method="post">
<div><label for="libName">Libelle</label>
<input type="text" placeholder="Libelle" id="libName" name="libName" required></div>
</br>
<div><label for="category">Catgeory</label>
<input type="text" placeholder="Category" id="category" name="category" required></div>
</br>
<input type="submit" value="Creer"/>
</form>
</div>
<?php //Create libelle
if(isset($_POST['libName']) && trim($_POST['libName']) != '')
{
if(isset($_POST['category']) && trim($_POST['category']) != '')
{
$stmt = $conn->prepare("INSERT INTO Libelle (label, category) VALUES (?, ?)");
$stmt->bind_param("ss", $label, $catego);

$label = $_POST['libName'];
$catego = $_POST['category'];
$stmt->execute();

$stmt->close();
}
}
?>
</br>
</br>
<div class="inner" id="form">
<header>
<h1 id="titleForm">Création d'un article</h1>
<form enctype="multipart/form-data" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
<div>
<label for="titre">Titre: </label>
<input type="text" name="titre" required><br>
</div><div>
<label for="description">Description: </label>
<input type="text" name="description" id="description" required><br>
</div><div>
<label for="image">Chemin de l'image : </label>
<input type="file" name="image"><br>
</div><br><div>
<label for="content">Article: </label>
<input type="file" name="content" required><br>
</div><br><div>
<label for="libelle">Libellés: </label>
<select size=1 name="labels">
<?php //Liste déroulante
$sql = "SELECT label from Libelle";
$rst = $conn->query($sql);

if (!$rst)
{
echo "Lecture impossible";
}
else
{
while($row = $rst->fetch_assoc())
{
$lib=$row["label"];
echo "<option value= '$lib'> $lib</option><br>";
}
}
?>
</select>
</div><br><div>
<label for="author">Autheur: </label>
<input type="text" name="author" required><br>
</div>
</br><input type="submit"/>
</form>
<?php
//Image upload
if(isset($_FILES['image']) && trim($_FILES['image']['name']) != '')
{
$uploadFolder = 'images/upload/';
$fileName = basename($_FILES['image']['name']);
$maxSize = 2000000;
$size = filesize($_FILES['image']['tmp_name']);
$extensions = array('.png', '.gif', '.jpg', '.jpeg', '.JPG', '.JPEG');
$extension = strrchr($_FILES['image']['name'], '.');
//Début des vérifications de sécurité...
if(!in_array($extension, $extensions)) //Si l'extension n'est pas dans le tableau
{
$erreur = 'Vous devez uploader un fichier de type png, gif, jpg, jpeg, txt ou doc...';
}
if($size>$maxSize)
{
$erreur = 'Le fichier est trop gros...';
}
if(!isset($erreur)) //S'il n'y a pas d'erreur, on upload
{
//On formate le nom du fichier ici...
$fileName = strtr($fileName,
'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ',
'AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy');
$fileName = preg_replace('/([^.a-z0-9]+)/i', '-', $fileName);

$temp = explode(".", $fileName);
$fileName = round(microtime(true)) . '.' . end($temp);

if(move_uploaded_file($_FILES['image']['tmp_name'], $uploadFolder . $fileName)) //Si la fonction renvoie TRUE, c'est que ça a fonctionné...
{
echo 'Upload de l\'image effectué avec succès !';
}
else //Sinon (la fonction renvoie FALSE).
{
echo 'Echec de l\'upload de \'image !';
}
}
else
{
echo $erreur;
}

//UPLOAD ARTICLE PDF
if(isset($_FILES['content']) && trim($_FILES['content']['name']) != '')
{
$uploadFolder = 'articles/';
$pdfName = basename($_FILES['content']['name']);
$maxSize = 5000000;
$size = filesize($_FILES['content']['tmp_name']);
$extensions = array('.pdf');
$extension = strrchr($_FILES['content']['name'], '.');
//Début des vérifications de sécurité...
if(!in_array($extension, $extensions)) //Si l'extension n'est pas dans le tableau
{
$erreur = 'Vous devez uploader un fichier de type pdf';
}
if($size>$maxSize)
{
$erreur = 'Le fichier est trop gros...';
}
if(!isset($erreur)) //S'il n'y a pas d'erreur, on upload
{
//On formate le nom du fichier ici...
$pdfName = strtr($pdfName,
'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ',
'AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy');
$pdfName = preg_replace('/([^.a-z0-9]+)/i', '-', $pdfName);

$temp = explode(".", $pdfName);
$pdfName = round(microtime(true)) . '.' . end($temp);

if(move_uploaded_file($_FILES['content']['tmp_name'], $uploadFolder . $pdfName)) //Si la fonction renvoie TRUE, c'est que ça a fonctionné...
{
echo 'Upload du pdf effectué avec succès !';
}
else //Sinon (la fonction renvoie FALSE).
{
echo 'Echec de l\'upload du pdf !';
}
}
else
{
echo $erreur;
}
}
}
// prepare and bind

if(isset($_POST['titre']) && trim($_POST['titre']) != '')
{
$stmt = $conn->prepare("INSERT INTO Article (title, descrip, label, img_path, content, author, date_creation) VALUES (?, ?, ?, ?, ?, ?, ?)");
$stmt->bind_param("sssssss", $title, $descrip, $label, $img_path, $content, $author, $date_creation);

// set parameters and execute
$title = $_POST["titre"];
$descrip = $_POST["description"];
$label = $_POST["labels"];
$img_path = $fileName;
$content = $pdfName;
$author = $_POST["author"];
$date_creation = date('Y-m-d');

$stmt->execute();
$stmt->close();
}
?>
<?php
$conn->close();
?>
</header>
</div>
</div>
</div>
</section>

<!-- Footer -->
<footer id="footer">
<div class="container">
<ul class="icons">
<li><a href="https://www.facebook.com/Amandinee.FORTIER" class="icon fa-facebook"><span class="label">Facebook</span></a></li>
<li><a href="https://www.instagram.com/amandine.fortier/" class="icon fa-instagram"><span class="label">Instagram</span></a></li>
<li><a href="#" class="icon fa-envelope-o"><span class="label">Email</span></a></li>
</ul>
</div>
<div class="copyright">
&copy; Untitled. All rights reserved.
</div>
</footer>

<!-- Scripts -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/jquery.scrollex.min.js"></script>
<script src="assets/js/skel.min.js"></script>
<script src="assets/js/util.js"></script>
<script src="assets/js/main.js"></script>

</body>
</html>
Empty file modified images/bg.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified images/pic01.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified images/pic02.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified images/pic03.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified images/pic04.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified images/slide01.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified images/slide02.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified images/slide03.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified images/slide04.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified images/slide05.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/upload/1594739951.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/upload/1594740661.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/upload/1594741472.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
-->
<html>
<head>
<title>Hielo by TEMPLATED</title>
<title>Blog Amandine</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="assets/css/main.css" />
Expand All @@ -22,6 +22,7 @@
<li><a href="index.html" class="active">Acceuil</a></li>
<li><a href="#">Sujets</a></li>
<li><a href="#">Recherche approfondie</a></li>
<li><a href="datas.php">Gestion des données</a></li>
<li><a href="elements.html">Elements</a></li>
</ul>
</nav>
Expand Down
Loading

0 comments on commit 1f1c9ec

Please sign in to comment.