I have, at least what I consider, a weird problem....
At the top of a PHP page, is a batch of PHP code that does some specialized database processing. A few lines into that code, we do a comparison to see if the remainder of the page is to be processed or if we should go back to the home page.
The code is something like this....
**** LOAD SOME VARIABLES AND PRESET SOME SETTINGS CODE HERE ****
// Make sure we are in ADMIN mode based on $admin variable being true
if ($admin==false) {
header("Location: ./");
}
**** CONTINUE WITH THIS PAGE ****
What is SUPPOSE to happen:
- if $admin==true, the the page processes and remains on this page.
- if $admin==false, then the page does NOT process and immediately goes to the home page
Here is the "weird" portion:
- no matter what $admin is, the page processes AND goes to the home page
If I put // before the actual header line
if ($admin==false) {
// header("Location: ./");
}
It still does the same exact thing... and processes the page and goes to the home page
If I physically remove the header line
if ($admin==false) {
}
Then the page processes and STAYS on this page.
I've even tried this...
**** LOAD SOME VARIABLES AND PRESET SOME SETTINGS CODE HERE ****
header("Location: ./");
**** CONTINUE WITH THIS PAGE ****
And the page STILL processes THEN goes to the home page.
What am I missing here? I need this page to stop execution at the if loop and leave the page immediately if the if statement is met.