35 lines
783 B
PHP
35 lines
783 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
include("../Assets/functions.php");
|
||
|
|
|
||
|
|
$config = json_decode(file_get_contents("../Assets/config.json"), true);
|
||
|
|
$bdd = connectBDD("localhost", $config["BDD_USER"], $config["BDD_PASSWD"], $config["BDD_NAME"]);
|
||
|
|
|
||
|
|
$data = json_decode(file_get_contents("php://input"), true);
|
||
|
|
|
||
|
|
$id = intval($data['id']);
|
||
|
|
$field = $data['field'];
|
||
|
|
$value = $data['value'];
|
||
|
|
|
||
|
|
/* récupérer le raccourci actuel */
|
||
|
|
$raccourci = getSpecificRaccourcis($bdd, $id);
|
||
|
|
|
||
|
|
$nom = $raccourci[0]['nom'];
|
||
|
|
$image = $raccourci[0]['image'];
|
||
|
|
$url = $raccourci[0]['url'];
|
||
|
|
|
||
|
|
/* modifier le champ concerné */
|
||
|
|
if ($field === "nom") {
|
||
|
|
$nom = $value;
|
||
|
|
}
|
||
|
|
|
||
|
|
if ($field === "url") {
|
||
|
|
$url = $value;
|
||
|
|
}
|
||
|
|
|
||
|
|
if ($field === "image") {
|
||
|
|
$image = $value;
|
||
|
|
}
|
||
|
|
|
||
|
|
/* appeler ta fonction */
|
||
|
|
updateRaccourcis($bdd, $id, $nom, $image, $url);
|