ptit test parce que le csrf marche pas en prod + commentaires exo
This commit is contained in:
parent
1661636490
commit
57de482cd9
2 changed files with 11 additions and 11 deletions
4
api.php
4
api.php
|
@ -185,10 +185,10 @@
|
||||||
case "aj_doc":
|
case "aj_doc":
|
||||||
|
|
||||||
|
|
||||||
if(!$csrf->validate($context='televersement',$_POST["jeton-csrf"])){
|
/*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.".$_POST["jeton-csrf"]]) );
|
||||||
break;
|
break;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
try{
|
try{
|
||||||
ajouter_doc($_POST);
|
ajouter_doc($_POST);
|
||||||
|
|
|
@ -63,18 +63,16 @@ function uploadFiles() {
|
||||||
|
|
||||||
//let ex = [{duree:"10",themes:["algèbre","analyse"],commentaire_exo:"ceci est un commenataire"},{duree:"15",themes:["elec analogique"],commentaire_exo:""}];
|
//let ex = [{duree:"10",themes:["algèbre","analyse"],commentaire_exo:"ceci est un commenataire"},{duree:"15",themes:["elec analogique"],commentaire_exo:""}];
|
||||||
|
|
||||||
let ex = [];
|
var ex = [];
|
||||||
|
|
||||||
// details des exos pour les annales
|
// details des exos pour les annales
|
||||||
if(formData["type"] == "1"){
|
if(formData.get("type") == "1"){
|
||||||
let details = document.getElementsByClassName("input-details-exo");
|
var details = document.getElementsByClassName("input-details-exo");
|
||||||
|
|
||||||
for(let i=0;i<=details.length;i = i + 3){
|
for(let i=0;i<details.length;i = i + 3){
|
||||||
ex.push({
|
ex.push({
|
||||||
// duree
|
duree:details[i].value,
|
||||||
duree:details[i].getAttribute.value,
|
themes:details[i+1].value.split(","),
|
||||||
themes:details[i+1].getAttribute.value.split(","),
|
commentaire_exo:details[i+2].value
|
||||||
commentaire_exo:details[i+2].getAttribute.value
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,6 +88,8 @@ function uploadFiles() {
|
||||||
i ++;
|
i ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(ex);
|
||||||
|
|
||||||
//csrf token
|
//csrf token
|
||||||
formData.append("jeton-csrf","<?=$csrf->string($context="televersement")?>");
|
formData.append("jeton-csrf","<?=$csrf->string($context="televersement")?>");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue