mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-05-16 12:16:57 +00:00
updated search feature 90% complete
This commit is contained in:
parent
55d07d6549
commit
5a844e25e0
5 changed files with 54 additions and 18 deletions
|
@ -7,12 +7,14 @@
|
|||
|
||||
|
||||
<?php
|
||||
function DisplayCSVNEW($csvfile) {
|
||||
function DisplayCSVNEW($csvfile, $query) {
|
||||
$resultcount=0;
|
||||
$row = 1;
|
||||
echo "<center><table>\n\n"; //begin html table formatting
|
||||
if (($handle = fopen($csvfile, "r")) !== FALSE) {
|
||||
|
||||
|
||||
$oldcatname="";
|
||||
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
|
||||
$num = count($data);
|
||||
//echo "<p>" . $data[1] . "</p>";
|
||||
|
@ -20,30 +22,44 @@ if (($handle = fopen($csvfile, "r")) !== FALSE) {
|
|||
$row++;
|
||||
//echo $row;
|
||||
|
||||
|
||||
if ( $row == "2") {
|
||||
echo "<tr><td>Name</td> <td>Score</td> <td></td></tr>";
|
||||
echo "<tr><td>Category</td> <td>Name</td> <td>Score</td> <td></td></tr>";
|
||||
}else{
|
||||
for ($c=0; $c < $num; $c++) {
|
||||
echo "<tr>"; // beging html table row
|
||||
if (str_contains($data[3], $query) or str_contains($data[2], $query)) {
|
||||
$resultcount++;
|
||||
for ($c=0; $c < $num; $c++) { // iterate over each row
|
||||
echo "<tr>"; // begin html table row for that Category
|
||||
// if the row is the first one (name url status score) only display (Name Status Score):
|
||||
// display the contents of a csv row
|
||||
if ( $c == "1" ){
|
||||
echo "<td>" . '<a href="'; // begin the table cell and a href
|
||||
echo $data[3] . '">'; // display the link
|
||||
echo $data[2] . "</a></td><td>"; // display the link title and close the a href and first cell, open the second cell
|
||||
echo $data[7] . "</td><td>"; // display the status and close the second cell, open the third cell
|
||||
echo $data[6] . "</td> \n"; // display the score and close the third cell
|
||||
|
||||
if ($oldcatname != $data[1]){
|
||||
echo "<td><tr></tr><tr></tr><tr></tr></td>"; // skip a row if new category
|
||||
echo "<td><tr></tr><tr></tr><tr></tr></td>"; // skip a row if new category
|
||||
echo "<td><p><h4>" . $data[1] . '| </h4></p></td>'; // display the category as its the first row with this new category
|
||||
$oldcatname=$data[1];
|
||||
}else{
|
||||
echo "<td><p>" . ' </p></td>'; // category is already displayed so skip it (empty cell in category column)
|
||||
}
|
||||
|
||||
echo "<td>" ; // begin the table cell
|
||||
echo '<a href="'; // begin a href
|
||||
echo $data[3] . '"> '; // display the link
|
||||
echo $data[2] . " </a></td><td>"; // display the link title and close the a href and first cell, open the second cell
|
||||
echo $data[7] . " </td><td>"; // display the status and close the second cell, open the third cell
|
||||
echo $data[6] . " </td> \n"; // display the score and close the third cell
|
||||
}
|
||||
//if ($c == 2){
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</tr>"; // end html table row
|
||||
}
|
||||
echo "\n</table></center>";
|
||||
fclose($handle);
|
||||
}
|
||||
echo "<p>" . $resultcount . " Result(s) found.</p>";
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue