Advertisement
Guest User

Untitled

a guest
Jan 26th, 2018
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.57 KB | None | 0 0
  1. <?php
  2. // Recup l'user par l'ID
  3. if(isset($_GET['id']) AND $_GET['id'] > 0) {
  4.    $getid = intval($_GET['id']);
  5.    $requser = $bdd->prepare('SELECT * FROM users WHERE id = ?');
  6.    $requser->execute(array($getid));
  7.    $userinfo = $requser->fetch();
  8. // Ajout d'un utilisateur
  9.  
  10. if(isset($_POST['pseudo']) AND !empty($_POST['pseudo']) AND $_POST['pseudo'] != $userinfo['pseudo']) {
  11.       $pseudo = htmlspecialchars($_POST['pseudo']);
  12.       $userid = $userinfo['id'];
  13.       $insertpseudo = $bdd->prepare("UPDATE users SET pseudo = ? WHERE id = ?");
  14.       $insertpseudo->execute(array($pseudo, $userid));
  15.       header("Location: admin-users.php");
  16. }
  17.  
  18. if(isset($_POST['email']) AND !empty($_POST['email']) AND $_POST['email'] != $userinfo['mail']) {
  19.       $email = htmlspecialchars($_POST['email']);
  20.       $userid = $userinfo['id'];
  21.       $insertemail = $bdd->prepare("UPDATE users SET mail = ? WHERE id = ?");
  22.       $insertemail->execute(array($email, $userid));
  23.       header("Location: admin-users.php");
  24.    }
  25.  
  26. if(isset($_POST['actif']) AND !empty($_POST['actif']) AND $_POST['actif'] != $userinfo['actif']) {
  27.       $actif = $_POST['actif'];
  28.       $userid = $userinfo['id'];
  29.       $insertactif = $bdd->prepare("UPDATE users SET actif = ? WHERE id = ?");
  30.       $insertactif->execute(array($actif, $userid));
  31.       header("Location: admin-users.php");
  32.    }
  33. ?>
  34.  
  35.  
  36. <input class="form-control" type="checkbox" name="actif" id="actif" value="<?php echo $userinfo['actif']; ?>" <?php if ($userinfo['actif'] == "1") { echo "checked"; } ?>>
  37. <input type="hidden" name="actif" value="1" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement