commit cf68cb8d93185509742302e9bfbcbf680b49b2c5 Author: adri Date: Sun Dec 30 17:41:15 2018 +0100 fc diff --git a/config.php b/config.php new file mode 100644 index 0000000..95fb4d6 --- /dev/null +++ b/config.php @@ -0,0 +1,8 @@ + 'localhost', + 'username' => 'adri', + 'pw' => '', + 'dbName' => 'projetphp', +); +?> diff --git a/index.php b/index.php new file mode 100755 index 0000000..58117e7 --- /dev/null +++ b/index.php @@ -0,0 +1,63 @@ +getMessage()); +} +$reponse = $bdd->query('SELECT * FROM projetphp'); +?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fetch()) + { + ?> + + + + + + + + + + +
loginDate de nésanceemailPWslvl
+ + +
+ + diff --git a/post.php b/post.php new file mode 100644 index 0000000..d45c549 --- /dev/null +++ b/post.php @@ -0,0 +1,40 @@ +getMessage()); +} +//UPDATE `projetphp` SET `security_level` = '6' WHERE `projetphp`.`login` = 'aaazzze'; +if(isset($_POST["updatePW"], $_POST["datene"], $_POST["email"], $_POST["pw"], $_POST["sl"], $_POST["login"])) + if($_POST["updatePW"] == "true") + { + $req = $bdd->prepare('UPDATE `projetphp` SET `date_naissance` = :datene, `e_mail` = :email, `mot_de_passe` = :pw, `security_level` = :sl WHERE `projetphp`.`login` = :login'); + $req->execute(array( + 'datene' => $_POST["datene"], + 'email' => $_POST["email"], + 'pw' => md5($_POST["pw"]), + 'sl' => $_POST["sl"], + 'login' => $_POST["login"], + )); + $ret["return"] = true; + $ret["pw"] = md5($_POST["pw"]); + } + else + { + $req = $bdd->prepare('UPDATE `projetphp` SET `date_naissance` = :datene, `e_mail` = :email, `security_level` = :sl WHERE `projetphp`.`login` = :login'); + $req->execute(array( + 'datene' => $_POST["datene"], + 'email' => $_POST["email"], + 'sl' => $_POST["sl"], + 'login' => $_POST["login"], + )); + $ret["return"] = true; + $ret["pw"] = $_POST["pw"]; + } +else; + +echo json_encode((object)$ret); +?> diff --git a/script.js b/script.js new file mode 100644 index 0000000..a85114b --- /dev/null +++ b/script.js @@ -0,0 +1,85 @@ +$(function() { + $("#allRecord").on("click", ".editUser", function() { + $(this).toggleClass('fa-edit fa-check'); + $(this).toggleClass('editUser confirmEditUser'); + for(i=0; i<$("td", $(this).parent().parent()).length-1;i++) + { + j= $($("td", $(this).parent().parent())[i]); + j.html(''); + } + }); + $("#allRecord").on("click", ".confirmEditUser", function() { + function callBackVerif(data){ + var dataToSend = new Object(); + dataToSend["updatePW"] = (data===true?false:true); + if($(".pw input", tr).val() === data || data === true) + { + for(i=0; i"+e , "error" ); + } + console.log(data.return) + }, "json"); + } + else { + swal( "Oops" , "Password don't match !" , "error" ); + } + } + tds = $("td", $(this).parent().parent()); + tr = $(this).parent().parent(); + that = this; + if ($(".pw input", tr).val() === "") { + swal("no pw update"); + callBackVerif(true); + } + else { + swal({ + closeOnClickOutside: false, + closeOnEsc: false, + content: { + element: "input", + attributes: { + placeholder: "Confirmer le mot de passe", + type: "password", + }, + }, + }).then(callBackVerif); + } + }); +}); +function ltrim(str) { + if(str == null) return str; + return str.replace(/^\s+/g, ''); +} diff --git a/style.css b/style.css new file mode 100644 index 0000000..cfe5640 --- /dev/null +++ b/style.css @@ -0,0 +1,4 @@ +.click:hover +{ + cursor: pointer; +}