$notview = true; $retour = true; $libretour[] = "Retour au compte"; $lienretour[] = __racineadmin__ . "/custom/compte/index.php?mode=list"; require "../../include/template_list.php"; } else { if ($_POST["save"] == "yes") { switch ($_GET["mode"]) { case "suppr": $txtmsg = "Le boitiers a été supprimé"; //suppression de l'application sur gpsgate $sql = "select * from {$table} where {$tablekey}=" . $_GET["id"]; $link = query($sql); $tbl = fetch($link); //archivage des anciennes données archivedevice($tbl["devices_id"]); $szQuery = "update {$table} set supprimer=1 where {$tablekey}=" . $_GET["id"]; break; case "ajout": $txtmsg = "Le boitiers a été ajouté"; //creation du device en base //on regarde le dernier id en base $sql = "select max(id) as maxid from devices"; $link = query($sql); $tbl = fetch($link); if ($_POST["type_device_id"] == 1) { //orion on stock le serial $uniqueId = $_POST["unitid"]; } else { $uniqueId = $_POST["IMEI"]; }
function archivecompte($compte_id) { $sql = "select * from " . __racinebd__ . "device where compte_id=" . $compte_id; $link = query($sql); while ($tbl = fetch($link)) { $sql = "update " . __racinebd__ . "device set supprimer=1 where device_id='" . $_GET["id"] . "'"; query($sql); archivedevice($tbl["devices_id"]); } }