Posted in site bugs
5869
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
120
This Month
665
This Year
576

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
I believe that in order to better your knowledge base, it takes a lot of failing in order to succeed. I don't consider anything a failure as long as you get back up and you learn from your own mistakes.
Unknown
Random CSS Property

text-shadow

The text-shadow CSS property adds shadows to text. It accepts a comma-separated list of shadows to be applied to the text and any of its decorations. Each shadow is described by some combination of X and Y offsets from the element, blur radius, and color.
text-shadow css reference