-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewform.php
122 lines (117 loc) · 3.54 KB
/
viewform.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
<?php include 'connection.php';?>
<?php
session_start();
if(!($_SESSION['logged_in'])){
//$_SESSION['header_loc']="adminhome.php";
session_unset();
session_destroy();
header('Location: login.php');
}
$mod=$_REQUEST['module'];
//echo $mod;
$sql="SELECT Access FROM acccessmanager WHERE Module='$mod'";
//echo $sql;
$result=$conn->query($sql)->fetch_assoc();
$acc=$result['Access'];
//echo $_SESSION['Role_Index'];
//echo $acc[$_SESSION['Role_Index']+1];
if($acc[$_SESSION['Role_Index']+1]== 0){
header('Location: adminhome.php?msg=ACCESS DENIED');
}
?>
<script>
var id=<?php echo $id; ?>
var q=<?php echo $q; ?>
var fltr_str=<?php echo $fltr_str; ?>
var sort_str=<?php echo $sort_str; ?>
var n_order=<?php echo $n_order; ?>
var xmlhttp = new XMLHttpRequest();
function on_start(){
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("show_table").innerHTML = this.responseText;
}
}
xmlhttp.open("GET", "view_2.php?q="+q+"&id="+id+"&fltr_str="+fltr_str+"&sort_str="+sort_str+"&n_order="+n_order, true);
xmlhttp.send();
}
</script>
<script>
function toggle_func(id){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange=function(){
if(this.readyState == 4 && this.status == 200){
document.getElementById("show_table").innerHTML =this.responseText;
}
}
xmlhttp.open("GET","view_2.php?q=toggle&id="+id,true);
xmlhttp.send();
}
</script>
<script>
function del_func(id){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange=function(){
if(this.readyState == 4 && this.status == 200){
document.getElementById("show_table").innerHTML =this.responseText;
}
}
xmlhttp.open("GET","view_2.php?q=delete&id="+id,true);
xmlhttp.send();
}
</script>
<script>
function order_func(n_order,id,fltr_str,sort_str){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange=function(){
if(this.readyState == 4 && this.status == 200){
document.getElementById("show_table").innerHTML =this.responseText;
}
}
xmlhttp.open("GET","view_2.php?q=update&id="+id+"&n_order="+n_order,true);
xmlhttp.send();
}
</script>
<script>
function sort(sort_str,fltr_str){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("show_table").innerHTML = this.responseText;
}
}
xmlhttp.open("GET", "view_2.php?q=sortnfilter&id=0&fltr_str="+fltr_str+"&sort_str="+sort_str,true);
xmlhttp.send();
}
</script>
<html>
<head>
<title>View Form</title>
</head>
<body>
<h1>View Form</h1>
<form>
Filter by :<input type="text" name="fltr_str" value="" onkeyup="sort(sort_str.value,this.value)">
Sort by:
<select name="sort_str" onchange="sort(this.value,fltr_str.value)">
<option value="SNo" selected>SNo</option>
<option value="Name" >Name</option>
<option value="Parent" >Parent</option>
<option value="ParentName" >Parent Name</option>
<option value="Link" >Link</option>
<option value="Target" >Target</option>
<option value="OrderNo" >Order</option>
<option value="Status" >Status</option>
</select>
</form>
<br>
<div id="show_table">
<script> sort("SNo","");</script>
</div>
<form method="GET">
<a id="ref" href="viewform.php?q=all&id=1" target="_self"> Refresh </a>
<br>
<a href="adminhome.php" target="_self">Back To Admin Page</a>
</form>
</body>
</html>