-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain_Page.php
More file actions
175 lines (140 loc) · 4.79 KB
/
Main_Page.php
File metadata and controls
175 lines (140 loc) · 4.79 KB
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
tr:nth-child(even){
background-color: #f2f2f2;
}
tr:hover{
background-color: #333;
color: #fff;
border: 1px solid #fff;
}
table a, table a:visited{
width: 100%;
height: 100%;
background: #fff;
color: #000;
}
table a:hover{
color: #fff;
}
</style>
<title>EDPR File System</title>
<style type="text/css">
</style>
</head>
<body style="text-align: center;">
<img src="images/arms.jpg">
<p id="republic">THE REPUBLIC OF UGANDA</p>
<h1>MINISTRY OF FINANCE, PLANNING AND ECONOMIC DEVELOPMENT</h1>
<h2>ECONOMIC DEVELOPMENT POLICY AND RESEARCH (EDPR)</h2>
<?php
include ("hor_nav.php");
if ($_SESSION['user'] == true) {
echo "<i>You are logged in as "."<label style='text-decoration: underline;'><b>".$_SESSION['user']."</b></label></i>";
}else{
header("Location:Index.php");
}
?>
<br><br>
<?php
$search_item = "";
function test_input($keepData) {
$keepData = trim($keepData);
$keepData = stripslashes($keepData);
$keepData = htmlspecialchars($keepData);
//$keepData = basename($keepData);
return $keepData;
}
$dbConnect = mysqli_connect('localhost', 'root', 'ak_94*jmv', 'edpr');
$sql = "SELECT * FROM secretary ";
if (isset($_POST['btnsearch'])) {
$search_term =mysqli_real_escape_string($dbConnect, $_POST['valueToSearch']);
$sql .= "WHERE ref_no = '{$search_term}'";
$sql .= "OR serialno = '{$search_term}'";
$search_item = test_input($_POST['valueToSearch']);
}
if(isset($_POST['btnsearch']) && empty($_POST['valueToSearch'])){
echo "<script type='text/javascript'>
window.alert('Fill in item to Search, Otherwise Refresh');</script>";
}
$query = mysqli_query($dbConnect, $sql) or die(mysqli_error($dbConnect));
?>
<form name="search_box" action="assignments.php" method="POST">
<input type="text" value="<?php echo $search_item ?>" placeholder="Search for Ref No or File Origin.." name="valueToSearch" id="searchedValue" style="width: 220px; height: 25px;"/>
<input type="submit" style="width: 100px; height: 30px;" name="btnsearch" value="Search" />
<input type="submit" style="width: 100px; height: 30px;" name="btnreset" value="Refresh" />
</form>
<!--<div id='d1'></div>
<script type="text/javascript">
function searchValue(){
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET","search_assign.php?nm="+document.getElementById("searchedValue").value,false);
xmlhttp.send(null);
document.getElementById('d1').innerHTML=xmlhttp.responseText;
}
</script>-->
<section style="">
<table cellpadding="10" border="1" style="border: 3px solid #ddd; border-collapse: collapse; overflow: hidden; overflow-y: scroll; text-align: left; width: 1460px; font-family: 'Trebuchet MS', 'Arial', 'Helvetica', sans-serif;" align="center">
<!--<a href="Main_Page.php" style="color: blue;">Go To Home</a>-->
<tr style="background: #4CAF50; color: #fff; height: 50px; font-size: 20px; text-align: center;">
<th>Serial No.</th>
<th>Ref No</th>
<th>File Origin</th>
<th>Subject</th>
<th>From</th>
<th>To</th>
<th>Action</th>
<th>Due Days</th>
<th>Status</th>
<th>Forward</th>
<th>Date sent</th>
<th>Status</th>
</tr>
<?php
while($row1=mysqli_fetch_array($query)):;?>
<tr>
<td style="height: 40px;"><?php echo $row1[0];?></td>
<td><?php echo $row1[1];?></td>
<td><?php echo $row1[2];?></td>
<td><?php echo $row1[3];?></td>
<td><?php echo $row1[4];?></td>
<td><?php echo $row1[5];?></td>
<td><?php echo $row1[6];?></td>
<?php
if ($row1[7] == 'none') {?>
<td style="text-align: center;"><?php echo $row1[7];?>
<?php }
else{
?>
<td style="text-align: center;"><?php echo $row1[7];?> | <a href="view_countdown_comm.php?countdownId=<?php echo $row1[0];?>" style="color: blue; text-decoration: none;"><i>View</i></a>
<?php }?>
</td>
<?php
if ($row1[8] == 'Done') {?>
<td><?php echo $row1[8];?> | <a href="update_assign.php?updateId=<?php echo $row1[0];?>" style="color: blue; text-decoration: none;"><i>Update </i></td>
<?php }?>
<?php
if($row1[8] == 'Pending'){?>
<td><b><label style="color: red"><?php echo $row1[8];?></label></b> | <a href="update_assign.php?updateId=<?php echo $row1[0];?>" style="color: blue; text-decoration: none;"><i>Update</i></a></td>
<td><?php echo $row1[9];?></td>
<td><?php echo $row1[10];?></td>
<td><?php echo $row1[11];?></td>
<?php }?>
</tr>
<?php endwhile;?>
<?php mysqli_close($dbConnect);?>
</table>
<?php
if (isset($_POST['btnsearch']) && $_POST['valueToSearch'] == ''){
echo"<label style='color: red;'>No data for this Search! Refresh</label>";
$search_item = test_input($_POST['valueToSearch']);
}
?>
</section>
</body>
</html>