Quote:
Originally Posted by pbmods
Heya, Sam.
Let me get out my nitpicking needles here....
If you've established that $_GET['page'] is numeric, you don't need to do any SQL or HTML escaping. A simple $page = (int) $_GET['page'] will do.
-
if ($page == 1) {
-
imagegif($image); // paint the image in browser
-
imagegif($image, "user/" . $user . ".gif"); //export as gif file
-
So far so good.
-
} elseif(!isset($filter) && $page == 1) {
-
By this point, you already know that $page == 1 because of the previous condition.
This is effectively an else block.
And the rest of the code will never get executed.
Try using the identity operator, since PHP does some screwy things when you use the equality operator on a value that could evaluate to (bool) true.
In other words:
-
3 == true == 1 // But 3 != 1 except in rare instances.
-
3 !== true !== 1
-
This should do just fine:
-
if( $page === 1 )
-
{
-
// display and save
-
}
-
else
-
{
-
// display only
-
}
-
Yeah, I realised that. Thanks for that, I made some changes; I had to use this in the end:
-
-
if (isset($filter)) {
-
imagegif($image); // paint the image in browser
-
} elseif ($page == 1) {
-
imagegif($image); // paint the image in browser
-
imagegif($image, "user/" . $user . ".gif"); //export as gif file
-
} else {
-
// Here, $page != 1 && !isset($filter)
-
imagegif($image); // paint the image in browser
-
}
-
I had to use the $filter one first because the $page variable is still in the url even when $filter is set, so if $page was it the first IF, it would still save even if $filter was set. The way I have it now it works poifectly.
Thanks for your help once again. :)
Sam