0

This is a follow up for a previous question I asked yesterday here: Slashes in GET request (to be used with PHP back end)

I have a link that has 2 GET parameters in it where I want to use in my PHP whenever I visit that website. The link has both spaces and slashes in it.

Using the amazing answer provided in the previous question, I was able to get the parameters and retrieve them via the get methods as follows:

https://randomness.com?path=%2Fvar%2Fimages%2Fsub%20images%2&name=image%2001.jpg

$path = $_GET['path'];
$name = $_GET['name'];

Then I do a merging for the above in the following way:

$filePath = "$path" . "$name";

then echoying $filepath, gives me : /var/images/sub images/&name=image01.jpg and then use it inside my method, show($filepath);

Unfortunately, this does not work. However, if I use the following:

show('/var/images/sub images/&name=image01.jpg') the method works fine.

To investigate more, whenever I do a comparison using strcmp I get that one string is bigger than the other, even though echoyin both shows the same on the screen.

strcmp($file_name, '/var/images/sub images/&name=image01.jpg'); 

What am I missing?

Community
  • 1
  • 1
tony9099
  • 4,355
  • 7
  • 38
  • 72

0 Answers0