fix error when empty query + displays are case insensitive

This commit is contained in:
root 2025-02-20 08:21:54 +01:00
parent b03983b99d
commit d81173a488
2 changed files with 4 additions and 10 deletions

View file

@ -57,7 +57,7 @@ if (!preg_match("~^(?:f|ht)tps?://~i", $data[3])) {
$rowcount++;
if ($oldcatname != $data[1]){
if (strtolower($oldcatname) != strtolower($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 class="category"><p><h4>' . $data[1] . ' </h4></p></td>'; // display the category as its the first row with this new category
@ -158,26 +158,21 @@ if (($handle = fopen($csvfile, "r")) !== FALSE) {
$data[6]=preg_replace("/[^a-zA-Z0-9:\/.\ -]/", "", $data[6]);
$data[7]=preg_replace("/[^a-zA-Z0-9:\/.\ -]/", "", $data[7]);
if (str_contains(strtolower($data[3]), strtolower($query)) or str_contains(strtolower($data[2]), strtolower($query)) or str_contains(strtolower($data[1]), strtolower($query))) {
$resultcount++;
for ($c=0; $c < $num; $c++) { // iterate over each row
// 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" ){
if ($oldcatname != $data[1]){
if (strtolower($oldcatname) != strtolower($data[1])){
echo '<a href="index.php?query=' . $data[1] . '">' . $data[1] . '</a> | '; // display the category as its the first row with this new category
$oldcatname=$data[1];
}
}
}
}
}
}
echo '<a class="sensitivelink" href="index.php?query=.&sensitive=1">Display All Links</a> |</p>';
fclose($handle);
}
//echo "<p>" . $resultcount . " Result(s) found.</p>";
}
}

View file

@ -84,9 +84,8 @@ require("header.php");
// only display the results of unverified.csv that matches with the search term
}
else{ // if query length is less than minimum or more than maximum
echo '</br></br><img src="img/logo-large.png" class="width: 100%"><p>Search query must be between '.$min_length . " and ".$max_length . " characters.</p>";
// TODO list the available categories
else { // if query length is less than minimum or more than maximum
echo '</br></br><img src="img/logo-large.png"><p>Search query must be between ' . $min_length . " and " . $max_length . " characters.</p>";
}
?>
</div>