-
Notifications
You must be signed in to change notification settings - Fork 0
/
editUser.php
86 lines (73 loc) · 3.52 KB
/
editUser.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php $title = 'Manage Admin & User Details';?>
<?php include 'includes/headlink.php';?>
<body>
<?php include 'includes/sidebar.php';?>
<?php include 'includes/navbar.php';?>
<div class="main_section">
<div class="container">
<div class="row">
<?php if($_SESSION['role'] == 1 && isset($_GET['id'])) {
//Only Accessable for superadmin
$id=$_GET['id'];
?>
<!-- <a href="borrowIssueList.php?activePage=borrowIssueList" class="btn btn-success mt-4 mb-2 border-0 rounded-0">All user list</a> -->
<form class="d-block mx-auto border col-12 mt-1 mb-5 pl-5 pr-55 m-height200" action="action/manageUserAction.php" method="post">
<h4 class="d-block text-center p-4 font-weight-bold">Edit user/subadmin name</h4>
<?php
if (isset($_SESSION['alert']))
{
echo "<span class='d-block text-center alert alert-danger ' role='alert'>".$_SESSION['alert']."<button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span>
</button></span>";
}
unset($_SESSION['alert']);
?>
<div id="alert_box"></div>
<?php
$sub = "SELECT username from login where id=$id";
$row = $conn->query($sub);
if($row->num_rows > 0){
while ($data = $row->fetch_assoc()) {
$name = $data['username'];
?>
<div class="form-group row">
<label class="col-md-3 col-form-label-sm text-right">Name</label>
<div class="col-md-9">
<input type="text" name="username" class="form-control" value="<?=$name?>" placeholder="Enter Name" required>
</div>
</div>
<?php }
}?>
<div class="form-group row">
<input type="hidden" name="user_id" value="<?=$id?>">
<div class="col-md-12 text-center">
<button type="submit" id="submit" name="edit_username" class="btn btn-primary">Submit</button>
</div>
</div>
</form>
<?php }
else { ?>
<h2 class='d-block mx-auto p-5 text-danger'><strong>Error!</strong>Sorry you cannot access this page! </h2>
<?php } ?>
</div>
</div>
</div>
<?php include 'includes/footer_link.php';?>
<script>
var pass = document.querySelector('#password');
var re_pass = document.querySelector('#re_password');
var alert = document.querySelector('#alert_box');
var submitBtn = document.querySelector('#submit');
re_pass.onkeyup = function(e){
main_pass = pass.value;
if (this.value == main_pass) {
alert.innerHTML = "<span class='d-block alert alert-success'>Password matched !!</span>";
submitBtn.disabled = false;
}
else{
alert.innerHTML = "<span class='d-block alert alert-danger'>Password not matched!!</span>";
submitBtn.disabled = true;
}
}
</script>
</body>
<html>