If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

If you are calling from /index.php the file in /files/ym/status.php, and it is opening the ./icons/00/icon.gif, than the problem here is that the filepath is incorrect. The filepath to the icon is under /files/ym/icons/00/icon.gif, but from the index, this path will resolve to /icons/00/icon.gif, which means you aren't getting the file you need.

Go back to the previous code you had without the printf's in it, and change this: $file = './icon/'.$sStatus.'/'.$_GET['img'].'.gif'; // This $_GET['img'] isn't really the most secure. Perhaps a switch validation should be used. to this: $file = __DIR__ . '/./icon/'.$sStatus.'/'.$_GET['img'].'.gif'; // This $_GET['img'] isn't really the most secure. Perhaps a switch validation should be used. and see if that does the trick.

I'm still curious as to why the file_get_contents is used directly within the status on the original code, but I have to find it as the second line of the body.

So what is in $sStatus immediately before calling the is_file check? The only tests I've run indicate that it is 00 that I get, but that doesn't mean you get the same depending on your results (since I also get the page cannot be found when I provide it with the headers to mock the browser).
I'm wondering if it needs more header information since I do get differing information based on what it is given.

PHP Code:

header('HTTP/1.1 420 Enhance Your Calm');

Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

It will work so long as the file exists.
That code's job is to make sure it is available. Without an else clause though, it carries little meaning since the script itself will be used in the scope of an img tag or a renderable image type, so without an else clause to provide it with an alternate image to work with, it will create a broken image link regardless of if the is_file is used or not and the file doesn't exist.

PHP Code:

header('HTTP/1.1 420 Enhance Your Calm');

Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

Users who have thanked Fou-Lu for this post:

It will work so long as the file exists.
That code's job is to make sure it is available. Without an else clause though, it carries little meaning since the script itself will be used in the scope of an img tag or a renderable image type, so without an else clause to provide it with an alternate image to work with, it will create a broken image link regardless of if the is_file is used or not and the file doesn't exist.

If its working, it much further ahead yeah.
This won't work, at least not the way it's supposed to: if ($sStatus == 01). It *will* work because of PHP's datatype weakness, but it won't work logically since you are comparing a string '01' to octal 01. With the datatype weakness this compares 1 to 1. I'd suggest keeping them as string comparisons though.
I'd also still use the is_file check, but provide a hard coded alternative path for just in case it cannot find the file you have specified.

PHP Code:

header('HTTP/1.1 420 Enhance Your Calm');

Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)