diff --git a/_partials/_footer.php b/_partials/_footer.php index 58a4f5a..cfa4fca 100644 --- a/_partials/_footer.php +++ b/_partials/_footer.php @@ -1,4 +1,4 @@ - + diff --git a/_partials/_head.php b/_partials/_head.php index 627a7bb..3482053 100644 --- a/_partials/_head.php +++ b/_partials/_head.php @@ -1,5 +1,5 @@ @@ -8,6 +8,6 @@ header("Content-Security-Policy: default-src 'self'; connect-src 'self'; script- $page = str_replace(".php","",basename($_SERVER['SCRIPT_FILENAME'])); ?> <?=$titre_page?> - - + + \ No newline at end of file diff --git a/api.php b/api.php index db9fe59..afb8de6 100644 --- a/api.php +++ b/api.php @@ -11,10 +11,11 @@ */ - //include("session_verif.php"); + include("session_verif.php"); include("bdd.php"); include('php-csrf.php'); + $csrf = new CSRF(); @@ -186,7 +187,7 @@ if(!$csrf->validate($context='televersement',$_POST["jeton-csrf"])){ - echo( json_encode(["status"=> "2","msg"=>"jeton csrf manquant.".$_POST["jeton-csrf"]]) ); + echo( json_encode(["status"=> "2","msg"=>"jeton csrf manquant ou invalide. ( contenu du champ : ".$_POST["jeton-csrf"]." )"]) ); break; } diff --git a/bdd.php b/bdd.php index 15a1ffc..1473897 100644 --- a/bdd.php +++ b/bdd.php @@ -89,7 +89,7 @@ function saveFilesFromPost($postData,$id_ensemble) { $i = 0; - var_dump($_FILES); + //var_dump($_FILES); foreach ($_FILES as $file) { @@ -118,7 +118,7 @@ function saveFilesFromPost($postData,$id_ensemble) { // Save the file $f = fopen($file['tmp_name'],"r"); - echo fread($f,filesize($file['tmp_name'])); + //echo fread($f,filesize($file['tmp_name'])); fclose($f); diff --git a/css/ens.css b/css/ens.css new file mode 100644 index 0000000..e69de29 diff --git a/css/index.css b/css/index.css new file mode 100644 index 0000000..6b557ba --- /dev/null +++ b/css/index.css @@ -0,0 +1,120 @@ +@media (hover: none) { + /* For mobile phones: */ + .floating-action-btn{ + position: fixed; + bottom: 30vh; + margin-left:5%; + padding: 10px; + padding-top: 0px; + width: fit-content; + text-align: left; + border-radius: 5px; + border-width: 2px; + font-weight:bolder; + text-decoration: none; + color: black; + border-bottom: 3px solid rgba(224, 54, 54, 0.482); + + } + +} +@media only screen and (min-width: 1000px) { + /* For desktop: */ + .floating-action-btn{ + position: fixed; + bottom: 5%; + margin-left:1%; + padding: 10px; + padding-top: 0px; + width: fit-content; + text-align: left; + border-radius: 5px; + border-width: 2px; + font-weight:bolder; + text-decoration: none; + color: black; + border-bottom: 3px solid rgba(224, 54, 54, 0.482); + + } +} + +.gros-titre{ + font-size: larger; + font-weight: bolder; +} + +.centre-vertical{ + margin-top: auto; + margin-bottom: auto; +} + + +.centre-horizontal{ + margin: auto; + justify-content: center; +} + +.centre-txt{ + text-align: center; +} + +.etaler{ + width: 100%; +} + +.bulle-rouge{ + width: fit-content; + padding-top: 5px; + padding-left: 5px; + padding-right: 5px; + padding-bottom: 5px; + background-color: rgba(255, 0, 0, 0.283); + border-radius: 5px; + border-width: 2px; + border-color: rgba(255, 0, 0, 0.283); +} + +.button{ + margin-top: 10px; + width: fit-content; + padding-top: 1%; + padding-left: 1%; + padding-right: 1%; + padding-bottom: 1%; + border-radius: 5px; + font-weight:bolder; + text-decoration: none; + color: black; + border-bottom: 3px solid rgba(224, 54, 54, 0.482); + border-top: 0px; + border-left: 0px; + border-right: 0px; +} + +.color-red-tr{ + background-color: rgba(224, 54, 54, 0.482); + border-color: rgba(224, 54, 54, 0.482); +} + +.barre-recherche{ + margin-top: 10px; + width: 80vw; + max-width: 800px; + border-radius: 15px; + border-width: 5px; + border-bottom: 3px solid rgba(224, 54, 54, 0.482); + background-color: rgba(224, 54, 54, 0.482); + padding: 20px; +} + +.champ{ + border-radius: 3px; + border: 0px; + background-color: transparent; + font-size: larger; + width: fit-content; +} + +.champ:focus{ + outline: none; +} \ No newline at end of file diff --git a/css/televerser.css b/css/televerser.css new file mode 100644 index 0000000..f87d48b --- /dev/null +++ b/css/televerser.css @@ -0,0 +1,138 @@ +@media (hover: none) { + /* For mobile phones: */ + .floating-action-btn{ + /*position: fixed; + bottom: 30vh; + margin-left:5%; + padding: 10px; + padding-top: 0px; + width: fit-content; + text-align: left; + border-radius: 5px; + border-width: 2px; + font-weight:bolder; + text-decoration: none; + color: black; + border-bottom: 3px solid rgba(224, 54, 54, 0.482); + border-top: 0px; + border-left: 0px; + border-right: 0px;*/ + visibility: hidden; + + } + +} +@media only screen and (min-width: 1000px) { + /* For desktop: */ + .floating-action-btn{ + position: fixed; + bottom: 5%; + margin-left:1%; + padding: 10px; + padding-top: 0px; + width: fit-content; + text-align: left; + border-radius: 5px; + border-width: 2px; + font-weight:bolder; + text-decoration: none; + color: black; + border-bottom: 3px solid rgba(224, 54, 54, 0.482); + border-top: 0px; + border-left: 0px; + border-right: 0px; + + } +} + +.gros-titre{ + font-size: larger; + font-weight: bolder; +} + +.centre-vertical{ + margin-top: auto; + margin-bottom: auto; +} + + +.centre-horizontal{ + margin: auto; + justify-content: center; +} + +.centre-txt{ + text-align: center; +} + +.etaler{ + width: 100%; +} + +.bulle-rouge{ + width: fit-content; + padding-top: 5px; + padding-left: 5px; + padding-right: 5px; + padding-bottom: 5px; + background-color: rgba(255, 0, 0, 0.283); + border-radius: 5px; + border-width: 2px; + border-color: rgba(255, 0, 0, 0.283); +} + +.button{ + margin-top: 10px; + width: fit-content; + padding-top: 1%; + padding-left: 1%; + padding-right: 1%; + padding-bottom: 1%; + border-radius: 5px; + font-weight:bolder; + text-decoration: none; + color: black; + border-bottom: 3px solid rgba(224, 54, 54, 0.482); + border-top: 0px; + border-left: 0px; + border-right: 0px; +} + +.color-red-tr{ + background-color: rgba(224, 54, 54, 0.482); + border-color: rgba(224, 54, 54, 0.482); +} + +.color-green-tr{ + background-color: rgba(71, 224, 54, 0.482); + border-color: rgba(71, 224, 54, 0.482); +} + +.barre-recherche{ + margin-top: 10px; + width: 80vw; + max-width: 800px; + border-radius: 15px; + border-width: 5px; + border-bottom: 3px solid rgba(224, 54, 54, 0.482); + background-color: rgba(224, 54, 54, 0.482); + padding: 20px; +} +.champ{ + font-size: larger; + margin-top: 1vw; +} + +.formulaire{ + margin-top: 5vw; + width: 50vw; + margin-left: 25vw; + margin-right: 25vw; +} + +.input-details-exo{ + z-index: 1000; + position: relative; + font-size: larger; + margin-top: 1vw; +} \ No newline at end of file diff --git a/index.php b/index.php index a34dd2b..72dd386 100644 --- a/index.php +++ b/index.php @@ -11,20 +11,40 @@ session_start(); ?> - - + +
+
+   __    ____   ___  _   _ /'/ ____  _  _  ___    __   
+  /__\  (  _ \ / __)( )_( )   (_  _)( \( )/ __)  /__\  
+ /(__)\  )   /( (__  ) _ (     _)(_  )  ( \__ \ /(__)\ 
+(__)(__)(_)\_) \___)(_) (_)   (____)(_)\_)(___/(__)(__)
+    
+ +
+ + + +
-
- - - -
+
+
+ + + +
+
- Téléverser des documents + + +
    _   
+  _| |_ 
+ |_   _| Téléverser des documents
+   |_|   
+
diff --git a/js/index.js b/js/index.js index c97dc49..f486247 100644 --- a/js/index.js +++ b/js/index.js @@ -26,13 +26,13 @@ async function unauthenticate_user(){ async function rechercher(){ - var req = document.getElementById("recherche_input").value; + var req = document.body.getElementById("recherche_input").value; var themes = []; - Array.from(document.getElementsByClassName("theme")).forEach(function (el) { + Array.from(document.body.getElementsByClassName("theme")).forEach(function (el) { // on encode en url pour pouvoir le passer dans la requete GET themes.push(encodeURIComponent(el.innerText)); }); - var duree =document.getElementById("duree_input").value + var duree =document.body.getElementById("duree_input").value var url = "api.php/rechercher?req="+req; @@ -51,7 +51,7 @@ async function rechercher(){ data = await resp.json(); // vide d'abord les éléments présents dans la liste sur la page - document.getElementById("liste_resultats").innerHTML = ""; + document.body.getElementById("liste_resultats").innerHTML = ""; if(data.status == 1){ data.resultats.forEach(doc => { diff --git a/js/televerser.js b/js/televerser.js index ebb535a..51a1780 100644 --- a/js/televerser.js +++ b/js/televerser.js @@ -43,6 +43,7 @@ function televerser_fichiers() { //csrf token formData.append("jeton-csrf",jeton_csrf); + //alert(jeton_csrf); // Append captured images as files to the FormData const capturedImages = document.querySelectorAll('#selectedImages img'); @@ -61,10 +62,13 @@ function televerser_fichiers() { method: 'POST', body: formData }) - .then(response => response.text()) + .then(response => response.json()) .then(data => { - console.log(data); - // Handle the response from the server + if(data.status == 1){ + alert("le document a bien été envoyé ! Merci de votre participation :D") + }else{ + alert("Une erreur s'est produite lors de l'envoi de votre fichier : "+data.msg); + } }) .catch(error => { console.error('Error:', error); @@ -215,6 +219,7 @@ function init_date(){ document.getElementById("date_conception_input").setAttribute("value",today); } + document.addEventListener("DOMContentLoaded", (event) => { init_date(); document.getElementById("select_type").addEventListener("change", (event) => { diff --git a/session_verif.php b/session_verif.php index ef3b670..e96395a 100644 --- a/session_verif.php +++ b/session_verif.php @@ -1,6 +1,6 @@ 1,"msg"=>"Bonjour ".phpCAS::getUser()." !"]); + //return json_encode(["status"=>1,"msg"=>"Bonjour ".phpCAS::getUser()." !"]); + return json_encode(["status"=>1,"msg"=>"Bonjour !"]); + } diff --git a/televerser.php b/televerser.php index 560e690..c2fed88 100644 --- a/televerser.php +++ b/televerser.php @@ -6,46 +6,64 @@ ?> - -
- -
- - -
- - - -
-
- -
- - -
- - - -
- -
- -
- +
+
+   __    ____   ___  _   _ /'/ ____  _  _  ___    __   
+  /__\  (  _ \ / __)( )_( )   (_  _)( \( )/ __)  /__\  
+ /(__)\  )   /( (__  ) _ (     _)(_  )  ( \__ \ /(__)\ 
+(__)(__)(_)\_) \___)(_) (_)   (____)(_)\_)(___/(__)(__)
+    
- + +
+
+ +
+ + +
+ + + +
+
+ +
+ + +
+ + + +
+ +
+ +
+ + +
+ +
+ +