Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title> Edit user </title>
- <meta charset = "UTF-8">
- </head>
- <?php
- include ('session.php');
- include('menu.php');
- $userID = $_POST['edituser'];
- $userINFO = mysqli_query($con,"SELECT * FROM Users WHERE idUsers = '$userID'");
- $row = mysqli_fetch_array($userINFO,MYSQLI_ASSOC);
- $error = "";
- if(!empty($_POST['']) {
- //@ minskar warrnings
- $username = @$_POST["username"];
- $realname = @$_POST["realname"];
- $accessLevel = @$_POST["accessLevel"];
- $password = @$_POST["password"];
- $repeatPassword = @$_POST["repeatPassword"];
- $encpassword = md5($password);
- $query = mysqli_query($con,"SELECT * FROM Users WHERE idUsers = '$userID' ");
- if($password == $repeatPassword){
- $row = mysqli_fetch_array($query,MYSQLI_ASSOC);
- if($password == false){
- $encpassword = $row['userPassword'];
- }
- if($realname == false){
- $realname = $row['realName'];
- }
- if($accessLevel == false){
- $accessLevel = $row['accessLevel'];
- }
- if($username == false)'{
- $username == $row['username'];
- $sql = "UPDATE Users SET username = '$username',accessLevel = '$accessLevel',realName='$realname',userPassword='$encpassword' WHERE idUsers = '$userID'";
- mysqli_query($con, $sql);
- echo "SUCCE!";
- }
- else{
- $error="Password does not match";
- }
- }
- ?>
- <h1> Edit information for <?php echo $row['username']; ?> </h1>
- <div class="container">
- <form class="data" method="post" action="" >
- <label> <font color="white"> Username:</font> </label> <input name="username" type="text"> <br>
- <label> <font color="white"> Realname: </font></label> <input name = "realname" type="text"> <br>
- <label> <font color="white"> Access level: </font></label> <input name = "accessLevel" type="text"> <br>
- <label> <font color="white"> Password: </font></label> <input name = "password" type="password"> <br>
- <label> <font color="white"> Repeat password: </font></label> <input name = "repeatPassword" type="password"> <br>
- <br>
- <input type="Submit" name = "done" value = "Submit" > <br>
- </form>
- </div>
- <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
- <div id="error" style="float:left"><?php echo $error; ?></div>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement