core::getPost("date"), "label" => core::getPost("label"), "montant" => core::getPost("montant"), "type" => core::getPost("type"), "solde" => core::getPost("solde") ); if (empty($data["date"]) || empty($data["label"]) || empty($data["montant"]) || empty($data["type"])) { alert::recError("Tous les champs sont obligatoires."); header("Location: /?p=compte-insert"); exit(); } // Backup (backup::create()) ? alert::recSuccess("Backup des données OK") : alert::recError("Backup des données KO"); $data["md5"] = md5($data["date"] . $data["label"] . $data["montant"] . $data["type"] . $data["solde"]); $data["debit"] = ($data["type"] == 2) ? $data["montant"] : "0.00"; $data["credit"] = ($data["type"] == 1) ? $data["montant"] : "0.00"; $type = ($data["type"] == 2) ? "Débit" : "Crédit"; banque::recordLigne($data, 4); $log = "Ligne ajoutée : " . $data["label"] . " - " . $type . " de " . $data["montant"] . " €"; historique::recRef("/compte-4.html"); historique::add(array( "idType" => historique::getIdRef("ACTION"), "idUser" => session::getId(), "idPage" => historique::getIdRef("/compte-4.html"), "log" => $log )); historique::recordAlert("SUCCESS"); alert::recSuccess($log); json::create("banque-lignes-4"); header("Location: /compte-4.html"); exit(); } else { header('HTTP/1.0 401 Unauthorized'); exit(); }