-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublic_tools.php
229 lines (182 loc) · 7.22 KB
/
public_tools.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
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<?php
/**
* Include configuration file
* **/
require 'includes/config.php';
$query = "Select tool_name, tool_short_desc, tool_link from public_tools";
$result = mysqli_query($conn, $query);
?>
<html>
<head>
<meta name="description" content="HABDSK is trying to give full convenience to its users and have collected all the tools either used in research or in study." />
<?php require_once ("includes/head-tag-elements.php");?>
</head>
<body>
<div id="wrapper">
<?php
require "includes/header.php";
require "includes/nav.php";
?>
<div id="main-content">
<div id="sidebar">
<div id="categories" class="boxed">
<div class="row py-3">
<div class="col">
<h2 class="text-center">Our Services</h2>
</div>
</div>
<?php require 'includes/sidenav.php';?>
</div>
<div style="border:2px solid silver; height: auto; width:100%; border-radius: 10px; margin-top: 10px; margin-bottom: 10px;">
<div><img width="100%" src="images/news_table.gif" /></div>
<marquee
behavior= "scroll"
direction="up"
onmouseover="this.setAttribute('scrollamount', 0, 0);this.stop();"
onmouseout="this.setAttribute('scrollamount', 6, 0);this.start();"
height='250px' >
<p align=center>
<?php require("includes/news.php"); ?>
</p>
</marquee>
</div>
</div>
<div id="posts">
<div class="post">
<h2 class="title"> </h2>
<div class="meta">
<p class="date">Posted on January 20, 2020 by Dr. Shahid Ullah</p>
</div>
</div>
</div>
<div id=posts>
<p>
Most welcome to (S-Khan lab) tool page, we have provided biological tools related data services to the scientific community, and have tried to include tools that ranges from basic histology to the latest techniques of biological sciences like recombinant DNA technology, PCR mutagenesis, microarrays etc. This page focused on the principle and instrumentation of the biological tools, we've gathered almost all biological tools and with time we're going to update for scientific community, we've placed the search tool at the top of the menu bar for quick search, for any suggestion warm welcome to email us, we will be glad to see your kind suggestion.
</p>
<?php
if(isset($_POST['submit'])){
$query = mysqli_real_escape_string($conn, $_POST['search']);
$sql = "SELECT * FROM public_tools WHERE tool_name LIKE '$query' OR tool_short_desc LIKE '%$query%' OR tool_long_desc LIKE '%$query%'";
$response = mysqli_query($conn, $sql) or die("<br>error searching data");
$rows = mysqli_num_rows($response);
echo "<h2> $rows Tool(s) Founded</h2><br>";
//echo '<div class="box-wrap">';
while($row = mysqli_fetch_array($response)){
echo ' <div class="accordion" id="accordionExample">
<div class="card">
<div class="card-header" id="headingOne">
<h2 class="mb-0">
<button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">';
echo $row['tool_name'];
echo '</button>
</h2>
</div>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordionExample">
<div class="card-body"> ';
echo $row['tool_long_desc'];
echo '<br><a href="';
echo $row['tool_link'];
echo '" class="btn btn-primary btn-sm active" role="button" aria-pressed="true">Details</a>';
echo ' </div>
</div>
</div>
</div>';
}
echo "</div>";
}
else{
// find out how many rows are in the table
echo '<div class="box-wrap">';
$sql = "SELECT COUNT(*) FROM public_tools";
$sql_result1 = mysqli_query($conn, $sql) or trigger_error("SQL", E_USER_ERROR);
$r = mysqli_fetch_row($sql_result1);
$numrows = $r[0];
// number of rows to show per page
$rowsperpage = 20;
// find out total pages
$totalpages = ceil($numrows / $rowsperpage);
// get the current page or set a default
if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {
// cast var as int
$currentpage = (int) $_GET['currentpage'];
} else {
// default page num
$currentpage = 1;
} // end if
// if current page is greater than total pages...
if ($currentpage > $totalpages) {
// set current page to last page
$currentpage = $totalpages;
} // end if
// if current page is less than first page...
if ($currentpage < 1) {
// set current page to first page
$currentpage = 1;
} // end if
// the offset of the list, based on current page
$offset = ($currentpage - 1) * $rowsperpage;
// get the info from the db
$sql = "SELECT tool_name, tool_link FROM public_tools LIMIT $offset, $rowsperpage";
$sql_result = mysqli_query($conn, $sql) or trigger_error("SQL", E_USER_ERROR);
while ($row = mysqli_fetch_array($sql_result)) {
echo '
<div class="box">
<a target="_blank" href=' . $row['tool_link'] . '>
<p>'
. $row['tool_name'] .
'</p>
</a>
</div>';
}
echo "</div>";
/******
* Build the pagination links
* ******/
// range of num links to show
$range = 3;
echo '<div class="center"><div class="pagination">';
// if not on page 1, don't show back links
if ($currentpage > 1) {
// show << link to go back to page 1
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'><<</a> ";
// get previous page num
$prevpage = $currentpage - 1;
// show < link to go back to 1 page
echo "<a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><</a> ";
} // end if
// loop to show links to range of pages around current page
for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {
// if it's a valid page number...
if (($x > 0) && ($x <= $totalpages)) {
// if we're on current page...
if ($x == $currentpage) {
// 'highlight' it but don't make a link
echo "<a href='#' class='active'><b>$x</b></a>";
// if not current page...
} else {
// make it a link
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> ";
} // end else
} // end if
} // end for
// if not on last page, show forward and last page links
if ($currentpage != $totalpages) {
// get next page
$nextpage = $currentpage + 1;
// echo forward link for next page
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'>></a> ";
// echo forward link for lastpage
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>>></a> ";
} // end if
/******
* End build pagination links
* ******/
echo '</div></div>';
}
?>
</div>
<?php require 'includes/footer.php';?>
</div>
<script type="text/javascript" src="js/nav.js"></script>
</body>
</html>