Posted in site bugs
5978
4:04 am, July 10, 2021
 

weird search results being recorded

i noticed some weird search results being recorded like this:

the search function should only be recording a result if it finds a result, so this should not be added unless it can actually find this text, which i doubt it. 

Some annoying robot is adding this i think. 

page: search.page.php

PHP

if($search_value > "") {
    $page_content .= $class->list_all(
        $start = $start_val,
        $max = $page_step,
        "search", 
        $template_file_name,
        $search_term = $search_value
    );
}

i think the issue is with the search link text being added from the url. it does not validate if the text exists on the page before adding it, so need a check on there before adding it. 

e.g: https://kruxor.com/view/code/DPkzR/weird-search-results-being-recorded/search_text:::weird%20search%20results%20being%20recorded 

I have only allowed the characters on searches, so this should fix the random text issues now.

PHP

$search_text = preg_replace("/[^A-Za-z0-9 ]/", '', $search_text);

see if this solves the problem

View Statistics
This Week
107
This Month
595
This Year
685

No Items Found.

Add Comment
Type in a Nick Name here
 
Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
therock Somewhere along this crazy road I learned (often times the hard way) the most important things I can do is be authentic, trust my gut, be the hardest worker in the room, celebrate the mistakes, be a grateful man and always remember that it's nice to be important, but it's more important to be nice.
The Rock
Random CSS Property

scroll-margin

The scroll-margin shorthand property sets all of the scroll margins of an element at once, assigning values much like the margin property does for margins of an element.
scroll-margin css reference