From 5fd9fa480f302902328b81f912dd67ce378284f8 Mon Sep 17 00:00:00 2001 From: citizenz7 Date: Thu, 20 Apr 2017 18:50:55 +0200 Subject: V.1.4.6 --- Html/admin/edit-user.php | 166 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 Html/admin/edit-user.php (limited to 'Html/admin/edit-user.php') diff --git a/Html/admin/edit-user.php b/Html/admin/edit-user.php new file mode 100644 index 0000000..cc4dab9 --- /dev/null +++ b/Html/admin/edit-user.php @@ -0,0 +1,166 @@ + retour sur la page login +if(!$user->is_logged_in()) { + header('Location: login.php'); +} + +if(isset($_SESSION['userid'])) { + if($_SESSION['userid'] != 1) { + header('Location: '.SITEURL); + } +} + +// titre de la page +$pagetitle = 'Admin : édition du profil de '.$_SESSION['username']; +require('../includes/header.php'); +?> + + +
+ + + +
+
+ + +

Liste des membres

+ +

Edition du profil membre

+ + + 0){ + + if($password ==''){ + $error[] = 'Veuillez entrer un mot de passe.'; + } + + if($passwordConfirm ==''){ + $error[] = 'Veuillez confirmer le mot de passe.'; + } + + if($password != $passwordConfirm){ + $error[] = 'Les mots de passe ne concordent pas.'; + } + + } + + + if($email ==''){ + $error[] = 'Veuillez entrer une adresse e-mail.'; + } + if(!isset($error)){ + + try { + + if(isset($password)){ + + $hashedpassword = $user->password_hash($password, PASSWORD_BCRYPT); + + //update into database + $stmt = $db->prepare('UPDATE blog_members SET username = :username, password = :password, email = :email WHERE memberID = :memberID') ; + $stmt->execute(array( + ':username' => $username, + ':password' => $hashedpassword, + ':email' => $email, + ':memberID' => $memberID + )); + + + } else { + + //update database + $stmt = $db->prepare('UPDATE blog_members SET username = :username, email = :email WHERE memberID = :memberID') ; + $stmt->execute(array( + ':username' => $username, + ':email' => $email, + ':memberID' => $memberID + )); + + } + + + //redirect to index page + header('Location: users.php?action=updated'); + exit; + + } catch(PDOException $e) { + echo $e->getMessage(); + } + + } + + } + + ?> + '; + } + } + + try { + + $stmt = $db->prepare('SELECT memberID, username, email FROM blog_members WHERE memberID = :memberID') ; + $stmt->execute(array(':memberID' => $_GET['id'])); + $row = $stmt->fetch(); + + } catch(PDOException $e) { + echo $e->getMessage(); + } + + ?> + +
+ '> + +


+ '>

+ +


+

+ +


+

+ +


+ '>

+ +

+ +
+
+ + + +
+
+
+ + + + + -- cgit v1.2.1