My haystack is $HTTP_REFERER and what I'm looking for is near the end. I'm checking to see if the result of strpos is > 0. If it is or if the needle variable is empty, it just leaves the variable for $HTTP_REFERER unchanged. If strpos is 0 or if the needle variable is not empty, I append something to the $HTTP_REFERER.
What I'm doing is linking from a query page and I need to send the query data back to the query script if I link back to it from the destination page. I'm using one destination page that can be reached from either the query script of a static page. Rather than having two different pages, I wanted to put logic in to take different action if the referrer was a query page.
You probably don't want to know all that, but I don't think I need to worry about the stated concerns. I've tried every combination of ins and outs from the pages and I've had no anomalies.