Facebook ads - fbclid error

4 posts by 2 authors in: Forums > CMS Builder
Last Post: Tuesday at 4:07pm   (RSS)

What is each of these lines:
/home/luxurychartergroup/luxurychartergroup.com/fr/yacht-type.php -> line 2

/home/luxurychartergroup/luxurychartergroup.com/fr/yacht-type.php -> line 32

/home/luxurychartergroup/luxurychartergroup.com/404.php -> line 2

It looks like your site is grabbing the GET variable from the URL (in this case fbclid) and then using that to find a page/record in your database. It can't, so 404s.

My guess is your code is something like:

If there's a GET variable, use that to find the page

...but you're doing it for ANY GET variable, so it's using fbclid instead of whatever correct variable you use to get the correct page.

Proof of Concept:

https://www.luxurychartergroup.com/fr/yacht-type.php/sailing-1/?foo=bar

This also errors and 404s.

You need to harden your code to correctly define which GET variable you want to use, rather than any. If you show those lines, it'll likely be an easy fix.

Cheers

Rob

By theclicklab - Tuesday at 1:17pm - edited: Tuesday at 1:18pm

Thanks Rob for those tips, I solved this.

foreach($_REQUEST as $key => $item){
if($key != 'page' && $key != 'sort' && $key != 'gclid' && $key != 'fbclid' && $key != 'msclkid' && strpos($key, 'utm') === false){
$recordNum = preg_replace("/[^0-9,.]/", "",$item);
break;
}
}

Hey,

Not sure on your end goal with $recordNum, but that code will still pass fbclid (and those others) to your $recordNum, which could potentially still cause problems down the line.

Without seeing what you then do with $recordNum, I'm guessing it's used in a mysql_get/select to get the page record?

Cheers