Advertisement
Guest User

Untitled

a guest
Sep 25th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title> Edit user </title>
  4. <meta charset = "UTF-8">
  5. </head>
  6.  
  7. <?php
  8. include ('session.php');
  9. include('menu.php');
  10. $userID = $_POST['edituser'];
  11. $userINFO = mysqli_query($con,"SELECT * FROM Users WHERE idUsers = '$userID'");
  12. $row = mysqli_fetch_array($userINFO,MYSQLI_ASSOC);
  13. $error = "";
  14. if(!empty($_POST['']) {
  15. //@ minskar warrnings
  16. $username = @$_POST["username"];
  17. $realname = @$_POST["realname"];
  18. $accessLevel = @$_POST["accessLevel"];
  19. $password = @$_POST["password"];
  20. $repeatPassword = @$_POST["repeatPassword"];
  21. $encpassword = md5($password);
  22. $query = mysqli_query($con,"SELECT * FROM Users WHERE idUsers = '$userID' ");
  23.  
  24. if($password == $repeatPassword){
  25. $row = mysqli_fetch_array($query,MYSQLI_ASSOC);
  26. if($password == false){
  27. $encpassword = $row['userPassword'];
  28. }
  29. if($realname == false){
  30. $realname = $row['realName'];
  31. }
  32. if($accessLevel == false){
  33. $accessLevel = $row['accessLevel'];
  34. }
  35. if($username == false)'{
  36. $username == $row['username'];
  37.  
  38. $sql = "UPDATE Users SET username = '$username',accessLevel = '$accessLevel',realName='$realname',userPassword='$encpassword' WHERE idUsers = '$userID'";
  39. mysqli_query($con, $sql);
  40. echo "SUCCE!";
  41.  
  42.  
  43.  
  44. }
  45. else{
  46. $error="Password does not match";
  47. }
  48.  
  49.  
  50. }
  51.  
  52. ?>
  53. <h1> Edit information for <?php echo $row['username']; ?> </h1>
  54. <div class="container">
  55.  
  56. <form class="data" method="post" action="" >
  57. <label> <font color="white"> Username:</font> </label> <input name="username" type="text"> <br>
  58. <label> <font color="white"> Realname: </font></label> <input name = "realname" type="text"> <br>
  59. <label> <font color="white"> Access level: </font></label> <input name = "accessLevel" type="text"> <br>
  60. <label> <font color="white"> Password: </font></label> <input name = "password" type="password"> <br>
  61. <label> <font color="white"> Repeat password: </font></label> <input name = "repeatPassword" type="password"> <br>
  62.  
  63. <br>
  64. <input type="Submit" name = "done" value = "Submit" > <br>
  65.  
  66. </form>
  67. </div>
  68.  
  69. <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
  70. <div id="error" style="float:left"><?php echo $error; ?></div>
  71. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement