-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser_active.php
151 lines (143 loc) · 6.84 KB
/
user_active.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<html>
<link href="css/login.css" rel="stylesheet" type="text/css"/>
<head>
<title>
User_active
</title>
<?php
if ($_COOKIE['username']=='') {
header("Location:index.php");
}
include './includefiles/header.php';
include './includefiles/bubbles.php';
include './includefiles/nav_menu.php';
?>
<link href="css/checkbox.css" rel="stylesheet" type="text/css"/>
<script src="js/checkbox.js" type="text/javascript"></script>
</head>
<body class="myback">
<script type = "text/javascript" >
$(document).ready(function () {
$('#active').switchable();
});
function userstate()
{
var ativ = 0;
if ($('#active').is(':checked'))
ativ = 1;
$.post("./includefiles/DBconnect.php", {
Active: ativ,
tbl: 'user_tbl',
method: 'update',
id: $('#user_code').val(),
}, function (response) {
alert(response);
});
return false;
}
function delete_user()
{
$.post("./includefiles/DBconnect.php", {
tbl: 'user_tbl',
method: 'delete',
id: $('#user_code').val(),
}, function (response) {
alert(response);
});
return false;
}
$.ajaxSetup({async: false});
$(document).ready(function () {
$("table").fixMe();
});
</script>
<div class="content homepage">
<div class="container" >
<form method="post" >
<br><br> <br><br>
<div class="row"><br><br>
<div class="col-md-12">
<div class="col-md-6">
<div class="col-md-6">
<div class="form-group">
<select id="user_typ" name="user_type" class="form-control required">
<option value="" >select user type</option>
<option value="tstaff" >TEACHING STAFF</option>
<option value="nstaff" >NON TEACHING STAFF</option>
<option value="student" >STUDENTS</option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<button name="btnclick" type="submit" class="btn btn-success">View</button>
</div>
</div>
</div>
<div class="col-md-4">
<div class="widget-content myback" style="border-radius:20px">
<div class="page-title" style="text-align :center;color: white">
<i class="fa fa-users">
USER ACTIVATION
</i>
<hr>
</div>
<br>
<div id="parant_ctrl">
<div class="form-group">
<input type="text" id="user_code" placeholder="user_code" data-content="parant_id" name="parant_id" class="form-control required" />
</div>
</div>
<div class="form-group">
<!--<div class="col-md-3"><p style="float:left;">Active</p></div>-->
<input type="checkbox" id="active" name="active" value="checked" data-label="Active"/>
<button type="button" name="btnsave" onclick="return userstate()" class="btn btn-info" >Save</button>
<button type="button" name="btndelete" onclick="return delete_user()" class="btn btn-danger" >delete</button>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<br><br>
<?php
require_once 'includefiles/config.php';
if ($_POST) {
$sql = "select * from user_tbl where user_type= '" . $_POST['user_type'] . "'";
?>
<div class="widget-content" style='background: rgba(255, 255, 255, 0.15); border-radius: 50px;'>
<table width="100%" class="table-bordered">
<tr><th>S.NO</th><th>user_code</th><th>UserName</th><th>Mobile</th><th>Email</th><th>Status</th>
</tr>
<?php
$res = $con->query($sql) or exit(mysql_errno());
$count = 1;
$results = mysqli_query($con, $sql);
while ($rs = mysqli_fetch_assoc(@$results)) {
// while ($rs = $res->fetch()) {
?>
<tr >
<td><?php echo $count++ ?></td>
<td><?php echo $rs['id'] ?></td>
<td><?php echo $rs['username'] ?></td>
<td><?php echo $rs['mobile'] ?></td>
<td><?php echo $rs['email'] ?></td>
<td><?php echo $rs['active'] ?></td>
</tr>
<?php
}//whilte
}
?>
</table>
</div>
</div>
</form>
<?php
// include_once './includefiles/bubbles.php';
include_once './includefiles/footer.php';
?>
</div>
</div>
</div>
</body>
</html>