Modification du pompier

This commit is contained in:
pierre renaudot
2023-10-12 09:01:55 +02:00
parent ea3ea7cb5f
commit 5fdb28c44e
5 changed files with 61 additions and 31 deletions

View File

@@ -65,8 +65,14 @@ switch ($action) {
break;
case 'validerAjouter':
case 'validerModifier': {
var_dump($_REQUEST);
$valeur = $_REQUEST['pId'];
var_dump($_REQUEST);
if (!isset($pdo)) {
require_once ("../include/class.pdo.php");
$pdo = PdoBD::getPdoBD();
}
$pId = $_REQUEST['pId'];
$nom = addslashes($_REQUEST['ztNom']);
$prenom = addslashes($_REQUEST['ztPrenom']);
$type = $_REQUEST['lstType'];
@@ -74,11 +80,12 @@ switch ($action) {
$statut = $_REQUEST['lstStatut'];
$cis = $_REQUEST['zCis'];
$mail = $_REQUEST['ztMail'];
$login = $_REQUEST['ztLogin'];
$mdp = md5($_REQUEST['ztMdp']);
if ($_REQUEST['brMdp'] == 0 and $action === "validerModifier") {
$mdp = "*";
}
$login = strtolower($_REQUEST['ztPrenom'][0]) . strtoupper($_REQUEST['ztNom']);
$mdp = md5($login);
//$mdp = md5($_REQUEST['ztMdp']);
// if ($_REQUEST['brMdp'] == 0 and $action === "validerModifier") {
// $mdp = "*";
// }
$adresse = addslashes($_REQUEST['ztAdresse']);
if (strlen($_REQUEST['ztCodePostal']) > 1) {
@@ -88,7 +95,7 @@ switch ($action) {
}
$ville = addslashes($_REQUEST['ztVille']);
if (strlen($_REQUEST['ztTel']) > 1) {
if (strlen($_REQUEST['ztTel']) > 0) {
$tel = str_replace(" ", "", $_REQUEST['ztTel']);
$tel = str_replace(".", "", $tel);
$tel = str_replace("/", "", $tel);
@@ -98,9 +105,9 @@ switch ($action) {
$commentaire = addslashes($_REQUEST['ztObservation']);
if ($action === "validerAjouter") {
$pdo->ajoutPompier($cis, $valeur, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire);
$pdo->ajoutPompier($cis, $pId, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire);
} elseif ($action === "validerModifier") {
$pdo->majPompier($cis, $valeur, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire);
$pdo->majPompier($cis, $pId, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire);
}
//header('location: index.php?choixTraitement=pompiers&action=voir&lstPompiers=' . $valeur);
break;