X-Git-Url: https://git.piment-noir.org/?p=Project_webapp.git;a=blobdiff_plain;f=includes%2Fformaccount.php;fp=includes%2Fformaccount.php;h=37acd6d1bc3cd845c7c4f613bca162376f65a4be;hp=0000000000000000000000000000000000000000;hb=22f1dc6402dbc9a9c5d2ed2f17ef54044d35ec2a;hpb=0a87f4538a04b4dba4888a6abdb166ba8f465ba4 diff --git a/includes/formaccount.php b/includes/formaccount.php new file mode 100644 index 0000000..37acd6d --- /dev/null +++ b/includes/formaccount.php @@ -0,0 +1,44 @@ +" ; + $input_failure = true; +} +if (!$form_postalcode) { + echo "The postal code is not valid.
"; + $input_failure = true; +} +if (!$form_email) { + echo "The email is not valid.
"; + $input_failure = true; +} + +if (!empty($form_name) && !empty($form_firstname) && !empty($form_numstreet) && !empty($form_street) && + !empty($form_postalcode) && !empty($form_city) && !empty($form_email) && + !$input_failure) { + global $connection; + $client_id = get_client_id($_SESSION['email']); + $sql_pquery = "update CLIENTS + set NomCl = ?, PrenomCl = ?, EmailCl = ?, NumRueCl = ?, NomRueCl = ?, CodePosteCl = ?, VilleCl = ? + where NumCl = ?"; + $connection->prepare_query($sql_pquery); + $connection->prepared_query_bind_param("sssisisi", array($form_name, $form_firstname, $form_email, $form_numstreet, $form_street, $form_postalcode, $form_city, $client_id)); + $connection->run_prepared_query(); + $connection->close_prepared_query(); + echo "You've updated your personal informations, you will be redirected to your account in 3 seconds.
"; + redirect("index.php?page=account", 3); + +} else { + echo "There's a required non filled field or the input in a field do not match the required pattern.
"; + echo "Retour"; +} +?>