-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-employee.php
125 lines (96 loc) · 4.54 KB
/
update-employee.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
require 'authentication.php'; // admin authentication check
// auth check
$user_id = $_SESSION['admin_id'];
$user_name = $_SESSION['name'];
$security_key = $_SESSION['security_key'];
if ($user_id == NULL || $security_key == NULL) {
header('Location: index.php');
}
// check admin
$user_role = $_SESSION['user_role'];
if ($user_role != 1) {
header('Location: task-info.php');
}
$admin_id = $_GET['admin_id'];
if(isset($_POST['update_current_employee'])){
$obj_admin->update_user_data($_POST,$admin_id);
}
if(isset($_POST['btn_user_password'])){
$obj_admin->update_user_password($_POST,$admin_id);
}
$sql = "SELECT * FROM tbl_admin WHERE user_id='$admin_id' ";
$info = $obj_admin->manage_all_info($sql);
$row = $info->fetch(PDO::FETCH_ASSOC);
$page_name="Admin";
include("include/sidebar.php");
?>
<div class="row">
<div class="col-md-12">
<div class="well well-custom">
<ul class="nav nav-tabs nav-justified nav-tabs-custom">
<li><a href="manage-admin.php">Manage Admin</a></li>
<li><a href="admin-manage-user.php">Manage Employee</a></li>
</ul>
<div class="gap"></div>
<div class="row">
<div class="col-md-10 col-md-offset-1">
<div class="well">
<h3 class="text-center bg-primary" style="padding: 7px;">Edit Employee</h3><br>
<div class="row">
<div class="col-md-7">
<form class="form-horizontal" role="form" action="" method="post" autocomplete="off">
<div class="form-group">
<label class="control-label col-sm-2">Fullname</label>
<div class="col-sm-8">
<input type="text" value="<?php echo $row['fullname']; ?>" placeholder="Enter Employee Name" name="em_fullname" list="expense" class="form-control input-custom" id="default" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Username</label>
<div class="col-sm-8">
<input type="text" value="<?php echo $row['username']; ?>" placeholder="Enter Employee Username" name="em_username" class="form-control input-custom" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Email</label>
<div class="col-sm-8">
<input type="email" value="<?php echo $row['email']; ?>" placeholder="Enter employee email" name="em_email" class="form-control input-custom" required>
</div>
</div>
<div class="form-group">
</div>
<div class="form-group">
<div class="col-sm-offset-4 col-sm-3">
<button type="submit" name="update_current_employee" class="btn btn-success-custom">Update Now</button>
</div>
</div>
</form>
</div>
<div class="col-md-5">
<button id="emlpoyee_pass_btn" class="btn btn-primary">Change Password</button>
<form action="" method="POST" id="employee_pass_cng">
<div class="form-group">
<label for="admin_password">New Password:</label>
<input type="password" name="employee_password" class="form-control input-custom" id="employee_password" min="8" required>
</div>
<div class="form-group">
<button type="submit" name="btn_user_password" class="btn btn-success">Ok</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
include("include/footer.php");
?>
<script type="text/javascript">
$('#emlpoyee_pass_btn').click(function(){
$('#employee_pass_cng').toggle('slow');
});
</script>