4 echo "Please login first. <br>";
5 $_SESSION['login_referer'] = $_SERVER['HTTP_REFERER'];
6 redirect("index.php?page=login", 2);
7 include('footer.html');
11 $action = filter_input(INPUT_GET
, "action", FILTER_SANITIZE_STRING
);
14 $sql_pquery = "select NomCl, PrenomCl, EmailCl, NumRueCl, NomRueCl, CodePosteCl, VilleCl from CLIENTS where EmailCl = ?";
15 $connection->prepare_query($sql_pquery);
16 $connection->prepared_query_bind_param("s", array($_SESSION['email']));
17 $connection->run_prepared_query();
18 $connection->get_pquery_result();
19 $rows = $connection->get_result_array();
20 $connection->close_prepared_query();
23 echo "<h2>Mes informations</h2>\n";
25 echo "<table id=\"taccount\">\n";
26 foreach ($rows as $row) {
28 echo " <td align=\"right\" valign=\"middle\">Prénom : </td>\n";
29 echo " <td align=\"left\" valign=\"middle\">" . htmlentities($row['PrenomCl']) . "</td>\n";
33 echo " <td align=\"right\" valign=\"middle\">Nom : </td>\n";
34 echo " <td align=\"left\" valign=\"middle\">" . htmlentities($row['NomCl']) . "</td>\n";
38 echo " <td align=\"right\" valign=\"middle\">Email : </td>\n";
39 echo " <td align=\"left\" valign=\"middle\">" . htmlentities($row['EmailCl']) . "</td>\n";
43 echo " <td align=\"right\" valign=\"middle\">Adresse : </td>\n";
44 echo " <td align=\"left\" valign=\"middle\"></td>\n";
48 echo " <td align=\"right\" valign=\"middle\">Numéro de rue : </td>\n";
49 echo " <td align=\"left\" valign=\"middle\">" . htmlentities($row['NumRueCl']) . "</td>\n";
53 echo " <td align=\"right\" valign=\"middle\">Rue : </td>\n";
54 echo " <td align=\"left\" valign=\"middle\">" . htmlentities($row['NomRueCl']) . "</td>\n";
58 echo " <td align=\"right\" valign=\"middle\">Code postal : </td>\n";
59 echo " <td align=\"left\" valign=\"middle\">" . htmlentities($row['CodePosteCl']) . "</td>\n";
63 echo " <td align=\"right\" valign=\"middle\">Ville : </td>\n";
64 echo " <td align=\"left\" valign=\"middle\">" . htmlentities($row['VilleCl']) . "</td>\n";
69 echo "| <a href=\"" . $configs['root_url'] . "/index.php?page=account&action=modifyaccount\">Modifier vos informations</a> | <a href=\"" . $configs['root_url'] . "/index.php?page=account&action=modifypassword\">Modifier votre mot de passe</a> |\n";
70 echo "<h2><a href=\"" . $configs['root_url'] . "/index.php?page=reservations\">Mes réservations</a></h2>\n";
71 } elseif ($action === "modifyaccount") {
73 <form action=\"index.php\" id=\"faccount\" method=\"post\">
74 <input type=\"hidden\" name=\"form\" value=\"account\" />
75 <label> Prénom : </label>
76 <input type=\"text\" size=\"25\" name=\"firstname\" value=\"" . $rows[0]['PrenomCl'] . "\" required/>
77 <label> Nom : </label>
78 <input type=\"text\" size=\"25\" name=\"name\" value=\"" . $rows[0]['NomCl'] . "\" required/>
79 <label> Email : </label>
80 <input type=\"email\" size=\"25\" name=\"email\" value=\"" . $rows[0]['EmailCl'] . "\" required/>
81 <label> Adresse : <br> Numéro de rue : </label>
82 <input type=\"number\" size=\"5\" name=\"numstreet\" value=\"" . $rows[0]['NumRueCl'] . "\" required/>
83 <label> Rue : </label>
84 <input type=\"text\" size=\"50\" name=\"street\" value=\"" . $rows[0]['NomRueCl'] . "\" required/>
85 <label> Code postal : </label>
86 <input type=\"number\" size=\"5\" name=\"postalcode\" value=\"" . $rows[0]['CodePosteCl'] . "\" required/>
87 <label> Ville : </label>
88 <input type=\"text\" size=\"15\" name=\"city\" value=\"" . $rows[0]['VilleCl'] . "\" required/>
89 <input type=\"submit\" value=\"Valider\">
92 } elseif ($action === "modifypassword") {
94 <form action=\"index.php\" id=\"fpassword\" method=\"post\">
95 <input type=\"hidden\" name=\"form\" value=\"account\" />
96 <label> Ancien mot de passe : </label>
97 <input type=\"password\" size=\"15\" name=\"oldpassword\" required/>
98 <label> Nouveau mot de passe : </label>
99 <input type=\"password\" minlength=\"8\" size=\"15\" name=\"password\" pattern=\"(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*\" title=\"Doit contenir 8 caractères minimum dont une majuscule, une minuscule et un chiffre\" required/>
100 <label> Confirmation du mot de passe : </label>
101 <input type=\"password\" minlength=\"8\" size=\"15\" name=\"confirmpassword\" pattern=\"(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*\" title=\"Doit contenir 8 caractères minimum dont une majuscule, une minuscule et un chiffre\" required/>
102 <input type=\"submit\" value=\"Valider\">
106 echo "Unknown account action. <br>\n";